ropav 0.0.10 → 0.0.12
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/README.md +9 -0
- package/dist/accordion.css +115 -111
- package/dist/accordion.js +60 -16
- package/dist/alert.css +110 -108
- package/dist/alert.js +48 -26
- package/dist/aspect-ratio.css +17 -15
- package/dist/aspect-ratio.js +20 -6
- package/dist/avatar.css +98 -96
- package/dist/avatar.js +27 -16
- package/dist/badge.css +95 -93
- package/dist/badge.js +29 -16
- package/dist/base.css +672 -671
- package/dist/button-group.css +39 -37
- package/dist/button-group.js +23 -12
- package/dist/button-link.css +160 -158
- package/dist/button-link.js +43 -24
- package/dist/button.css +160 -158
- package/dist/button.js +37 -19
- package/dist/card.css +109 -107
- package/dist/card.js +42 -17
- package/dist/checkbox.css +139 -137
- package/dist/checkbox.js +103 -33
- package/dist/collapse.css +29 -27
- package/dist/collapse.js +44 -10
- package/dist/color-input.css +137 -107
- package/dist/color-input.js +117 -30
- package/dist/color-picker.css +309 -303
- package/dist/color-picker.js +147 -54
- package/dist/color-picker2.js +9 -1
- package/dist/color-swatch.css +48 -46
- package/dist/color-swatch.js +15 -11
- package/dist/color-swatch2.js +4 -0
- package/dist/components/accordion/accordion-item.d.ts +13 -1
- package/dist/components/accordion/index.d.ts +2 -1
- package/dist/components/accordion/index.js +2 -2
- package/dist/components/accordion/types.d.ts +9 -4
- package/dist/components/alert/alert.d.ts +2 -2
- package/dist/components/alert/index.d.ts +2 -2
- package/dist/components/alert/index.js +2 -2
- package/dist/components/alert/types.d.ts +4 -1
- package/dist/components/aspect-ratio/index.d.ts +2 -1
- package/dist/components/aspect-ratio/index.js +2 -2
- package/dist/components/aspect-ratio/types.d.ts +4 -1
- package/dist/components/avatar/index.d.ts +2 -2
- package/dist/components/avatar/index.js +2 -2
- package/dist/components/avatar/types.d.ts +4 -1
- package/dist/components/badge/index.d.ts +2 -2
- package/dist/components/badge/index.js +2 -2
- package/dist/components/badge/types.d.ts +4 -1
- package/dist/components/button/index.d.ts +2 -1
- package/dist/components/button/index.js +2 -2
- package/dist/components/button/types.d.ts +4 -1
- package/dist/components/button-group/index.d.ts +2 -1
- package/dist/components/button-group/index.js +2 -2
- package/dist/components/button-group/types.d.ts +4 -1
- package/dist/components/button-link/index.d.ts +2 -1
- package/dist/components/button-link/index.js +2 -2
- package/dist/components/button-link/types.d.ts +4 -1
- package/dist/components/card/index.d.ts +2 -1
- package/dist/components/card/index.js +2 -2
- package/dist/components/card/types.d.ts +5 -1
- package/dist/components/checkbox/checkbox.d.ts +4 -1
- package/dist/components/checkbox/index.d.ts +2 -1
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/checkbox/types.d.ts +11 -2
- package/dist/components/checkbox/useCheckbox.d.ts +3 -1
- package/dist/components/collapse/collapse.d.ts +2 -2
- package/dist/components/collapse/index.d.ts +2 -1
- package/dist/components/collapse/index.js +2 -2
- package/dist/components/collapse/types.d.ts +9 -2
- package/dist/components/color-input/index.d.ts +2 -1
- package/dist/components/color-input/index.js +2 -2
- package/dist/components/color-input/types.d.ts +8 -2
- package/dist/components/color-input/useColorInput.d.ts +1 -1
- package/dist/components/color-input/useColorInputValue.d.ts +1 -1
- package/dist/components/color-picker/index.d.ts +2 -2
- package/dist/components/color-picker/index.js +2 -2
- package/dist/components/color-picker/types.d.ts +13 -1
- package/dist/components/color-swatch/index.d.ts +2 -1
- package/dist/components/color-swatch/index.js +2 -1
- package/dist/components/color-swatch/types.d.ts +4 -1
- package/dist/components/dialog/dialog-close.d.ts +21 -0
- package/dist/components/dialog/dialog-content.d.ts +32 -0
- package/dist/components/dialog/dialog-core.d.ts +27 -0
- package/dist/components/dialog/dialog-description.d.ts +21 -0
- package/dist/components/dialog/dialog-overlay.d.ts +21 -0
- package/dist/components/dialog/dialog-portal.d.ts +21 -0
- package/dist/components/dialog/dialog-root.d.ts +28 -0
- package/dist/components/dialog/dialog-title.d.ts +21 -0
- package/dist/components/dialog/dialog-trigger.d.ts +23 -0
- package/dist/components/dialog/index.d.ts +9 -0
- package/dist/components/dialog/index.js +2 -0
- package/dist/components/dialog/types.d.ts +61 -0
- package/dist/components/dropdown-menu/dropdown-menu-checkbox-item.d.ts +24 -0
- package/dist/components/dropdown-menu/dropdown-menu-content.d.ts +34 -0
- package/dist/components/dropdown-menu/dropdown-menu-context-trigger.d.ts +23 -0
- package/dist/components/dropdown-menu/dropdown-menu-item-indicator.d.ts +24 -0
- package/dist/components/dropdown-menu/dropdown-menu-item-row.d.ts +28 -0
- package/dist/components/dropdown-menu/dropdown-menu-item.d.ts +23 -0
- package/dist/components/dropdown-menu/dropdown-menu-items.d.ts +24 -22
- package/dist/components/dropdown-menu/dropdown-menu-label.d.ts +21 -0
- package/dist/components/dropdown-menu/dropdown-menu-outside.d.ts +3 -0
- package/dist/components/dropdown-menu/dropdown-menu-portal.d.ts +21 -0
- package/dist/components/dropdown-menu/dropdown-menu-primitive-core.d.ts +110 -0
- package/dist/components/dropdown-menu/dropdown-menu-primitives.d.ts +15 -0
- package/dist/components/dropdown-menu/dropdown-menu-radio-group.d.ts +25 -0
- package/dist/components/dropdown-menu/dropdown-menu-radio-item.d.ts +23 -0
- package/dist/components/dropdown-menu/dropdown-menu-root.d.ts +30 -0
- package/dist/components/dropdown-menu/dropdown-menu-separator.d.ts +19 -0
- package/dist/components/dropdown-menu/dropdown-menu-sub-content.d.ts +34 -0
- package/dist/components/dropdown-menu/dropdown-menu-sub-trigger.d.ts +28 -0
- package/dist/components/dropdown-menu/dropdown-menu-sub.d.ts +28 -0
- package/dist/components/dropdown-menu/dropdown-menu-trigger.d.ts +23 -0
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +6 -3
- package/dist/components/dropdown-menu/index.d.ts +32 -1
- package/dist/components/dropdown-menu/index.js +2 -2
- package/dist/components/dropdown-menu/types.d.ts +145 -6
- package/dist/components/dropdown-menu/useDropdownMenu.d.ts +15 -3
- package/dist/components/dropdown-menu/useDropdownMenuDisclosure.d.ts +10 -3
- package/dist/components/dropdown-menu/useDropdownMenuDom.d.ts +2 -1
- package/dist/components/dropdown-menu/useDropdownMenuInteractions.d.ts +4 -4
- package/dist/components/dropdown-menu/useDropdownMenuPortalPosition.d.ts +19 -0
- package/dist/components/dropdown-menu/useDropdownMenuPrimitiveContent.d.ts +27 -0
- package/dist/components/dropdown-menu/useDropdownMenuRenderItems.d.ts +14 -2
- package/dist/components/field/index.d.ts +2 -1
- package/dist/components/field/index.js +2 -2
- package/dist/components/field/types.d.ts +4 -1
- package/dist/components/floating/index.d.ts +3 -0
- package/dist/components/floating/index.js +3 -0
- package/dist/components/floating/types.d.ts +105 -0
- package/dist/components/floating/useFloatingPosition.d.ts +15 -0
- package/dist/components/floating/useHoverDisclosure.d.ts +2 -0
- package/dist/components/focus-trap/focus-trap.d.ts +31 -0
- package/dist/components/focus-trap/index.d.ts +4 -0
- package/dist/components/focus-trap/index.js +3 -0
- package/dist/components/focus-trap/types.d.ts +41 -0
- package/dist/components/focus-trap/useFocusTrap.d.ts +2 -0
- package/dist/components/icon-button/index.d.ts +2 -1
- package/dist/components/icon-button/index.js +2 -1
- package/dist/components/icon-button/types.d.ts +4 -1
- package/dist/components/input/index.d.ts +2 -1
- package/dist/components/input/index.js +2 -1
- package/dist/components/input/input.d.ts +4 -1
- package/dist/components/input/types.d.ts +7 -2
- package/dist/components/modal/index.d.ts +2 -1
- package/dist/components/modal/index.js +2 -2
- package/dist/components/modal/modal.d.ts +3 -1
- package/dist/components/modal/types.d.ts +11 -1
- package/dist/components/modal/useModal.d.ts +7 -4
- package/dist/components/number-input/index.d.ts +2 -1
- package/dist/components/number-input/index.js +2 -2
- package/dist/components/number-input/types.d.ts +7 -2
- package/dist/components/number-input/useNumberInput.d.ts +2 -1
- package/dist/components/overlay/index.d.ts +2 -1
- package/dist/components/overlay/index.js +2 -1
- package/dist/components/overlay/types.d.ts +4 -1
- package/dist/components/popover/index.d.ts +2 -2
- package/dist/components/popover/index.js +2 -2
- package/dist/components/popover/popover.d.ts +2 -2
- package/dist/components/popover/types.d.ts +20 -11
- package/dist/components/popover/usePopover.d.ts +9 -1
- package/dist/components/progress/index.d.ts +2 -2
- package/dist/components/progress/index.js +2 -2
- package/dist/components/progress/types.d.ts +4 -1
- package/dist/components/radio/index.d.ts +2 -1
- package/dist/components/radio/index.js +2 -2
- package/dist/components/radio/radio.d.ts +8 -3
- package/dist/components/radio/types.d.ts +37 -4
- package/dist/components/radio/useRadio.d.ts +12 -4
- package/dist/components/select/index.d.ts +2 -1
- package/dist/components/select/index.js +2 -2
- package/dist/components/select/select.d.ts +4 -1
- package/dist/components/select/types.d.ts +10 -2
- package/dist/components/select/useSelect.d.ts +3 -1
- package/dist/components/slider/index.d.ts +2 -2
- package/dist/components/slider/index.js +2 -2
- package/dist/components/slider/range-slider-tooltip.d.ts +3 -0
- package/dist/components/slider/range-slider.d.ts +7 -4
- package/dist/components/slider/slider.d.ts +4 -1
- package/dist/components/slider/sliderCore.d.ts +4 -4
- package/dist/components/slider/types.d.ts +22 -4
- package/dist/components/slider/useRangeSlider.d.ts +2 -2
- package/dist/components/slider/useSlider.d.ts +2 -2
- package/dist/components/switch/index.d.ts +2 -1
- package/dist/components/switch/index.js +2 -2
- package/dist/components/switch/switch.d.ts +4 -1
- package/dist/components/switch/types.d.ts +11 -2
- package/dist/components/switch/useSwitch.d.ts +3 -1
- package/dist/components/tabs/index.d.ts +2 -1
- package/dist/components/tabs/index.js +2 -2
- package/dist/components/tabs/types.d.ts +13 -4
- package/dist/components/teleport-provider/index.d.ts +3 -0
- package/dist/components/teleport-provider/index.js +3 -0
- package/dist/components/teleport-provider/teleport-provider.d.ts +21 -0
- package/dist/components/teleport-provider/types.d.ts +4 -0
- package/dist/components/teleport-provider/useTeleportTarget.d.ts +6 -0
- package/dist/components/textarea/index.d.ts +2 -1
- package/dist/components/textarea/index.js +2 -2
- package/dist/components/textarea/textarea.d.ts +4 -1
- package/dist/components/textarea/types.d.ts +10 -2
- package/dist/components/textarea/useTextarea.d.ts +2 -1
- package/dist/components/toast/index.d.ts +3 -2
- package/dist/components/toast/index.js +2 -2
- package/dist/components/toast/toast-store.d.ts +2 -0
- package/dist/components/toast/toast.d.ts +2 -2
- package/dist/components/toast/types.d.ts +20 -10
- package/dist/components/toast/useToast.d.ts +2 -2
- package/dist/components/tooltip/index.d.ts +2 -1
- package/dist/components/tooltip/index.js +2 -1
- package/dist/components/tooltip/tooltip.d.ts +2 -2
- package/dist/components/tooltip/types.d.ts +13 -12
- package/dist/components/tooltip/useTooltip.d.ts +12 -2
- package/dist/composables/useOverlayLayer.d.ts +32 -0
- package/dist/dialog.js +510 -0
- package/dist/dropdown-menu.css +191 -108
- package/dist/dropdown-menu.js +1954 -198
- package/dist/field.css +41 -39
- package/dist/field.js +40 -16
- package/dist/floating.js +403 -0
- package/dist/focus-trap.js +80 -0
- package/dist/icon-button.css +193 -189
- package/dist/icon-button.js +23 -18
- package/dist/icon-button2.js +8 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +39 -32
- package/dist/input.css +122 -120
- package/dist/input.js +63 -40
- package/dist/input2.js +9 -0
- package/dist/legacy-unlayered.css +5382 -0
- package/dist/modal.css +129 -127
- package/dist/modal.js +182 -281
- package/dist/number-input.css +87 -85
- package/dist/number-input.js +98 -26
- package/dist/overlay.css +26 -24
- package/dist/overlay.js +17 -9
- package/dist/overlay2.js +4 -0
- package/dist/popover.css +140 -107
- package/dist/popover.js +276 -196
- package/dist/popover2.js +6 -1
- package/dist/progress.css +101 -99
- package/dist/progress.js +50 -28
- package/dist/radio.css +114 -105
- package/dist/radio.js +237 -61
- package/dist/select.css +255 -242
- package/dist/select.js +257 -94
- package/dist/slider.css +1090 -1031
- package/dist/slider.js +443 -175
- package/dist/styles-api.d.ts +22 -0
- package/dist/styles-api.js +49 -0
- package/dist/switch.css +120 -108
- package/dist/switch.js +112 -38
- package/dist/tabs.css +286 -278
- package/dist/tabs.js +60 -21
- package/dist/teleport-provider.js +15 -0
- package/dist/textarea.css +132 -130
- package/dist/textarea.js +83 -31
- package/dist/toast.css +229 -225
- package/dist/toast.js +189 -118
- package/dist/tooltip.css +61 -106
- package/dist/tooltip.js +184 -228
- package/dist/tooltip2.js +8 -0
- package/dist/useControlState.js +4 -0
- package/dist/useFloatingPosition.js +1317 -0
- package/dist/useFocusTrap.js +130 -0
- package/dist/useFormControl.js +107 -0
- package/dist/useOverlayLayer.js +262 -0
- package/dist/useTeleportTarget.js +40 -0
- package/docs/public-floating-api.md +148 -0
- package/docs/public-styles-api.md +134 -0
- package/docs/public-tokens.md +545 -0
- package/package.json +37 -9
- package/src/styles/_tokens.scss +33 -28
- package/src/styles/_utilities.scss +11 -9
- package/src/styles/styles-manifest.json +4125 -0
- package/dist/rafScheduler.js +0 -34
- package/dist/useClickOutside.js +0 -24
package/dist/dropdown-menu.js
CHANGED
|
@@ -1,11 +1,1501 @@
|
|
|
1
1
|
import './dropdown-menu.css';
|
|
2
2
|
import { t as bem } from "./bem.js";
|
|
3
|
-
import { t as
|
|
4
|
-
import {
|
|
3
|
+
import { n as useStylesApi, t as presence } from "./styles-api.js";
|
|
4
|
+
import { t as useRequiredInject } from "./useRequiredInject.js";
|
|
5
|
+
import { t as useOverlayLayer } from "./useOverlayLayer.js";
|
|
6
|
+
import { n as useFloatingPosition, r as useFloatingTarget, t as isElementReference } from "./useFloatingPosition.js";
|
|
7
|
+
import { n as useTeleportPositioningKey, r as useTeleportTarget, t as provideTeleportTarget } from "./useTeleportTarget.js";
|
|
8
|
+
import { VaporTeleport, VaporTransition, child, computed, createComponent, createComponentWithFallback, createDynamicComponent, createFor, createIf, createSlot, createTemplateRefSetter, defineVaporComponent, extend, isRef, markRaw, mergeProps, nextTick, onBeforeUnmount, onMounted, onUnmounted, provide, ref, renderEffect, resolveComponent, setAttr, setDynamicProps, setInsertionState, setStaticTemplateRef, setStyle, setTemplateRefBinding, setText, shallowRef, template, toDisplayString, txt, unref, useAttrs, useId, watch } from "vue";
|
|
9
|
+
//#region src/components/dropdown-menu/dropdown-menu-primitive-core.ts
|
|
10
|
+
var rootKey = Symbol("dropdown-menu-root");
|
|
11
|
+
var menuKey = Symbol("dropdown-menu-content");
|
|
12
|
+
var subKey = Symbol("dropdown-menu-sub");
|
|
13
|
+
var radioGroupKey = Symbol("dropdown-menu-radio-group");
|
|
14
|
+
var checkedKey = Symbol("dropdown-menu-checked");
|
|
15
|
+
function optionalAttr(value) {
|
|
16
|
+
return value || void 0;
|
|
17
|
+
}
|
|
18
|
+
function getFocusTarget(options) {
|
|
19
|
+
if (typeof options === "string") return options;
|
|
20
|
+
return options?.focus ?? "first";
|
|
21
|
+
}
|
|
22
|
+
function toHTMLElement(value, fallbackId) {
|
|
23
|
+
if (typeof HTMLElement !== "undefined" && value instanceof HTMLElement) return value;
|
|
24
|
+
if (typeof HTMLElement === "undefined") return null;
|
|
25
|
+
const vdomElement = value?.$el;
|
|
26
|
+
if (vdomElement instanceof HTMLElement) return vdomElement;
|
|
27
|
+
const vaporBlock = value?.block;
|
|
28
|
+
if (vaporBlock instanceof HTMLElement) return vaporBlock;
|
|
29
|
+
return fallbackId && typeof document !== "undefined" ? document.getElementById(fallbackId) : null;
|
|
30
|
+
}
|
|
31
|
+
function resolveHTMLElementRef(value, fallbackId, resolve) {
|
|
32
|
+
const element = toHTMLElement(value, fallbackId);
|
|
33
|
+
resolve(element);
|
|
34
|
+
if (element || !value) return;
|
|
35
|
+
nextTick(() => resolve(toHTMLElement(value, fallbackId)));
|
|
36
|
+
}
|
|
37
|
+
function createPointRect(point) {
|
|
38
|
+
return {
|
|
39
|
+
x: point.x,
|
|
40
|
+
y: point.y,
|
|
41
|
+
left: point.x,
|
|
42
|
+
right: point.x,
|
|
43
|
+
top: point.y,
|
|
44
|
+
bottom: point.y,
|
|
45
|
+
width: 0,
|
|
46
|
+
height: 0,
|
|
47
|
+
toJSON: () => ({})
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function createVirtualAnchor(point) {
|
|
51
|
+
return { getBoundingClientRect: () => createPointRect(point) };
|
|
52
|
+
}
|
|
53
|
+
function createCustomEvent(type, detail, originalEvent) {
|
|
54
|
+
const target = originalEvent.target;
|
|
55
|
+
return new (((target instanceof Node ? target.ownerDocument?.defaultView : null)?.CustomEvent) ?? CustomEvent)(type, {
|
|
56
|
+
bubbles: false,
|
|
57
|
+
cancelable: true,
|
|
58
|
+
detail
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function createSelectEvent(originalEvent, value) {
|
|
62
|
+
return createCustomEvent("dropdown-menu-select", {
|
|
63
|
+
originalEvent,
|
|
64
|
+
value
|
|
65
|
+
}, originalEvent);
|
|
66
|
+
}
|
|
67
|
+
function createOutsideEvent(originalEvent) {
|
|
68
|
+
return createCustomEvent("dropdown-menu-interact-outside", { originalEvent }, originalEvent);
|
|
69
|
+
}
|
|
70
|
+
function sortItems(items) {
|
|
71
|
+
return [...items].sort((left, right) => {
|
|
72
|
+
const leftElement = left.element();
|
|
73
|
+
const rightElement = right.element();
|
|
74
|
+
if (!leftElement || !rightElement || leftElement === rightElement) return 0;
|
|
75
|
+
const position = leftElement.compareDocumentPosition(rightElement);
|
|
76
|
+
if (position & Node.DOCUMENT_POSITION_FOLLOWING) return -1;
|
|
77
|
+
if (position & Node.DOCUMENT_POSITION_PRECEDING) return 1;
|
|
78
|
+
return 0;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function getPlacementSide(placement) {
|
|
82
|
+
return placement.split("-")[0];
|
|
83
|
+
}
|
|
84
|
+
function getOpenDirection(sub) {
|
|
85
|
+
return getPlacementSide(sub.actualPlacement.value) === "left" ? "ArrowLeft" : "ArrowRight";
|
|
86
|
+
}
|
|
87
|
+
function getCloseDirection(menu) {
|
|
88
|
+
return getPlacementSide(menu.actualPlacement.value) === "left" ? "ArrowRight" : "ArrowLeft";
|
|
89
|
+
}
|
|
90
|
+
function blockDocumentClick(event) {
|
|
91
|
+
if (event.cancelable) event.preventDefault();
|
|
92
|
+
event.stopPropagation();
|
|
93
|
+
document.removeEventListener("click", blockDocumentClick, true);
|
|
94
|
+
}
|
|
95
|
+
function blockNextDocumentClick() {
|
|
96
|
+
if (typeof document === "undefined") return;
|
|
97
|
+
document.addEventListener("click", blockDocumentClick, true);
|
|
98
|
+
window.setTimeout(() => document.removeEventListener("click", blockDocumentClick, true), 1e3);
|
|
99
|
+
}
|
|
100
|
+
function createMenuContext(options) {
|
|
101
|
+
const items = shallowRef([]);
|
|
102
|
+
const activeId = ref(null);
|
|
103
|
+
const submenus = /* @__PURE__ */ new Set();
|
|
104
|
+
function getEnabledItems() {
|
|
105
|
+
return sortItems(items.value).filter((item) => !item.disabled());
|
|
106
|
+
}
|
|
107
|
+
function registerItem(item) {
|
|
108
|
+
items.value = [...items.value.filter((current) => current.id !== item.id), item];
|
|
109
|
+
if ((options.parentSub?.isOpen.value ?? options.root.isOpen.value) && activeId.value == null && !item.disabled()) {
|
|
110
|
+
activeId.value = item.id;
|
|
111
|
+
nextTick(() => {
|
|
112
|
+
options.element.value?.focus();
|
|
113
|
+
item.element()?.scrollIntoView?.({ block: "nearest" });
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function unregisterItem(id) {
|
|
118
|
+
items.value = items.value.filter((item) => item.id !== id);
|
|
119
|
+
if (activeId.value === id) activeId.value = null;
|
|
120
|
+
}
|
|
121
|
+
function registerSub(sub) {
|
|
122
|
+
submenus.add(sub);
|
|
123
|
+
}
|
|
124
|
+
function unregisterSub(sub) {
|
|
125
|
+
submenus.delete(sub);
|
|
126
|
+
}
|
|
127
|
+
function closeSubmenus(except) {
|
|
128
|
+
for (const submenu of submenus) if (submenu !== except) submenu.close(false);
|
|
129
|
+
}
|
|
130
|
+
function setActive(id) {
|
|
131
|
+
const item = items.value.find((current) => current.id === id);
|
|
132
|
+
if (!item || item.disabled()) return;
|
|
133
|
+
activeId.value = id;
|
|
134
|
+
nextTick(() => item.element()?.scrollIntoView?.({ block: "nearest" }));
|
|
135
|
+
}
|
|
136
|
+
function focus(target = "first") {
|
|
137
|
+
const enabledItems = getEnabledItems();
|
|
138
|
+
const item = target === "last" ? enabledItems[enabledItems.length - 1] : enabledItems[0];
|
|
139
|
+
if (!item) {
|
|
140
|
+
activeId.value = null;
|
|
141
|
+
options.element.value?.focus();
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
activeId.value = item.id;
|
|
145
|
+
options.element.value?.focus();
|
|
146
|
+
item.element()?.scrollIntoView?.({ block: "nearest" });
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
function focusElement() {
|
|
150
|
+
options.element.value?.focus();
|
|
151
|
+
}
|
|
152
|
+
function move(direction) {
|
|
153
|
+
const enabledItems = getEnabledItems();
|
|
154
|
+
if (enabledItems.length === 0) return;
|
|
155
|
+
const currentIndex = enabledItems.findIndex((item) => item.id === activeId.value);
|
|
156
|
+
const item = enabledItems[((currentIndex < 0 ? direction === 1 ? -1 : 0 : currentIndex) + direction + enabledItems.length) % enabledItems.length];
|
|
157
|
+
if (item) setActive(item.id);
|
|
158
|
+
}
|
|
159
|
+
function onHorizontalKeydown(event, active) {
|
|
160
|
+
if (options.parentSub && event.key === getCloseDirection(context)) {
|
|
161
|
+
event.preventDefault();
|
|
162
|
+
event.stopPropagation();
|
|
163
|
+
options.parentSub.close(true);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (!active?.submenu || event.key !== getOpenDirection(active.submenu)) return;
|
|
167
|
+
event.preventDefault();
|
|
168
|
+
event.stopPropagation();
|
|
169
|
+
active.submenu.open("first");
|
|
170
|
+
}
|
|
171
|
+
function onKeydown(event) {
|
|
172
|
+
const active = items.value.find((item) => item.id === activeId.value);
|
|
173
|
+
switch (event.key) {
|
|
174
|
+
case "ArrowDown":
|
|
175
|
+
event.preventDefault();
|
|
176
|
+
event.stopPropagation();
|
|
177
|
+
move(1);
|
|
178
|
+
break;
|
|
179
|
+
case "ArrowUp":
|
|
180
|
+
event.preventDefault();
|
|
181
|
+
event.stopPropagation();
|
|
182
|
+
move(-1);
|
|
183
|
+
break;
|
|
184
|
+
case "Home":
|
|
185
|
+
event.preventDefault();
|
|
186
|
+
event.stopPropagation();
|
|
187
|
+
focus("first");
|
|
188
|
+
break;
|
|
189
|
+
case "End":
|
|
190
|
+
event.preventDefault();
|
|
191
|
+
event.stopPropagation();
|
|
192
|
+
focus("last");
|
|
193
|
+
break;
|
|
194
|
+
case "ArrowRight":
|
|
195
|
+
case "ArrowLeft":
|
|
196
|
+
onHorizontalKeydown(event, active);
|
|
197
|
+
break;
|
|
198
|
+
case "Enter":
|
|
199
|
+
case " ":
|
|
200
|
+
event.preventDefault();
|
|
201
|
+
event.stopPropagation();
|
|
202
|
+
active?.activate(event);
|
|
203
|
+
break;
|
|
204
|
+
case "Escape":
|
|
205
|
+
event.preventDefault();
|
|
206
|
+
event.stopPropagation();
|
|
207
|
+
options.onEscape(event);
|
|
208
|
+
break;
|
|
209
|
+
case "Tab":
|
|
210
|
+
options.root.close({ returnFocus: false });
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
const context = {
|
|
215
|
+
root: options.root,
|
|
216
|
+
element: options.element,
|
|
217
|
+
activeId,
|
|
218
|
+
actualPlacement: options.actualPlacement,
|
|
219
|
+
parentSub: options.parentSub,
|
|
220
|
+
registerItem,
|
|
221
|
+
unregisterItem,
|
|
222
|
+
registerSub,
|
|
223
|
+
unregisterSub,
|
|
224
|
+
closeSubmenus,
|
|
225
|
+
setActive,
|
|
226
|
+
isActive: (id) => activeId.value === id,
|
|
227
|
+
focus,
|
|
228
|
+
focusElement,
|
|
229
|
+
onKeydown
|
|
230
|
+
};
|
|
231
|
+
return context;
|
|
232
|
+
}
|
|
233
|
+
function usePrimitiveItem(componentName, props, emitSelect, options) {
|
|
234
|
+
const menu = useRequiredInject(menuKey, componentName);
|
|
235
|
+
const generatedId = useId();
|
|
236
|
+
const id = computed(() => props.id ?? `${generatedId}-item`);
|
|
237
|
+
const element = ref(null);
|
|
238
|
+
const isDisabled = computed(() => Boolean(menu.root.disabled.value || props.disabled));
|
|
239
|
+
const focused = computed(() => menu.isActive(id.value));
|
|
240
|
+
function activate(originalEvent) {
|
|
241
|
+
if (isDisabled.value) return;
|
|
242
|
+
const selectEvent = createSelectEvent(originalEvent, props.value);
|
|
243
|
+
emitSelect(selectEvent);
|
|
244
|
+
options.afterSelect?.();
|
|
245
|
+
if (!selectEvent.defaultPrevented && (props.closeOnSelect ?? options.defaultCloseOnSelect)) menu.root.close({ returnFocus: true });
|
|
246
|
+
}
|
|
247
|
+
const registration = {
|
|
248
|
+
get id() {
|
|
249
|
+
return id.value;
|
|
250
|
+
},
|
|
251
|
+
element: () => element.value,
|
|
252
|
+
disabled: () => isDisabled.value,
|
|
253
|
+
activate
|
|
254
|
+
};
|
|
255
|
+
menu.registerItem(registration);
|
|
256
|
+
watch(id, (nextId, previousId) => {
|
|
257
|
+
menu.unregisterItem(previousId);
|
|
258
|
+
menu.registerItem(registration);
|
|
259
|
+
if (menu.activeId.value === previousId) menu.activeId.value = nextId;
|
|
260
|
+
});
|
|
261
|
+
onBeforeUnmount(() => menu.unregisterItem(id.value));
|
|
262
|
+
function setElement(value) {
|
|
263
|
+
resolveHTMLElementRef(value, id.value, (resolved) => {
|
|
264
|
+
element.value = resolved;
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
function onPointerenter() {
|
|
268
|
+
if (isDisabled.value) return;
|
|
269
|
+
menu.closeSubmenus();
|
|
270
|
+
menu.setActive(id.value);
|
|
271
|
+
}
|
|
272
|
+
function select() {
|
|
273
|
+
activate(new Event("select"));
|
|
274
|
+
}
|
|
275
|
+
return {
|
|
276
|
+
menu,
|
|
277
|
+
id,
|
|
278
|
+
element,
|
|
279
|
+
isDisabled,
|
|
280
|
+
focused,
|
|
281
|
+
checked: options.checked,
|
|
282
|
+
activate,
|
|
283
|
+
select,
|
|
284
|
+
setElement,
|
|
285
|
+
onPointerenter
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
//#endregion
|
|
289
|
+
//#region src/components/dropdown-menu/dropdown-menu-checkbox-item.vue
|
|
290
|
+
var dropdown_menu_checkbox_item_default = /* @__PURE__ */ defineVaporComponent({
|
|
291
|
+
name: "RpDropdownMenuCheckboxItem",
|
|
292
|
+
inheritAttrs: false,
|
|
293
|
+
__name: "dropdown-menu-checkbox-item",
|
|
294
|
+
props: {
|
|
295
|
+
modelValue: {
|
|
296
|
+
type: [Boolean, String],
|
|
297
|
+
default: void 0
|
|
298
|
+
},
|
|
299
|
+
defaultValue: {
|
|
300
|
+
type: [Boolean, String],
|
|
301
|
+
default: false
|
|
302
|
+
},
|
|
303
|
+
id: {},
|
|
304
|
+
as: { default: "button" },
|
|
305
|
+
disabled: {
|
|
306
|
+
type: Boolean,
|
|
307
|
+
default: false
|
|
308
|
+
},
|
|
309
|
+
destructive: {
|
|
310
|
+
type: Boolean,
|
|
311
|
+
default: false
|
|
312
|
+
},
|
|
313
|
+
closeOnSelect: {
|
|
314
|
+
type: Boolean,
|
|
315
|
+
default: false
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
emits: ["select", "update:modelValue"],
|
|
319
|
+
setup(__props, { emit: __emit }) {
|
|
320
|
+
const props = __props;
|
|
321
|
+
const emit = __emit;
|
|
322
|
+
const attrs = useAttrs();
|
|
323
|
+
const uncontrolled = ref(props.defaultValue);
|
|
324
|
+
const value = computed(() => props.modelValue ?? uncontrolled.value);
|
|
325
|
+
const checked = computed(() => value.value === "indeterminate" ? "mixed" : value.value);
|
|
326
|
+
const state = computed(() => value.value === "indeterminate" ? "indeterminate" : value.value ? "checked" : "unchecked");
|
|
327
|
+
function toggleChecked() {
|
|
328
|
+
const nextValue = value.value === "indeterminate" ? true : !value.value;
|
|
329
|
+
if (props.modelValue === void 0) uncontrolled.value = nextValue;
|
|
330
|
+
emit("update:modelValue", nextValue);
|
|
331
|
+
}
|
|
332
|
+
provide(checkedKey, {
|
|
333
|
+
state,
|
|
334
|
+
checked: computed(() => value.value !== false)
|
|
335
|
+
});
|
|
336
|
+
const { id, isDisabled, focused, activate, select, setElement, onPointerenter } = usePrimitiveItem("RpDropdownMenuCheckboxItem", props, (event) => emit("select", event), {
|
|
337
|
+
checked,
|
|
338
|
+
defaultCloseOnSelect: false,
|
|
339
|
+
afterSelect: toggleChecked
|
|
340
|
+
});
|
|
341
|
+
function onClick(event) {
|
|
342
|
+
if (!event.defaultPrevented) activate(event);
|
|
343
|
+
}
|
|
344
|
+
const rootAttrs = computed(() => mergeProps(attrs, {
|
|
345
|
+
id: id.value,
|
|
346
|
+
type: props.as === "button" ? "button" : void 0,
|
|
347
|
+
role: "menuitemcheckbox",
|
|
348
|
+
tabindex: -1,
|
|
349
|
+
disabled: props.as === "button" ? optionalAttr(isDisabled.value) : void 0,
|
|
350
|
+
"aria-disabled": optionalAttr(isDisabled.value),
|
|
351
|
+
"aria-checked": checked.value,
|
|
352
|
+
"data-disabled": optionalAttr(isDisabled.value),
|
|
353
|
+
"data-focused": optionalAttr(focused.value),
|
|
354
|
+
"data-highlighted": optionalAttr(focused.value),
|
|
355
|
+
"data-state": state.value,
|
|
356
|
+
class: bem("rp-dropdown-menu__item", {
|
|
357
|
+
focused: focused.value,
|
|
358
|
+
disabled: isDisabled.value,
|
|
359
|
+
destructive: props.destructive
|
|
360
|
+
}),
|
|
361
|
+
onClick,
|
|
362
|
+
onMouseenter: onPointerenter
|
|
363
|
+
}));
|
|
364
|
+
const n1 = createDynamicComponent(() => __props.as, { $: [() => rootAttrs.value] }, extend(() => {
|
|
365
|
+
return createSlot("default", {
|
|
366
|
+
focused: () => unref(focused),
|
|
367
|
+
disabled: () => unref(isDisabled),
|
|
368
|
+
select: () => unref(select)
|
|
369
|
+
});
|
|
370
|
+
}, { _: 8 }), 1);
|
|
371
|
+
setTemplateRefBinding(n1, () => setElement, void 0, void 0, "setElement");
|
|
372
|
+
return n1;
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
//#endregion
|
|
376
|
+
//#region src/components/dropdown-menu/dropdown-menu-outside.ts
|
|
377
|
+
function isNode(value) {
|
|
378
|
+
return typeof value === "object" && value !== null && "nodeType" in value;
|
|
379
|
+
}
|
|
380
|
+
function isEventWithinElement(event, element) {
|
|
381
|
+
const path = event.composedPath();
|
|
382
|
+
if (path.length > 0) return path.some((entry) => entry === element || isNode(entry) && element.contains(entry));
|
|
383
|
+
return isNode(event.target) && element.contains(event.target);
|
|
384
|
+
}
|
|
385
|
+
function isEventWithinTargets(event, targets) {
|
|
386
|
+
for (const source of targets) {
|
|
387
|
+
const target = isRef(source) ? source.value : source;
|
|
388
|
+
if (!target) continue;
|
|
389
|
+
if (typeof target === "string") {
|
|
390
|
+
if (typeof document === "undefined") continue;
|
|
391
|
+
try {
|
|
392
|
+
if ([...document.querySelectorAll(target)].some((element) => isEventWithinElement(event, element))) return true;
|
|
393
|
+
} catch {}
|
|
394
|
+
continue;
|
|
395
|
+
}
|
|
396
|
+
if (isEventWithinElement(event, target)) return true;
|
|
397
|
+
}
|
|
398
|
+
return false;
|
|
399
|
+
}
|
|
400
|
+
//#endregion
|
|
401
|
+
//#region src/components/dropdown-menu/useDropdownMenuPrimitiveContent.ts
|
|
402
|
+
function useDropdownMenuPrimitiveContent(props, attrs, events, submenu) {
|
|
403
|
+
const componentName = submenu ? "RpDropdownMenuSubContent" : "RpDropdownMenuContent";
|
|
404
|
+
const root = useRequiredInject(rootKey, componentName);
|
|
405
|
+
const sub = submenu ? useRequiredInject(subKey, componentName) : void 0;
|
|
406
|
+
const generatedId = useId();
|
|
407
|
+
const id = computed(() => props.id ?? `${generatedId}-${submenu ? "submenu" : "menu"}`);
|
|
408
|
+
const element = ref(null);
|
|
409
|
+
const arrowElement = ref(null);
|
|
410
|
+
const defaultPlacement = submenu ? "right-start" : "bottom-start";
|
|
411
|
+
const actualPlacement = ref(props.placement ?? defaultPlacement);
|
|
412
|
+
const isOpen = computed(() => sub ? sub.isOpen.value : root.isOpen.value);
|
|
413
|
+
const reference = computed(() => sub ? sub.trigger.value : root.reference.value);
|
|
414
|
+
const teleportPositioningKey = useTeleportPositioningKey();
|
|
415
|
+
const menu = createMenuContext({
|
|
416
|
+
root,
|
|
417
|
+
element,
|
|
418
|
+
actualPlacement,
|
|
419
|
+
parentSub: sub,
|
|
420
|
+
onEscape(event) {
|
|
421
|
+
const customEvent = createCustomEvent("dropdown-menu-escape-key-down", { originalEvent: event }, event);
|
|
422
|
+
events.escapeKeyDown(customEvent);
|
|
423
|
+
if (customEvent.defaultPrevented) return;
|
|
424
|
+
if (sub) sub.close(true);
|
|
425
|
+
else root.close({ returnFocus: true });
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
const floating = useFloatingPosition({
|
|
429
|
+
reference,
|
|
430
|
+
floating: element,
|
|
431
|
+
arrow: arrowElement,
|
|
432
|
+
open: isOpen,
|
|
433
|
+
placement: () => props.placement ?? defaultPlacement,
|
|
434
|
+
strategy: () => props.strategy ?? "absolute",
|
|
435
|
+
offset: () => props.offset,
|
|
436
|
+
flip: () => props.avoidCollisions !== false && props.flip !== false,
|
|
437
|
+
shift: () => props.avoidCollisions !== false && props.shift !== false,
|
|
438
|
+
collisionPadding: () => props.collisionPadding ?? 8,
|
|
439
|
+
restartKey: teleportPositioningKey
|
|
440
|
+
});
|
|
441
|
+
watch(floating.actualPlacement, (value) => {
|
|
442
|
+
actualPlacement.value = value;
|
|
443
|
+
}, { immediate: true });
|
|
444
|
+
const shouldRender = computed(() => props.forceMount === true || isOpen.value);
|
|
445
|
+
let layerBranchCleanup;
|
|
446
|
+
provide(menuKey, menu);
|
|
447
|
+
if (sub) sub.menu = menu;
|
|
448
|
+
function setElement(value) {
|
|
449
|
+
resolveHTMLElementRef(value, id.value, (resolved) => {
|
|
450
|
+
const previous = element.value;
|
|
451
|
+
if (previous) root.unregisterInside(previous);
|
|
452
|
+
layerBranchCleanup?.();
|
|
453
|
+
layerBranchCleanup = void 0;
|
|
454
|
+
element.value = resolved;
|
|
455
|
+
if (resolved) root.registerInside(resolved);
|
|
456
|
+
if (!sub) root.layer.element.value = resolved;
|
|
457
|
+
else if (resolved) layerBranchCleanup = root.layer.registerBranch(resolved);
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
function emitOutside(type, originalEvent) {
|
|
461
|
+
const outsideEvent = createOutsideEvent(originalEvent);
|
|
462
|
+
if (type === "pointer") events.pointerDownOutside(outsideEvent);
|
|
463
|
+
else events.focusOutside(outsideEvent);
|
|
464
|
+
events.interactOutside(outsideEvent);
|
|
465
|
+
return outsideEvent;
|
|
466
|
+
}
|
|
467
|
+
function onDocumentPointer(event) {
|
|
468
|
+
if (!root.layer.isTopLayer() || root.isInside(event) || isEventWithinTargets(event, props.ignore ?? [])) return;
|
|
469
|
+
const outsideEvent = emitOutside("pointer", event);
|
|
470
|
+
if (root.modal.value) {
|
|
471
|
+
if (event.cancelable) event.preventDefault();
|
|
472
|
+
event.stopPropagation();
|
|
473
|
+
if (event.type === "pointerdown") blockNextDocumentClick();
|
|
474
|
+
}
|
|
475
|
+
if (!outsideEvent.defaultPrevented) root.close({ returnFocus: root.modal.value });
|
|
476
|
+
}
|
|
477
|
+
function onDocumentFocus(event) {
|
|
478
|
+
if (!root.layer.isTopLayer() || root.isInside(event) || isEventWithinTargets(event, props.ignore ?? [])) return;
|
|
479
|
+
const outsideEvent = emitOutside("focus", event);
|
|
480
|
+
if (root.modal.value) {
|
|
481
|
+
if (event.cancelable) event.preventDefault();
|
|
482
|
+
event.stopPropagation();
|
|
483
|
+
}
|
|
484
|
+
if (!outsideEvent.defaultPrevented) root.close({ returnFocus: root.modal.value });
|
|
485
|
+
else if (root.modal.value) nextTick(menu.focusElement);
|
|
486
|
+
}
|
|
487
|
+
function setDocumentListeners(active) {
|
|
488
|
+
if (submenu || typeof document === "undefined") return;
|
|
489
|
+
const method = active ? "addEventListener" : "removeEventListener";
|
|
490
|
+
document[method]("pointerdown", onDocumentPointer, true);
|
|
491
|
+
document[method]("focusin", onDocumentFocus, true);
|
|
492
|
+
}
|
|
493
|
+
watch(isOpen, (open) => {
|
|
494
|
+
setDocumentListeners(open);
|
|
495
|
+
if (!open) {
|
|
496
|
+
menu.activeId.value = null;
|
|
497
|
+
menu.closeSubmenus();
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
nextTick(() => {
|
|
501
|
+
const focus = sub ? sub.pendingFocus.value : root.pendingFocus.value;
|
|
502
|
+
menu.focus(focus || "first");
|
|
503
|
+
});
|
|
504
|
+
}, {
|
|
505
|
+
flush: "post",
|
|
506
|
+
immediate: true
|
|
507
|
+
});
|
|
508
|
+
onMounted(() => {
|
|
509
|
+
if (sub) sub.contentId.value = id.value;
|
|
510
|
+
else root.contentId.value = id.value;
|
|
511
|
+
if (isOpen.value) menu.focus((sub ? sub.pendingFocus.value : root.pendingFocus.value) || "first");
|
|
512
|
+
});
|
|
513
|
+
onBeforeUnmount(() => {
|
|
514
|
+
setDocumentListeners(false);
|
|
515
|
+
layerBranchCleanup?.();
|
|
516
|
+
if (element.value) root.unregisterInside(element.value);
|
|
517
|
+
if (!sub && root.layer.element.value === element.value) root.layer.element.value = null;
|
|
518
|
+
if (sub) sub.menu = null;
|
|
519
|
+
else if (root.contentId.value === id.value) root.contentId.value = void 0;
|
|
520
|
+
});
|
|
521
|
+
const placementSide = computed(() => floating.actualPlacement.value.split("-")[0]);
|
|
522
|
+
const placementAlign = computed(() => floating.actualPlacement.value.split("-")[1] ?? "center");
|
|
523
|
+
const rootAttrs = computed(() => mergeProps(attrs, {
|
|
524
|
+
id: id.value,
|
|
525
|
+
role: "menu",
|
|
526
|
+
tabindex: -1,
|
|
527
|
+
hidden: optionalAttr(!isOpen.value),
|
|
528
|
+
class: submenu ? bem("rp-dropdown-menu__submenu", {
|
|
529
|
+
compound: true,
|
|
530
|
+
open: isOpen.value
|
|
531
|
+
}) : bem("rp-dropdown-menu__content", {
|
|
532
|
+
compound: true,
|
|
533
|
+
open: isOpen.value
|
|
534
|
+
}),
|
|
535
|
+
style: [
|
|
536
|
+
floating.floatingStyle.value,
|
|
537
|
+
{ zIndex: root.layer.zIndex.value },
|
|
538
|
+
!isOpen.value ? { display: "none" } : void 0
|
|
539
|
+
],
|
|
540
|
+
"aria-label": props.ariaLabel,
|
|
541
|
+
"aria-labelledby": props.ariaLabelledby ?? (submenu ? void 0 : root.triggerId.value),
|
|
542
|
+
"aria-describedby": props.ariaDescribedby,
|
|
543
|
+
"aria-activedescendant": menu.activeId.value ?? void 0,
|
|
544
|
+
"data-state": isOpen.value ? "open" : "closed",
|
|
545
|
+
"data-placement": floating.actualPlacement.value,
|
|
546
|
+
"data-side": placementSide.value,
|
|
547
|
+
"data-align": placementAlign.value,
|
|
548
|
+
onKeydown: menu.onKeydown
|
|
549
|
+
}));
|
|
550
|
+
function close() {
|
|
551
|
+
if (sub) sub.close(true);
|
|
552
|
+
else root.close({ returnFocus: true });
|
|
553
|
+
}
|
|
554
|
+
return {
|
|
555
|
+
id,
|
|
556
|
+
element,
|
|
557
|
+
arrowElement,
|
|
558
|
+
actualPlacement,
|
|
559
|
+
isOpen,
|
|
560
|
+
shouldRender,
|
|
561
|
+
placementSide,
|
|
562
|
+
rootAttrs,
|
|
563
|
+
floating,
|
|
564
|
+
setElement,
|
|
565
|
+
close
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
//#endregion
|
|
569
|
+
//#region src/components/dropdown-menu/dropdown-menu-content.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
570
|
+
var t0$3 = template("<span class=rp-dropdown-menu__arrow aria-hidden=true>");
|
|
571
|
+
//#endregion
|
|
572
|
+
//#region src/components/dropdown-menu/dropdown-menu-content.vue
|
|
573
|
+
var dropdown_menu_content_default = /* @__PURE__ */ defineVaporComponent({
|
|
574
|
+
name: "RpDropdownMenuContent",
|
|
575
|
+
inheritAttrs: false,
|
|
576
|
+
__name: "dropdown-menu-content",
|
|
577
|
+
props: {
|
|
578
|
+
id: {},
|
|
579
|
+
as: { default: "div" },
|
|
580
|
+
placement: { default: "bottom-start" },
|
|
581
|
+
offset: {},
|
|
582
|
+
strategy: { default: "absolute" },
|
|
583
|
+
flip: {
|
|
584
|
+
type: Boolean,
|
|
585
|
+
default: true
|
|
586
|
+
},
|
|
587
|
+
shift: {
|
|
588
|
+
type: Boolean,
|
|
589
|
+
default: true
|
|
590
|
+
},
|
|
591
|
+
collisionPadding: { default: 8 },
|
|
592
|
+
arrow: {
|
|
593
|
+
type: Boolean,
|
|
594
|
+
default: false
|
|
595
|
+
},
|
|
596
|
+
avoidCollisions: {
|
|
597
|
+
type: Boolean,
|
|
598
|
+
default: true
|
|
599
|
+
},
|
|
600
|
+
forceMount: {
|
|
601
|
+
type: Boolean,
|
|
602
|
+
default: false
|
|
603
|
+
},
|
|
604
|
+
ignore: {},
|
|
605
|
+
ariaLabel: {},
|
|
606
|
+
ariaLabelledby: {},
|
|
607
|
+
ariaDescribedby: {}
|
|
608
|
+
},
|
|
609
|
+
emits: [
|
|
610
|
+
"escapeKeyDown",
|
|
611
|
+
"pointerDownOutside",
|
|
612
|
+
"focusOutside",
|
|
613
|
+
"interactOutside"
|
|
614
|
+
],
|
|
615
|
+
setup(__props, { emit: __emit }) {
|
|
616
|
+
const props = __props;
|
|
617
|
+
const emit = __emit;
|
|
618
|
+
const { arrowElement, actualPlacement, isOpen, shouldRender, placementSide, rootAttrs, floating, setElement, close } = useDropdownMenuPrimitiveContent(props, useAttrs(), {
|
|
619
|
+
escapeKeyDown: (event) => emit("escapeKeyDown", event),
|
|
620
|
+
pointerDownOutside: (event) => emit("pointerDownOutside", event),
|
|
621
|
+
focusOutside: (event) => emit("focusOutside", event),
|
|
622
|
+
interactOutside: (event) => emit("interactOutside", event)
|
|
623
|
+
}, false);
|
|
624
|
+
const _setTemplateRef = createTemplateRefSetter();
|
|
625
|
+
return createIf(() => unref(shouldRender), () => {
|
|
626
|
+
const n6 = createDynamicComponent(() => __props.as, { $: [() => unref(rootAttrs)] }, extend(() => {
|
|
627
|
+
return [createIf(() => __props.arrow, () => {
|
|
628
|
+
const n4 = t0$3();
|
|
629
|
+
_setTemplateRef(n4, arrowElement, null, "arrowElement");
|
|
630
|
+
renderEffect(() => {
|
|
631
|
+
setAttr(n4, "data-side", unref(placementSide));
|
|
632
|
+
setStyle(n4, unref(floating).arrowStyle.value);
|
|
633
|
+
});
|
|
634
|
+
return n4;
|
|
635
|
+
}, null, 129), createSlot("default", {
|
|
636
|
+
isOpen: () => unref(isOpen),
|
|
637
|
+
placement: () => unref(actualPlacement),
|
|
638
|
+
close: () => unref(close)
|
|
639
|
+
})];
|
|
640
|
+
}, { _: 8 }), 1);
|
|
641
|
+
setTemplateRefBinding(n6, () => setElement, void 0, void 0, "setElement");
|
|
642
|
+
return n6;
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
});
|
|
646
|
+
//#endregion
|
|
647
|
+
//#region src/components/dropdown-menu/dropdown-menu-context-trigger.vue
|
|
648
|
+
var dropdown_menu_context_trigger_default = /* @__PURE__ */ defineVaporComponent({
|
|
649
|
+
name: "RpDropdownMenuContextTrigger",
|
|
650
|
+
inheritAttrs: false,
|
|
651
|
+
__name: "dropdown-menu-context-trigger",
|
|
652
|
+
props: {
|
|
653
|
+
id: {},
|
|
654
|
+
as: { default: "span" },
|
|
655
|
+
disabled: {
|
|
656
|
+
type: Boolean,
|
|
657
|
+
default: false
|
|
658
|
+
},
|
|
659
|
+
longPressDelay: { default: 700 },
|
|
660
|
+
longPressTolerance: { default: 10 }
|
|
661
|
+
},
|
|
662
|
+
setup(__props) {
|
|
663
|
+
const props = __props;
|
|
664
|
+
const attrs = useAttrs();
|
|
665
|
+
const root = useRequiredInject(rootKey, "RpDropdownMenuContextTrigger");
|
|
666
|
+
const generatedId = useId();
|
|
667
|
+
const id = computed(() => props.id ?? `${generatedId}-context-trigger`);
|
|
668
|
+
const element = ref(null);
|
|
669
|
+
const isDisabled = computed(() => root.disabled.value || props.disabled);
|
|
670
|
+
let timer;
|
|
671
|
+
let pointerId;
|
|
672
|
+
let startPoint;
|
|
673
|
+
let longPressOpened = false;
|
|
674
|
+
let suppressUntil = 0;
|
|
675
|
+
function setElement(value) {
|
|
676
|
+
resolveHTMLElementRef(value, id.value, (resolved) => {
|
|
677
|
+
const previous = element.value;
|
|
678
|
+
if (previous) root.unregisterInside(previous);
|
|
679
|
+
element.value = resolved;
|
|
680
|
+
if (resolved) root.registerInside(resolved);
|
|
681
|
+
if (!root.triggerId.value) root.triggerId.value = id.value;
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
function clearLongPress() {
|
|
685
|
+
if (timer) clearTimeout(timer);
|
|
686
|
+
timer = void 0;
|
|
687
|
+
pointerId = void 0;
|
|
688
|
+
startPoint = void 0;
|
|
689
|
+
element.value?.ownerDocument.defaultView?.removeEventListener("scroll", clearLongPress, true);
|
|
690
|
+
}
|
|
691
|
+
function openAt(point) {
|
|
692
|
+
root.setReturnFocus(element.value);
|
|
693
|
+
root.openAt(point);
|
|
694
|
+
}
|
|
695
|
+
function onContextmenu(event) {
|
|
696
|
+
if (isDisabled.value) return;
|
|
697
|
+
event.preventDefault();
|
|
698
|
+
if (Date.now() < suppressUntil) return;
|
|
699
|
+
openAt({
|
|
700
|
+
x: event.clientX,
|
|
701
|
+
y: event.clientY
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
function onKeydown(event) {
|
|
705
|
+
if (isDisabled.value) return;
|
|
706
|
+
if (event.key !== "ContextMenu" && !(event.shiftKey && event.key === "F10")) return;
|
|
707
|
+
event.preventDefault();
|
|
708
|
+
const rect = element.value?.getBoundingClientRect();
|
|
709
|
+
openAt({
|
|
710
|
+
x: rect?.left ?? 0,
|
|
711
|
+
y: rect?.bottom ?? 0
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
function onPointerdown(event) {
|
|
715
|
+
if (isDisabled.value || event.pointerType !== "touch" && event.pointerType !== "pen") return;
|
|
716
|
+
clearLongPress();
|
|
717
|
+
pointerId = event.pointerId;
|
|
718
|
+
startPoint = {
|
|
719
|
+
x: event.clientX,
|
|
720
|
+
y: event.clientY
|
|
721
|
+
};
|
|
722
|
+
longPressOpened = false;
|
|
723
|
+
(element.value?.ownerDocument.defaultView)?.addEventListener("scroll", clearLongPress, true);
|
|
724
|
+
timer = setTimeout(() => {
|
|
725
|
+
if (!startPoint) return;
|
|
726
|
+
longPressOpened = true;
|
|
727
|
+
suppressUntil = Date.now() + 1e3;
|
|
728
|
+
openAt(startPoint);
|
|
729
|
+
timer = void 0;
|
|
730
|
+
}, props.longPressDelay);
|
|
731
|
+
}
|
|
732
|
+
function onPointermove(event) {
|
|
733
|
+
if (event.pointerId !== pointerId || !startPoint) return;
|
|
734
|
+
if (Math.hypot(event.clientX - startPoint.x, event.clientY - startPoint.y) > props.longPressTolerance) clearLongPress();
|
|
735
|
+
}
|
|
736
|
+
function finishPointer(event) {
|
|
737
|
+
if (event.pointerId !== pointerId) return;
|
|
738
|
+
if (longPressOpened) event.preventDefault();
|
|
739
|
+
clearLongPress();
|
|
740
|
+
}
|
|
741
|
+
function onClick(event) {
|
|
742
|
+
if (Date.now() >= suppressUntil) return;
|
|
743
|
+
event.preventDefault();
|
|
744
|
+
event.stopPropagation();
|
|
745
|
+
}
|
|
746
|
+
const rootAttrs = computed(() => mergeProps(attrs, {
|
|
747
|
+
id: id.value,
|
|
748
|
+
"aria-controls": root.contentId.value,
|
|
749
|
+
"aria-expanded": root.isOpen.value,
|
|
750
|
+
"aria-haspopup": "menu",
|
|
751
|
+
"aria-disabled": optionalAttr(isDisabled.value),
|
|
752
|
+
"data-state": root.isOpen.value ? "open" : "closed",
|
|
753
|
+
"data-disabled": optionalAttr(isDisabled.value),
|
|
754
|
+
onClick,
|
|
755
|
+
onContextmenu,
|
|
756
|
+
onKeydown,
|
|
757
|
+
onPointerdown,
|
|
758
|
+
onPointermove,
|
|
759
|
+
onPointerup: finishPointer,
|
|
760
|
+
onPointercancel: finishPointer
|
|
761
|
+
}));
|
|
762
|
+
onBeforeUnmount(() => {
|
|
763
|
+
clearLongPress();
|
|
764
|
+
if (element.value) root.unregisterInside(element.value);
|
|
765
|
+
if (root.triggerId.value === id.value) root.triggerId.value = void 0;
|
|
766
|
+
});
|
|
767
|
+
const n1 = createDynamicComponent(() => __props.as, { $: [() => rootAttrs.value] }, extend(() => {
|
|
768
|
+
return createSlot("default", { isOpen: () => unref(root).isOpen.value });
|
|
769
|
+
}, { _: 8 }), 1);
|
|
770
|
+
setTemplateRefBinding(n1, () => setElement);
|
|
771
|
+
return n1;
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
//#endregion
|
|
775
|
+
//#region src/components/dropdown-menu/dropdown-menu-item.vue
|
|
776
|
+
var dropdown_menu_item_default = /* @__PURE__ */ defineVaporComponent({
|
|
777
|
+
name: "RpDropdownMenuItem",
|
|
778
|
+
inheritAttrs: false,
|
|
779
|
+
__name: "dropdown-menu-item",
|
|
780
|
+
props: {
|
|
781
|
+
id: {},
|
|
782
|
+
as: { default: "button" },
|
|
783
|
+
value: {},
|
|
784
|
+
disabled: {
|
|
785
|
+
type: Boolean,
|
|
786
|
+
default: false
|
|
787
|
+
},
|
|
788
|
+
destructive: {
|
|
789
|
+
type: Boolean,
|
|
790
|
+
default: false
|
|
791
|
+
},
|
|
792
|
+
closeOnSelect: {
|
|
793
|
+
type: Boolean,
|
|
794
|
+
default: true
|
|
795
|
+
}
|
|
796
|
+
},
|
|
797
|
+
emits: ["select"],
|
|
798
|
+
setup(__props, { emit: __emit }) {
|
|
799
|
+
const props = __props;
|
|
800
|
+
const emit = __emit;
|
|
801
|
+
const attrs = useAttrs();
|
|
802
|
+
const { id, isDisabled, focused, activate, select, setElement, onPointerenter } = usePrimitiveItem("RpDropdownMenuItem", props, (event) => emit("select", event), { defaultCloseOnSelect: true });
|
|
803
|
+
function onClick(event) {
|
|
804
|
+
if (!event.defaultPrevented) activate(event);
|
|
805
|
+
}
|
|
806
|
+
const rootAttrs = computed(() => mergeProps(attrs, {
|
|
807
|
+
id: id.value,
|
|
808
|
+
type: props.as === "button" ? "button" : void 0,
|
|
809
|
+
role: "menuitem",
|
|
810
|
+
tabindex: -1,
|
|
811
|
+
disabled: props.as === "button" ? optionalAttr(isDisabled.value) : void 0,
|
|
812
|
+
"aria-disabled": optionalAttr(isDisabled.value),
|
|
813
|
+
"data-disabled": optionalAttr(isDisabled.value),
|
|
814
|
+
"data-focused": optionalAttr(focused.value),
|
|
815
|
+
"data-highlighted": optionalAttr(focused.value),
|
|
816
|
+
class: bem("rp-dropdown-menu__item", {
|
|
817
|
+
focused: focused.value,
|
|
818
|
+
disabled: isDisabled.value,
|
|
819
|
+
destructive: props.destructive
|
|
820
|
+
}),
|
|
821
|
+
onClick,
|
|
822
|
+
onMouseenter: onPointerenter
|
|
823
|
+
}));
|
|
824
|
+
const n1 = createDynamicComponent(() => __props.as, { $: [() => rootAttrs.value] }, extend(() => {
|
|
825
|
+
return createSlot("default", {
|
|
826
|
+
focused: () => unref(focused),
|
|
827
|
+
disabled: () => unref(isDisabled),
|
|
828
|
+
select: () => unref(select)
|
|
829
|
+
});
|
|
830
|
+
}, { _: 8 }), 1);
|
|
831
|
+
setTemplateRefBinding(n1, () => setElement, void 0, void 0, "setElement");
|
|
832
|
+
return n1;
|
|
833
|
+
}
|
|
834
|
+
});
|
|
835
|
+
//#endregion
|
|
836
|
+
//#region src/components/dropdown-menu/dropdown-menu-item-indicator.vue
|
|
837
|
+
var dropdown_menu_item_indicator_default = /* @__PURE__ */ defineVaporComponent({
|
|
838
|
+
name: "RpDropdownMenuItemIndicator",
|
|
839
|
+
inheritAttrs: false,
|
|
840
|
+
__name: "dropdown-menu-item-indicator",
|
|
841
|
+
props: {
|
|
842
|
+
as: { default: "span" },
|
|
843
|
+
forceMount: {
|
|
844
|
+
type: Boolean,
|
|
845
|
+
default: false
|
|
846
|
+
}
|
|
847
|
+
},
|
|
848
|
+
setup(__props) {
|
|
849
|
+
const attrs = useAttrs();
|
|
850
|
+
const context = useRequiredInject(checkedKey, "RpDropdownMenuItemIndicator");
|
|
851
|
+
const rootAttrs = computed(() => mergeProps(attrs, {
|
|
852
|
+
class: "rp-dropdown-menu__indicator",
|
|
853
|
+
"data-state": context.state.value,
|
|
854
|
+
"aria-hidden": true
|
|
855
|
+
}));
|
|
856
|
+
return createIf(() => __props.forceMount || unref(context).checked.value, () => {
|
|
857
|
+
return createDynamicComponent(() => __props.as, { $: [() => rootAttrs.value] }, extend(() => {
|
|
858
|
+
return createSlot("default", {
|
|
859
|
+
state: () => unref(context).state.value,
|
|
860
|
+
checked: () => unref(context).checked.value
|
|
861
|
+
});
|
|
862
|
+
}, { _: 8 }), 1);
|
|
863
|
+
});
|
|
864
|
+
}
|
|
865
|
+
});
|
|
866
|
+
//#endregion
|
|
867
|
+
//#region src/components/dropdown-menu/dropdown-menu-label.vue
|
|
868
|
+
var dropdown_menu_label_default = /* @__PURE__ */ defineVaporComponent({
|
|
869
|
+
name: "RpDropdownMenuLabel",
|
|
870
|
+
inheritAttrs: false,
|
|
871
|
+
__name: "dropdown-menu-label",
|
|
872
|
+
props: {
|
|
873
|
+
id: {},
|
|
874
|
+
as: { default: "div" }
|
|
875
|
+
},
|
|
876
|
+
setup(__props) {
|
|
877
|
+
const props = __props;
|
|
878
|
+
const attrs = useAttrs();
|
|
879
|
+
useRequiredInject(menuKey, "RpDropdownMenuLabel");
|
|
880
|
+
const rootAttrs = computed(() => mergeProps(attrs, {
|
|
881
|
+
id: props.id,
|
|
882
|
+
role: "presentation",
|
|
883
|
+
class: "rp-dropdown-menu__group-label"
|
|
884
|
+
}));
|
|
885
|
+
return createDynamicComponent(() => __props.as, { $: [() => rootAttrs.value] }, extend(() => {
|
|
886
|
+
return createSlot();
|
|
887
|
+
}, { _: 8 }), 1);
|
|
888
|
+
}
|
|
889
|
+
});
|
|
890
|
+
//#endregion
|
|
891
|
+
//#region src/components/dropdown-menu/dropdown-menu-portal.vue
|
|
892
|
+
var dropdown_menu_portal_default = /* @__PURE__ */ defineVaporComponent({
|
|
893
|
+
name: "RpDropdownMenuPortal",
|
|
894
|
+
__name: "dropdown-menu-portal",
|
|
895
|
+
props: {
|
|
896
|
+
to: { default: void 0 },
|
|
897
|
+
disabled: {
|
|
898
|
+
type: Boolean,
|
|
899
|
+
default: false
|
|
900
|
+
},
|
|
901
|
+
teleport: {
|
|
902
|
+
type: Boolean,
|
|
903
|
+
default: true
|
|
904
|
+
},
|
|
905
|
+
teleportTo: { default: void 0 }
|
|
906
|
+
},
|
|
907
|
+
setup(__props) {
|
|
908
|
+
const props = __props;
|
|
909
|
+
const teleportTo = provideTeleportTarget({ get teleportTo() {
|
|
910
|
+
return props.to ?? props.teleportTo;
|
|
911
|
+
} }, () => Boolean(props.teleport && !props.disabled));
|
|
912
|
+
return createComponent(VaporTeleport, {
|
|
913
|
+
to: () => unref(teleportTo),
|
|
914
|
+
disabled: () => __props.disabled || !__props.teleport
|
|
915
|
+
}, extend(() => {
|
|
916
|
+
return createSlot();
|
|
917
|
+
}, { _: 8 }), true);
|
|
918
|
+
}
|
|
919
|
+
});
|
|
920
|
+
//#endregion
|
|
921
|
+
//#region src/components/dropdown-menu/dropdown-menu-radio-group.vue
|
|
922
|
+
var dropdown_menu_radio_group_default = /* @__PURE__ */ defineVaporComponent({
|
|
923
|
+
name: "RpDropdownMenuRadioGroup",
|
|
924
|
+
inheritAttrs: false,
|
|
925
|
+
__name: "dropdown-menu-radio-group",
|
|
926
|
+
props: {
|
|
927
|
+
id: {},
|
|
928
|
+
as: { default: "div" },
|
|
929
|
+
modelValue: { default: void 0 },
|
|
930
|
+
defaultValue: { default: null },
|
|
931
|
+
ariaLabel: {},
|
|
932
|
+
ariaLabelledby: {}
|
|
933
|
+
},
|
|
934
|
+
emits: ["update:modelValue"],
|
|
935
|
+
setup(__props, { emit: __emit }) {
|
|
936
|
+
const props = __props;
|
|
937
|
+
const emit = __emit;
|
|
938
|
+
const attrs = useAttrs();
|
|
939
|
+
useRequiredInject(menuKey, "RpDropdownMenuRadioGroup");
|
|
940
|
+
const uncontrolled = ref(props.defaultValue);
|
|
941
|
+
const value = computed(() => props.modelValue === void 0 ? uncontrolled.value : props.modelValue);
|
|
942
|
+
function select(nextValue) {
|
|
943
|
+
if (value.value === nextValue) return;
|
|
944
|
+
if (props.modelValue === void 0) uncontrolled.value = nextValue;
|
|
945
|
+
emit("update:modelValue", nextValue);
|
|
946
|
+
}
|
|
947
|
+
provide(radioGroupKey, {
|
|
948
|
+
value,
|
|
949
|
+
select
|
|
950
|
+
});
|
|
951
|
+
const rootAttrs = computed(() => mergeProps(attrs, {
|
|
952
|
+
id: props.id,
|
|
953
|
+
role: "group",
|
|
954
|
+
class: "rp-dropdown-menu__radio-group",
|
|
955
|
+
"aria-label": props.ariaLabel,
|
|
956
|
+
"aria-labelledby": props.ariaLabelledby
|
|
957
|
+
}));
|
|
958
|
+
return createDynamicComponent(() => __props.as, { $: [() => rootAttrs.value] }, extend(() => {
|
|
959
|
+
return createSlot("default", { value: () => value.value });
|
|
960
|
+
}, { _: 8 }), 1);
|
|
961
|
+
}
|
|
962
|
+
});
|
|
963
|
+
//#endregion
|
|
964
|
+
//#region src/components/dropdown-menu/dropdown-menu-radio-item.vue
|
|
965
|
+
var dropdown_menu_radio_item_default = /* @__PURE__ */ defineVaporComponent({
|
|
966
|
+
name: "RpDropdownMenuRadioItem",
|
|
967
|
+
inheritAttrs: false,
|
|
968
|
+
__name: "dropdown-menu-radio-item",
|
|
969
|
+
props: {
|
|
970
|
+
value: {},
|
|
971
|
+
id: {},
|
|
972
|
+
as: { default: "button" },
|
|
973
|
+
disabled: {
|
|
974
|
+
type: Boolean,
|
|
975
|
+
default: false
|
|
976
|
+
},
|
|
977
|
+
destructive: {
|
|
978
|
+
type: Boolean,
|
|
979
|
+
default: false
|
|
980
|
+
},
|
|
981
|
+
closeOnSelect: {
|
|
982
|
+
type: Boolean,
|
|
983
|
+
default: false
|
|
984
|
+
}
|
|
985
|
+
},
|
|
986
|
+
emits: ["select"],
|
|
987
|
+
setup(__props, { emit: __emit }) {
|
|
988
|
+
const props = __props;
|
|
989
|
+
const emit = __emit;
|
|
990
|
+
const attrs = useAttrs();
|
|
991
|
+
const group = useRequiredInject(radioGroupKey, "RpDropdownMenuRadioItem");
|
|
992
|
+
const isChecked = computed(() => group.value.value === props.value);
|
|
993
|
+
const checked = computed(() => isChecked.value);
|
|
994
|
+
const state = computed(() => isChecked.value ? "checked" : "unchecked");
|
|
995
|
+
provide(checkedKey, {
|
|
996
|
+
state,
|
|
997
|
+
checked: isChecked
|
|
998
|
+
});
|
|
999
|
+
const { id, isDisabled, focused, activate, select, setElement, onPointerenter } = usePrimitiveItem("RpDropdownMenuRadioItem", props, (event) => emit("select", event), {
|
|
1000
|
+
checked,
|
|
1001
|
+
defaultCloseOnSelect: false,
|
|
1002
|
+
afterSelect: () => group.select(props.value)
|
|
1003
|
+
});
|
|
1004
|
+
function onClick(event) {
|
|
1005
|
+
if (!event.defaultPrevented) activate(event);
|
|
1006
|
+
}
|
|
1007
|
+
const rootAttrs = computed(() => mergeProps(attrs, {
|
|
1008
|
+
id: id.value,
|
|
1009
|
+
type: props.as === "button" ? "button" : void 0,
|
|
1010
|
+
role: "menuitemradio",
|
|
1011
|
+
tabindex: -1,
|
|
1012
|
+
disabled: props.as === "button" ? optionalAttr(isDisabled.value) : void 0,
|
|
1013
|
+
"aria-disabled": optionalAttr(isDisabled.value),
|
|
1014
|
+
"aria-checked": checked.value,
|
|
1015
|
+
"data-disabled": optionalAttr(isDisabled.value),
|
|
1016
|
+
"data-focused": optionalAttr(focused.value),
|
|
1017
|
+
"data-highlighted": optionalAttr(focused.value),
|
|
1018
|
+
"data-state": state.value,
|
|
1019
|
+
class: bem("rp-dropdown-menu__item", {
|
|
1020
|
+
focused: focused.value,
|
|
1021
|
+
disabled: isDisabled.value,
|
|
1022
|
+
destructive: props.destructive
|
|
1023
|
+
}),
|
|
1024
|
+
onClick,
|
|
1025
|
+
onMouseenter: onPointerenter
|
|
1026
|
+
}));
|
|
1027
|
+
const n1 = createDynamicComponent(() => __props.as, { $: [() => rootAttrs.value] }, extend(() => {
|
|
1028
|
+
return createSlot("default", {
|
|
1029
|
+
focused: () => unref(focused),
|
|
1030
|
+
disabled: () => unref(isDisabled),
|
|
1031
|
+
select: () => unref(select)
|
|
1032
|
+
});
|
|
1033
|
+
}, { _: 8 }), 1);
|
|
1034
|
+
setTemplateRefBinding(n1, () => setElement, void 0, void 0, "setElement");
|
|
1035
|
+
return n1;
|
|
1036
|
+
}
|
|
1037
|
+
});
|
|
1038
|
+
//#endregion
|
|
1039
|
+
//#region src/components/dropdown-menu/dropdown-menu-root.vue
|
|
1040
|
+
var dropdown_menu_root_default = /* @__PURE__ */ defineVaporComponent({
|
|
1041
|
+
name: "RpDropdownMenuRoot",
|
|
1042
|
+
__name: "dropdown-menu-root",
|
|
1043
|
+
props: {
|
|
1044
|
+
id: {},
|
|
1045
|
+
open: {
|
|
1046
|
+
type: Boolean,
|
|
1047
|
+
default: void 0
|
|
1048
|
+
},
|
|
1049
|
+
defaultOpen: {
|
|
1050
|
+
type: Boolean,
|
|
1051
|
+
default: false
|
|
1052
|
+
},
|
|
1053
|
+
disabled: {
|
|
1054
|
+
type: Boolean,
|
|
1055
|
+
default: false
|
|
1056
|
+
},
|
|
1057
|
+
modal: {
|
|
1058
|
+
type: Boolean,
|
|
1059
|
+
default: true
|
|
1060
|
+
},
|
|
1061
|
+
target: { default: null },
|
|
1062
|
+
virtualAnchor: { default: null }
|
|
1063
|
+
},
|
|
1064
|
+
emits: ["update:open"],
|
|
1065
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
1066
|
+
const props = __props;
|
|
1067
|
+
const emit = __emit;
|
|
1068
|
+
const generatedId = useId();
|
|
1069
|
+
const id = computed(() => props.id ?? `${generatedId}-dropdown-menu`);
|
|
1070
|
+
const uncontrolledOpen = ref(props.defaultOpen);
|
|
1071
|
+
const isOpen = computed(() => props.open ?? uncontrolledOpen.value);
|
|
1072
|
+
const disabled = computed(() => props.disabled);
|
|
1073
|
+
const modal = computed(() => props.modal);
|
|
1074
|
+
const trigger = ref(null);
|
|
1075
|
+
const triggerId = ref();
|
|
1076
|
+
const contentId = ref();
|
|
1077
|
+
const activeReference = shallowRef(null);
|
|
1078
|
+
const { reference: configuredReference } = useFloatingTarget(() => props.target ?? props.virtualAnchor, trigger);
|
|
1079
|
+
const reference = computed(() => activeReference.value ?? configuredReference.value);
|
|
1080
|
+
const pendingFocus = ref("first");
|
|
1081
|
+
const contentElement = ref(null);
|
|
1082
|
+
const inside = /* @__PURE__ */ new Set();
|
|
1083
|
+
let returnFocusElement = null;
|
|
1084
|
+
const layer = useOverlayLayer({
|
|
1085
|
+
active: computed(() => isOpen.value && !disabled.value),
|
|
1086
|
+
element: contentElement,
|
|
1087
|
+
baseZIndex: 100
|
|
1088
|
+
});
|
|
1089
|
+
function setOpen(value) {
|
|
1090
|
+
if (value && disabled.value) return;
|
|
1091
|
+
const previous = isOpen.value;
|
|
1092
|
+
if (props.open === void 0) uncontrolledOpen.value = value;
|
|
1093
|
+
if (previous !== value) emit("update:open", value);
|
|
1094
|
+
}
|
|
1095
|
+
function rememberFocus() {
|
|
1096
|
+
if (typeof document === "undefined" || returnFocusElement) return;
|
|
1097
|
+
const activeElement = document.activeElement;
|
|
1098
|
+
if (activeElement instanceof HTMLElement) returnFocusElement = activeElement;
|
|
1099
|
+
}
|
|
1100
|
+
function open(options) {
|
|
1101
|
+
if (disabled.value) return;
|
|
1102
|
+
rememberFocus();
|
|
1103
|
+
pendingFocus.value = getFocusTarget(options);
|
|
1104
|
+
setOpen(true);
|
|
1105
|
+
}
|
|
1106
|
+
function focusReturnTarget() {
|
|
1107
|
+
const target = returnFocusElement ?? trigger.value;
|
|
1108
|
+
nextTick(() => target?.focus());
|
|
1109
|
+
}
|
|
1110
|
+
function close(options = {}) {
|
|
1111
|
+
setOpen(false);
|
|
1112
|
+
pendingFocus.value = false;
|
|
1113
|
+
if (options.focusTrigger || options.returnFocus) focusReturnTarget();
|
|
1114
|
+
}
|
|
1115
|
+
function toggle() {
|
|
1116
|
+
if (isOpen.value) close({ returnFocus: true });
|
|
1117
|
+
else open();
|
|
1118
|
+
}
|
|
1119
|
+
function openAt(point, options) {
|
|
1120
|
+
activeReference.value = createVirtualAnchor(point);
|
|
1121
|
+
open(options);
|
|
1122
|
+
}
|
|
1123
|
+
function setTrigger(element, nextId) {
|
|
1124
|
+
if (trigger.value && trigger.value !== element) inside.delete(trigger.value);
|
|
1125
|
+
trigger.value = element;
|
|
1126
|
+
triggerId.value = nextId;
|
|
1127
|
+
if (element) inside.add(element);
|
|
1128
|
+
}
|
|
1129
|
+
const context = {
|
|
1130
|
+
id,
|
|
1131
|
+
isOpen,
|
|
1132
|
+
disabled,
|
|
1133
|
+
modal,
|
|
1134
|
+
trigger,
|
|
1135
|
+
triggerId,
|
|
1136
|
+
contentId,
|
|
1137
|
+
reference,
|
|
1138
|
+
pendingFocus,
|
|
1139
|
+
layer,
|
|
1140
|
+
open,
|
|
1141
|
+
close,
|
|
1142
|
+
toggle,
|
|
1143
|
+
openAt,
|
|
1144
|
+
setTrigger,
|
|
1145
|
+
setReference(nextReference) {
|
|
1146
|
+
activeReference.value = nextReference;
|
|
1147
|
+
},
|
|
1148
|
+
setReturnFocus(element) {
|
|
1149
|
+
returnFocusElement = element;
|
|
1150
|
+
},
|
|
1151
|
+
registerInside(element) {
|
|
1152
|
+
inside.add(element);
|
|
1153
|
+
},
|
|
1154
|
+
unregisterInside(element) {
|
|
1155
|
+
inside.delete(element);
|
|
1156
|
+
},
|
|
1157
|
+
isInside(event) {
|
|
1158
|
+
return [...inside].some((element) => isEventWithinElement(event, element));
|
|
1159
|
+
}
|
|
1160
|
+
};
|
|
1161
|
+
const slotProps = computed(() => ({
|
|
1162
|
+
isOpen: isOpen.value,
|
|
1163
|
+
open,
|
|
1164
|
+
close,
|
|
1165
|
+
toggle,
|
|
1166
|
+
openAt
|
|
1167
|
+
}));
|
|
1168
|
+
watch(disabled, (value) => {
|
|
1169
|
+
if (value) close();
|
|
1170
|
+
});
|
|
1171
|
+
watch(isOpen, (value) => {
|
|
1172
|
+
if (!value) activeReference.value = null;
|
|
1173
|
+
}, { flush: "sync" });
|
|
1174
|
+
provide(rootKey, context);
|
|
1175
|
+
__expose({
|
|
1176
|
+
open,
|
|
1177
|
+
close,
|
|
1178
|
+
toggle,
|
|
1179
|
+
openAt
|
|
1180
|
+
});
|
|
1181
|
+
return createSlot("default", { $: [() => slotProps.value] });
|
|
1182
|
+
}
|
|
1183
|
+
});
|
|
1184
|
+
//#endregion
|
|
1185
|
+
//#region src/components/dropdown-menu/dropdown-menu-separator.vue
|
|
1186
|
+
var dropdown_menu_separator_default = /* @__PURE__ */ defineVaporComponent({
|
|
1187
|
+
name: "RpDropdownMenuSeparator",
|
|
1188
|
+
inheritAttrs: false,
|
|
1189
|
+
__name: "dropdown-menu-separator",
|
|
1190
|
+
props: {
|
|
1191
|
+
id: {},
|
|
1192
|
+
as: { default: "div" },
|
|
1193
|
+
orientation: { default: "horizontal" }
|
|
1194
|
+
},
|
|
1195
|
+
setup(__props) {
|
|
1196
|
+
const props = __props;
|
|
1197
|
+
const attrs = useAttrs();
|
|
1198
|
+
useRequiredInject(menuKey, "RpDropdownMenuSeparator");
|
|
1199
|
+
const rootAttrs = computed(() => mergeProps(attrs, {
|
|
1200
|
+
id: props.id,
|
|
1201
|
+
role: "separator",
|
|
1202
|
+
"aria-orientation": props.orientation,
|
|
1203
|
+
class: "rp-dropdown-menu__separator",
|
|
1204
|
+
"data-orientation": props.orientation
|
|
1205
|
+
}));
|
|
1206
|
+
return createDynamicComponent(() => __props.as, { $: [() => rootAttrs.value] }, null, 1);
|
|
1207
|
+
}
|
|
1208
|
+
});
|
|
1209
|
+
//#endregion
|
|
1210
|
+
//#region src/components/dropdown-menu/dropdown-menu-sub.vue
|
|
1211
|
+
var dropdown_menu_sub_default = /* @__PURE__ */ defineVaporComponent({
|
|
1212
|
+
name: "RpDropdownMenuSub",
|
|
1213
|
+
__name: "dropdown-menu-sub",
|
|
1214
|
+
props: {
|
|
1215
|
+
open: {
|
|
1216
|
+
type: Boolean,
|
|
1217
|
+
default: void 0
|
|
1218
|
+
},
|
|
1219
|
+
defaultOpen: {
|
|
1220
|
+
type: Boolean,
|
|
1221
|
+
default: false
|
|
1222
|
+
}
|
|
1223
|
+
},
|
|
1224
|
+
emits: ["update:open"],
|
|
1225
|
+
setup(__props, { emit: __emit }) {
|
|
1226
|
+
const props = __props;
|
|
1227
|
+
const emit = __emit;
|
|
1228
|
+
const parentMenu = useRequiredInject(menuKey, "RpDropdownMenuSub");
|
|
1229
|
+
const uncontrolled = ref(props.defaultOpen);
|
|
1230
|
+
const isOpen = computed(() => props.open ?? uncontrolled.value);
|
|
1231
|
+
const trigger = ref(null);
|
|
1232
|
+
const contentId = ref();
|
|
1233
|
+
const actualPlacement = ref("right-start");
|
|
1234
|
+
const pendingFocus = ref(false);
|
|
1235
|
+
function setOpen(value) {
|
|
1236
|
+
const previous = isOpen.value;
|
|
1237
|
+
if (props.open === void 0) uncontrolled.value = value;
|
|
1238
|
+
if (previous !== value) emit("update:open", value);
|
|
1239
|
+
}
|
|
1240
|
+
const context = {
|
|
1241
|
+
isOpen,
|
|
1242
|
+
trigger,
|
|
1243
|
+
contentId,
|
|
1244
|
+
actualPlacement,
|
|
1245
|
+
pendingFocus,
|
|
1246
|
+
menu: null,
|
|
1247
|
+
open(focus = "first") {
|
|
1248
|
+
parentMenu.closeSubmenus(context);
|
|
1249
|
+
pendingFocus.value = focus;
|
|
1250
|
+
setOpen(true);
|
|
1251
|
+
if (focus) nextTick(() => context.menu?.focus(focus));
|
|
1252
|
+
},
|
|
1253
|
+
close(focusParent = false) {
|
|
1254
|
+
setOpen(false);
|
|
1255
|
+
pendingFocus.value = false;
|
|
1256
|
+
context.menu?.closeSubmenus();
|
|
1257
|
+
if (focusParent) {
|
|
1258
|
+
parentMenu.setActive(trigger.value?.id ?? "");
|
|
1259
|
+
parentMenu.focusElement();
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
};
|
|
1263
|
+
parentMenu.registerSub(context);
|
|
1264
|
+
provide(subKey, context);
|
|
1265
|
+
watch(parentMenu.root.isOpen, (open) => {
|
|
1266
|
+
if (!open) context.close(false);
|
|
1267
|
+
});
|
|
1268
|
+
onBeforeUnmount(() => parentMenu.unregisterSub(context));
|
|
1269
|
+
return createSlot("default", {
|
|
1270
|
+
isOpen: () => isOpen.value,
|
|
1271
|
+
open: () => context.open,
|
|
1272
|
+
close: () => context.close
|
|
1273
|
+
});
|
|
1274
|
+
}
|
|
1275
|
+
});
|
|
1276
|
+
//#endregion
|
|
1277
|
+
//#region src/components/dropdown-menu/dropdown-menu-sub-content.vue
|
|
1278
|
+
var dropdown_menu_sub_content_default = /* @__PURE__ */ defineVaporComponent({
|
|
1279
|
+
name: "RpDropdownMenuSubContent",
|
|
1280
|
+
inheritAttrs: false,
|
|
1281
|
+
__name: "dropdown-menu-sub-content",
|
|
1282
|
+
props: {
|
|
1283
|
+
placement: { default: "right-start" },
|
|
1284
|
+
id: {},
|
|
1285
|
+
as: { default: "div" },
|
|
1286
|
+
offset: {},
|
|
1287
|
+
strategy: { default: "absolute" },
|
|
1288
|
+
flip: {
|
|
1289
|
+
type: Boolean,
|
|
1290
|
+
default: true
|
|
1291
|
+
},
|
|
1292
|
+
shift: {
|
|
1293
|
+
type: Boolean,
|
|
1294
|
+
default: true
|
|
1295
|
+
},
|
|
1296
|
+
collisionPadding: { default: 8 },
|
|
1297
|
+
avoidCollisions: {
|
|
1298
|
+
type: Boolean,
|
|
1299
|
+
default: true
|
|
1300
|
+
},
|
|
1301
|
+
forceMount: {
|
|
1302
|
+
type: Boolean,
|
|
1303
|
+
default: false
|
|
1304
|
+
},
|
|
1305
|
+
ariaLabel: {},
|
|
1306
|
+
ariaLabelledby: {},
|
|
1307
|
+
ariaDescribedby: {}
|
|
1308
|
+
},
|
|
1309
|
+
emits: [
|
|
1310
|
+
"escapeKeyDown",
|
|
1311
|
+
"pointerDownOutside",
|
|
1312
|
+
"focusOutside",
|
|
1313
|
+
"interactOutside"
|
|
1314
|
+
],
|
|
1315
|
+
setup(__props, { emit: __emit }) {
|
|
1316
|
+
const props = __props;
|
|
1317
|
+
const emit = __emit;
|
|
1318
|
+
const { actualPlacement, isOpen, shouldRender, rootAttrs, setElement, close } = useDropdownMenuPrimitiveContent(props, useAttrs(), {
|
|
1319
|
+
escapeKeyDown: (event) => emit("escapeKeyDown", event),
|
|
1320
|
+
pointerDownOutside: (event) => emit("pointerDownOutside", event),
|
|
1321
|
+
focusOutside: (event) => emit("focusOutside", event),
|
|
1322
|
+
interactOutside: (event) => emit("interactOutside", event)
|
|
1323
|
+
}, true);
|
|
1324
|
+
return createIf(() => unref(shouldRender), () => {
|
|
1325
|
+
const n3 = createDynamicComponent(() => __props.as, { $: [() => unref(rootAttrs)] }, extend(() => {
|
|
1326
|
+
return createSlot("default", {
|
|
1327
|
+
isOpen: () => unref(isOpen),
|
|
1328
|
+
placement: () => unref(actualPlacement),
|
|
1329
|
+
close: () => unref(close)
|
|
1330
|
+
});
|
|
1331
|
+
}, { _: 8 }), 1);
|
|
1332
|
+
setTemplateRefBinding(n3, () => setElement, void 0, void 0, "setElement");
|
|
1333
|
+
return n3;
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
});
|
|
1337
|
+
//#endregion
|
|
1338
|
+
//#region src/components/dropdown-menu/dropdown-menu-sub-trigger.vue
|
|
1339
|
+
var dropdown_menu_sub_trigger_default = /* @__PURE__ */ defineVaporComponent({
|
|
1340
|
+
name: "RpDropdownMenuSubTrigger",
|
|
1341
|
+
inheritAttrs: false,
|
|
1342
|
+
__name: "dropdown-menu-sub-trigger",
|
|
1343
|
+
props: {
|
|
1344
|
+
id: {},
|
|
1345
|
+
as: { default: "button" },
|
|
1346
|
+
disabled: {
|
|
1347
|
+
type: Boolean,
|
|
1348
|
+
default: false
|
|
1349
|
+
}
|
|
1350
|
+
},
|
|
1351
|
+
setup(__props) {
|
|
1352
|
+
const props = __props;
|
|
1353
|
+
const attrs = useAttrs();
|
|
1354
|
+
const menu = useRequiredInject(menuKey, "RpDropdownMenuSubTrigger");
|
|
1355
|
+
const sub = useRequiredInject(subKey, "RpDropdownMenuSubTrigger");
|
|
1356
|
+
const generatedId = useId();
|
|
1357
|
+
const id = computed(() => props.id ?? `${generatedId}-sub-trigger`);
|
|
1358
|
+
const isDisabled = computed(() => menu.root.disabled.value || props.disabled);
|
|
1359
|
+
const focused = computed(() => menu.isActive(id.value));
|
|
1360
|
+
const registration = {
|
|
1361
|
+
get id() {
|
|
1362
|
+
return id.value;
|
|
1363
|
+
},
|
|
1364
|
+
element: () => sub.trigger.value,
|
|
1365
|
+
disabled: () => isDisabled.value,
|
|
1366
|
+
activate: () => sub.open("first"),
|
|
1367
|
+
submenu: sub
|
|
1368
|
+
};
|
|
1369
|
+
menu.registerItem(registration);
|
|
1370
|
+
onBeforeUnmount(() => menu.unregisterItem(id.value));
|
|
1371
|
+
function setElement(value) {
|
|
1372
|
+
resolveHTMLElementRef(value, id.value, (resolved) => {
|
|
1373
|
+
sub.trigger.value = resolved;
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
function onMouseenter() {
|
|
1377
|
+
if (isDisabled.value) return;
|
|
1378
|
+
menu.setActive(id.value);
|
|
1379
|
+
sub.open(false);
|
|
1380
|
+
}
|
|
1381
|
+
function onClick(event) {
|
|
1382
|
+
if (!event.defaultPrevented && !isDisabled.value) sub.open("first");
|
|
1383
|
+
}
|
|
1384
|
+
const rootAttrs = computed(() => mergeProps(attrs, {
|
|
1385
|
+
id: id.value,
|
|
1386
|
+
type: props.as === "button" ? "button" : void 0,
|
|
1387
|
+
role: "menuitem",
|
|
1388
|
+
tabindex: -1,
|
|
1389
|
+
disabled: props.as === "button" ? optionalAttr(isDisabled.value) : void 0,
|
|
1390
|
+
"aria-disabled": optionalAttr(isDisabled.value),
|
|
1391
|
+
"aria-haspopup": "menu",
|
|
1392
|
+
"aria-expanded": sub.isOpen.value,
|
|
1393
|
+
"aria-controls": sub.contentId.value,
|
|
1394
|
+
"data-disabled": optionalAttr(isDisabled.value),
|
|
1395
|
+
"data-focused": optionalAttr(focused.value),
|
|
1396
|
+
"data-highlighted": optionalAttr(focused.value),
|
|
1397
|
+
"data-state": sub.isOpen.value ? "open" : "closed",
|
|
1398
|
+
class: bem("rp-dropdown-menu__item", {
|
|
1399
|
+
focused: focused.value,
|
|
1400
|
+
disabled: isDisabled.value,
|
|
1401
|
+
submenu: true,
|
|
1402
|
+
open: sub.isOpen.value
|
|
1403
|
+
}),
|
|
1404
|
+
onClick,
|
|
1405
|
+
onMouseenter
|
|
1406
|
+
}));
|
|
1407
|
+
const n1 = createDynamicComponent(() => __props.as, { $: [() => rootAttrs.value] }, extend(() => {
|
|
1408
|
+
return createSlot("default", {
|
|
1409
|
+
focused: () => focused.value,
|
|
1410
|
+
disabled: () => isDisabled.value,
|
|
1411
|
+
isOpen: () => unref(sub).isOpen.value,
|
|
1412
|
+
open: () => unref(sub).open,
|
|
1413
|
+
close: () => unref(sub).close
|
|
1414
|
+
});
|
|
1415
|
+
}, { _: 8 }), 1);
|
|
1416
|
+
setTemplateRefBinding(n1, () => setElement);
|
|
1417
|
+
return n1;
|
|
1418
|
+
}
|
|
1419
|
+
});
|
|
1420
|
+
//#endregion
|
|
1421
|
+
//#region src/components/dropdown-menu/dropdown-menu-trigger.vue
|
|
1422
|
+
var dropdown_menu_trigger_default = /* @__PURE__ */ defineVaporComponent({
|
|
1423
|
+
name: "RpDropdownMenuTrigger",
|
|
1424
|
+
inheritAttrs: false,
|
|
1425
|
+
__name: "dropdown-menu-trigger",
|
|
1426
|
+
props: {
|
|
1427
|
+
id: {},
|
|
1428
|
+
as: { default: "button" },
|
|
1429
|
+
disabled: {
|
|
1430
|
+
type: Boolean,
|
|
1431
|
+
default: false
|
|
1432
|
+
}
|
|
1433
|
+
},
|
|
1434
|
+
setup(__props) {
|
|
1435
|
+
const props = __props;
|
|
1436
|
+
const attrs = useAttrs();
|
|
1437
|
+
const root = useRequiredInject(rootKey, "RpDropdownMenuTrigger");
|
|
1438
|
+
const generatedId = useId();
|
|
1439
|
+
const id = computed(() => props.id ?? `${generatedId}-trigger`);
|
|
1440
|
+
const element = ref(null);
|
|
1441
|
+
const isDisabled = computed(() => root.disabled.value || props.disabled);
|
|
1442
|
+
function setElement(value) {
|
|
1443
|
+
resolveHTMLElementRef(value, id.value, (resolved) => {
|
|
1444
|
+
element.value = resolved;
|
|
1445
|
+
root.setTrigger(resolved, id.value);
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
function openWithReference(focus = "first") {
|
|
1449
|
+
root.setReference(element.value);
|
|
1450
|
+
root.setReturnFocus(element.value);
|
|
1451
|
+
root.open({ focus });
|
|
1452
|
+
}
|
|
1453
|
+
function onClick(event) {
|
|
1454
|
+
if (event.defaultPrevented || isDisabled.value) return;
|
|
1455
|
+
root.setReference(element.value);
|
|
1456
|
+
root.setReturnFocus(element.value);
|
|
1457
|
+
root.toggle();
|
|
1458
|
+
}
|
|
1459
|
+
function onKeydown(event) {
|
|
1460
|
+
if (isDisabled.value) return;
|
|
1461
|
+
if (event.key === "ArrowUp") {
|
|
1462
|
+
event.preventDefault();
|
|
1463
|
+
openWithReference("last");
|
|
1464
|
+
} else if ([
|
|
1465
|
+
"Enter",
|
|
1466
|
+
" ",
|
|
1467
|
+
"ArrowDown"
|
|
1468
|
+
].includes(event.key)) {
|
|
1469
|
+
event.preventDefault();
|
|
1470
|
+
openWithReference("first");
|
|
1471
|
+
} else if (event.key === "Escape") root.close({ focusTrigger: true });
|
|
1472
|
+
}
|
|
1473
|
+
const rootAttrs = computed(() => mergeProps(attrs, {
|
|
1474
|
+
id: id.value,
|
|
1475
|
+
type: props.as === "button" ? "button" : void 0,
|
|
1476
|
+
disabled: props.as === "button" ? optionalAttr(isDisabled.value) : void 0,
|
|
1477
|
+
"aria-controls": root.contentId.value,
|
|
1478
|
+
"aria-expanded": root.isOpen.value,
|
|
1479
|
+
"aria-haspopup": "menu",
|
|
1480
|
+
"aria-disabled": props.as === "button" ? void 0 : optionalAttr(isDisabled.value),
|
|
1481
|
+
"data-state": root.isOpen.value ? "open" : "closed",
|
|
1482
|
+
"data-disabled": optionalAttr(isDisabled.value),
|
|
1483
|
+
onClick,
|
|
1484
|
+
onKeydown
|
|
1485
|
+
}));
|
|
1486
|
+
onBeforeUnmount(() => root.setTrigger(null));
|
|
1487
|
+
const n1 = createDynamicComponent(() => __props.as, { $: [() => rootAttrs.value] }, extend(() => {
|
|
1488
|
+
return createSlot("default", { isOpen: () => unref(root).isOpen.value });
|
|
1489
|
+
}, { _: 8 }), 1);
|
|
1490
|
+
setTemplateRefBinding(n1, () => setElement);
|
|
1491
|
+
return n1;
|
|
1492
|
+
}
|
|
1493
|
+
});
|
|
1494
|
+
//#endregion
|
|
5
1495
|
//#region ~icons/lucide/chevron-right
|
|
6
|
-
var t0$
|
|
1496
|
+
var t0$2 = template("<svg viewBox=\"0 0 24 24\"width=1.2em height=1.2em><path fill=none stroke=currentColor stroke-linecap=round stroke-linejoin=round stroke-width=2 d=\"m9 18l6-6l-6-6\">", 3, 1);
|
|
7
1497
|
function render(_ctx) {
|
|
8
|
-
return t0$
|
|
1498
|
+
return t0$2();
|
|
9
1499
|
}
|
|
10
1500
|
var chevron_right_default = markRaw(defineVaporComponent({
|
|
11
1501
|
name: "lucide-chevron-right",
|
|
@@ -72,140 +1562,121 @@ function getNextEnabledIndex(items, index, direction) {
|
|
|
72
1562
|
return enabledIndexes[enabledIndexes.length - 1];
|
|
73
1563
|
}
|
|
74
1564
|
//#endregion
|
|
75
|
-
//#region src/components/dropdown-menu/dropdown-menu-
|
|
76
|
-
var
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
var
|
|
81
|
-
type: Function,
|
|
82
|
-
required: true
|
|
83
|
-
};
|
|
84
|
-
var DropdownMenuItemRow = defineComponent({
|
|
1565
|
+
//#region src/components/dropdown-menu/dropdown-menu-item-row.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
1566
|
+
var t0$1 = template("<div>");
|
|
1567
|
+
var t1$1 = template("<div class=rp-dropdown-menu__item-wrap role=none><button></button>", 1);
|
|
1568
|
+
//#endregion
|
|
1569
|
+
//#region src/components/dropdown-menu/dropdown-menu-item-row.vue
|
|
1570
|
+
var dropdown_menu_item_row_default = /* @__PURE__ */ defineVaporComponent({
|
|
85
1571
|
name: "RpDropdownMenuItemRow",
|
|
1572
|
+
__name: "dropdown-menu-item-row",
|
|
86
1573
|
props: {
|
|
87
|
-
context:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
},
|
|
92
|
-
focused: {
|
|
93
|
-
type: Boolean,
|
|
94
|
-
required: true
|
|
95
|
-
},
|
|
96
|
-
index: {
|
|
97
|
-
type: Number,
|
|
98
|
-
required: true
|
|
99
|
-
},
|
|
100
|
-
item: {
|
|
101
|
-
type: Object,
|
|
102
|
-
required: true
|
|
103
|
-
},
|
|
104
|
-
parentPath: {
|
|
105
|
-
type: Array,
|
|
106
|
-
required: true
|
|
107
|
-
},
|
|
108
|
-
renderItem: renderItemProp,
|
|
109
|
-
submenuOpen: {
|
|
110
|
-
type: Boolean,
|
|
111
|
-
required: true
|
|
112
|
-
}
|
|
1574
|
+
context: {},
|
|
1575
|
+
index: {},
|
|
1576
|
+
item: {},
|
|
1577
|
+
parentPath: {}
|
|
113
1578
|
},
|
|
114
|
-
setup(
|
|
1579
|
+
setup(__props) {
|
|
1580
|
+
const props = __props;
|
|
115
1581
|
const path = computed(() => [...props.parentPath, props.index]);
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
type: Array,
|
|
139
|
-
required: true
|
|
140
|
-
},
|
|
141
|
-
parentPath: {
|
|
142
|
-
type: Array,
|
|
143
|
-
default: () => []
|
|
144
|
-
},
|
|
145
|
-
renderItem: renderItemProp
|
|
146
|
-
},
|
|
147
|
-
setup(props) {
|
|
148
|
-
return () => props.items.map((item, index) => {
|
|
149
|
-
const path = [...props.parentPath, index];
|
|
150
|
-
const hasSubmenu = hasItemSubmenu(item);
|
|
151
|
-
return h(DropdownMenuItemRow, {
|
|
152
|
-
key: `${getPathKey(path)}:${String(item.value)}`,
|
|
153
|
-
context: props.context,
|
|
154
|
-
disabled: Boolean(item.disabled),
|
|
155
|
-
focused: props.context.isItemFocused(path),
|
|
156
|
-
index,
|
|
157
|
-
item,
|
|
158
|
-
parentPath: props.parentPath,
|
|
159
|
-
renderItem: props.renderItem,
|
|
160
|
-
submenuOpen: hasSubmenu && props.context.isSubmenuOpen(path)
|
|
161
|
-
});
|
|
1582
|
+
const hasSubmenu = computed(() => hasItemSubmenu(props.item));
|
|
1583
|
+
const focused = computed(() => props.context.isItemFocused(path.value));
|
|
1584
|
+
const disabled = computed(() => Boolean(props.item.disabled));
|
|
1585
|
+
const submenuOpen = computed(() => hasSubmenu.value && props.context.isSubmenuOpen(path.value));
|
|
1586
|
+
const itemProps = computed(() => props.context.getItemProps(props.item, path.value, focused.value, disabled.value, submenuOpen.value));
|
|
1587
|
+
const publicItemProps = computed(() => ({
|
|
1588
|
+
...itemProps.value,
|
|
1589
|
+
...props.context.getPublicPartAttrs?.("item", { class: itemProps.value.class })
|
|
1590
|
+
}));
|
|
1591
|
+
const slotProps = computed(() => props.context.getItemSlotProps(props.item, path.value, focused.value, disabled.value, submenuOpen.value));
|
|
1592
|
+
const itemElement = ref(null);
|
|
1593
|
+
const submenuElement = ref(null);
|
|
1594
|
+
const { actualPlacement, floatingStyle } = useFloatingPosition({
|
|
1595
|
+
reference: itemElement,
|
|
1596
|
+
floating: submenuElement,
|
|
1597
|
+
open: submenuOpen,
|
|
1598
|
+
placement: props.context.getSubmenuPlacement,
|
|
1599
|
+
strategy: props.context.getStrategy,
|
|
1600
|
+
offset: () => 4,
|
|
1601
|
+
flip: props.context.getFlip,
|
|
1602
|
+
shift: props.context.getShift,
|
|
1603
|
+
collisionPadding: props.context.getCollisionPadding
|
|
162
1604
|
});
|
|
1605
|
+
const submenuProps = computed(() => props.context.getSubmenuProps(props.item, path.value, true));
|
|
1606
|
+
const publicSubmenuProps = computed(() => ({
|
|
1607
|
+
...submenuProps.value,
|
|
1608
|
+
...props.context.getPublicPartAttrs?.("submenu", {
|
|
1609
|
+
class: submenuProps.value.class,
|
|
1610
|
+
style: floatingStyle.value
|
|
1611
|
+
})
|
|
1612
|
+
}));
|
|
1613
|
+
const placementSide = computed(() => actualPlacement.value.split("-")[0]);
|
|
1614
|
+
function getChildKey(index, child) {
|
|
1615
|
+
return `${getPathKey([...path.value, index])}:${String(child.value)}`;
|
|
1616
|
+
}
|
|
1617
|
+
const _setTemplateRef = createTemplateRefSetter();
|
|
1618
|
+
const _component_DropdownMenuItemRow__self = resolveComponent("DropdownMenuItemRow", true);
|
|
1619
|
+
const n10 = t1$1();
|
|
1620
|
+
const n1 = child(n10);
|
|
1621
|
+
renderEffect(() => setDynamicProps(n1, [publicItemProps.value]));
|
|
1622
|
+
setInsertionState(n1, null, 0);
|
|
1623
|
+
createSlot("item", { $: [() => slotProps.value] });
|
|
1624
|
+
setStaticTemplateRef(n1, itemElement, null, "itemElement");
|
|
1625
|
+
setInsertionState(n10, null, 1);
|
|
1626
|
+
createIf(() => hasSubmenu.value && submenuOpen.value, () => {
|
|
1627
|
+
const n9 = t0$1();
|
|
1628
|
+
renderEffect(() => setDynamicProps(n9, [publicSubmenuProps.value, {
|
|
1629
|
+
"data-state": "open",
|
|
1630
|
+
"data-placement": unref(actualPlacement),
|
|
1631
|
+
"data-side": placementSide.value
|
|
1632
|
+
}]));
|
|
1633
|
+
setInsertionState(n9, null, 0);
|
|
1634
|
+
createFor(() => __props.item.children ?? [], (_for_item0, _for_key0) => {
|
|
1635
|
+
return createComponentWithFallback(_component_DropdownMenuItemRow__self, {
|
|
1636
|
+
context: () => __props.context,
|
|
1637
|
+
index: () => _for_key0.value,
|
|
1638
|
+
item: () => _for_item0.value,
|
|
1639
|
+
"parent-path": () => path.value
|
|
1640
|
+
}, { "item": extend((childSlotProps) => {
|
|
1641
|
+
return createSlot("item", { $: [() => childSlotProps] });
|
|
1642
|
+
}, { _: 8 }) });
|
|
1643
|
+
}, (child, childIndex) => getChildKey(childIndex, child), 3);
|
|
1644
|
+
_setTemplateRef(n9, submenuElement, null, "submenuElement");
|
|
1645
|
+
return n9;
|
|
1646
|
+
});
|
|
1647
|
+
return n10;
|
|
163
1648
|
}
|
|
164
1649
|
});
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
context: contextProp,
|
|
169
|
-
item: {
|
|
170
|
-
type: Object,
|
|
171
|
-
required: true
|
|
172
|
-
},
|
|
173
|
-
path: {
|
|
174
|
-
type: Array,
|
|
175
|
-
required: true
|
|
176
|
-
},
|
|
177
|
-
renderItem: renderItemProp
|
|
178
|
-
},
|
|
179
|
-
setup(props) {
|
|
180
|
-
return () => h("div", props.context.getSubmenuProps(props.item, props.path, true), [h(DropdownMenuItemsList, {
|
|
181
|
-
context: props.context,
|
|
182
|
-
items: props.item.children ?? [],
|
|
183
|
-
parentPath: props.path,
|
|
184
|
-
renderItem: props.renderItem
|
|
185
|
-
})]);
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
var dropdown_menu_items_default = defineComponent({
|
|
1650
|
+
//#endregion
|
|
1651
|
+
//#region src/components/dropdown-menu/dropdown-menu-items.vue
|
|
1652
|
+
var dropdown_menu_items_default = /* @__PURE__ */ defineVaporComponent({
|
|
189
1653
|
name: "RpDropdownMenuItems",
|
|
1654
|
+
__name: "dropdown-menu-items",
|
|
190
1655
|
props: {
|
|
191
|
-
context:
|
|
192
|
-
items: {
|
|
193
|
-
|
|
194
|
-
required: true
|
|
195
|
-
}
|
|
1656
|
+
context: {},
|
|
1657
|
+
items: {},
|
|
1658
|
+
parentPath: { default: () => [] }
|
|
196
1659
|
},
|
|
197
|
-
setup(
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
1660
|
+
setup(__props) {
|
|
1661
|
+
const props = __props;
|
|
1662
|
+
function getItemKey(index, item) {
|
|
1663
|
+
return `${getPathKey([...props.parentPath, index])}:${String(item.value)}`;
|
|
1664
|
+
}
|
|
1665
|
+
return createFor(() => __props.items, (_for_item0, _for_key0) => {
|
|
1666
|
+
return createComponent(dropdown_menu_item_row_default, {
|
|
1667
|
+
context: () => __props.context,
|
|
1668
|
+
index: () => _for_key0.value,
|
|
1669
|
+
item: () => _for_item0.value,
|
|
1670
|
+
"parent-path": () => __props.parentPath
|
|
1671
|
+
}, { "item": extend((slotProps) => {
|
|
1672
|
+
return createSlot("item", { $: [() => slotProps] });
|
|
1673
|
+
}, { _: 8 }) });
|
|
1674
|
+
}, (item, index) => getItemKey(index, item), 2);
|
|
204
1675
|
}
|
|
205
1676
|
});
|
|
206
1677
|
//#endregion
|
|
207
1678
|
//#region src/components/dropdown-menu/useDropdownMenuDisclosure.ts
|
|
208
|
-
function useDropdownMenuDisclosure({ props, emit, rootRef, uncontrolledOpen, isDisabled, isOpen, isVisible, focusedPath, resetFocus, resetSubmenus, resetHoverIntent, focusItem, focusMenu, focusTrigger }) {
|
|
1679
|
+
function useDropdownMenuDisclosure({ props, emit, rootRef, menuRef, targetRef, uncontrolledOpen, isDisabled, isOpen, isVisible, focusedPath, resetFocus, resetSubmenus, resetHoverIntent, focusItem, focusMenu, focusTrigger, layer }) {
|
|
209
1680
|
function setOpen(nextOpen) {
|
|
210
1681
|
if (nextOpen && isDisabled.value) return;
|
|
211
1682
|
const previousOpen = isOpen.value;
|
|
@@ -243,7 +1714,52 @@ function useDropdownMenuDisclosure({ props, emit, rootRef, uncontrolledOpen, isD
|
|
|
243
1714
|
focusMenu();
|
|
244
1715
|
} else resetMenuFocus();
|
|
245
1716
|
});
|
|
246
|
-
|
|
1717
|
+
function emitOutside(type, originalEvent) {
|
|
1718
|
+
const outsideEvent = createOutsideEvent(originalEvent);
|
|
1719
|
+
if (type === "pointer") emit.pointerDownOutside?.(outsideEvent);
|
|
1720
|
+
else emit.focusOutside?.(outsideEvent);
|
|
1721
|
+
emit.interactOutside?.(outsideEvent);
|
|
1722
|
+
return outsideEvent;
|
|
1723
|
+
}
|
|
1724
|
+
function isInside(event) {
|
|
1725
|
+
return isEventWithinTargets(event, [
|
|
1726
|
+
rootRef,
|
|
1727
|
+
menuRef,
|
|
1728
|
+
targetRef,
|
|
1729
|
+
...props.ignore ?? []
|
|
1730
|
+
]);
|
|
1731
|
+
}
|
|
1732
|
+
function blockModalInteraction(event) {
|
|
1733
|
+
if (!props.modal) return;
|
|
1734
|
+
if (event.cancelable) event.preventDefault();
|
|
1735
|
+
event.stopPropagation();
|
|
1736
|
+
if (event.type === "pointerdown") blockNextDocumentClick();
|
|
1737
|
+
}
|
|
1738
|
+
function onDocumentPointerdown(event) {
|
|
1739
|
+
if (!layer.isTopLayer()) return;
|
|
1740
|
+
if (isInside(event)) return;
|
|
1741
|
+
const outsideEvent = emitOutside("pointer", event);
|
|
1742
|
+
blockModalInteraction(event);
|
|
1743
|
+
if (!outsideEvent.defaultPrevented) close({ focusTrigger: Boolean(props.modal) });
|
|
1744
|
+
}
|
|
1745
|
+
function onDocumentFocus(event) {
|
|
1746
|
+
if (!layer.isTopLayer()) return;
|
|
1747
|
+
if (isInside(event)) return;
|
|
1748
|
+
const outsideEvent = emitOutside("focus", event);
|
|
1749
|
+
blockModalInteraction(event);
|
|
1750
|
+
if (!outsideEvent.defaultPrevented) close({ focusTrigger: Boolean(props.modal) });
|
|
1751
|
+
else if (props.modal) focusMenu();
|
|
1752
|
+
}
|
|
1753
|
+
let isListening = false;
|
|
1754
|
+
function setDocumentListeners(active) {
|
|
1755
|
+
if (typeof document === "undefined" || active === isListening) return;
|
|
1756
|
+
isListening = active;
|
|
1757
|
+
const method = active ? "addEventListener" : "removeEventListener";
|
|
1758
|
+
document[method]("pointerdown", onDocumentPointerdown, true);
|
|
1759
|
+
document[method]("focusin", onDocumentFocus, true);
|
|
1760
|
+
}
|
|
1761
|
+
watch(isVisible, setDocumentListeners, { immediate: true });
|
|
1762
|
+
onBeforeUnmount(() => setDocumentListeners(false));
|
|
247
1763
|
return {
|
|
248
1764
|
open,
|
|
249
1765
|
close,
|
|
@@ -253,13 +1769,17 @@ function useDropdownMenuDisclosure({ props, emit, rootRef, uncontrolledOpen, isD
|
|
|
253
1769
|
}
|
|
254
1770
|
//#endregion
|
|
255
1771
|
//#region src/components/dropdown-menu/useDropdownMenuDom.ts
|
|
256
|
-
function useDropdownMenuDom({ menuId, rootRef, menuRef, placement, focusedPath }) {
|
|
1772
|
+
function useDropdownMenuDom({ menuId, rootRef, menuRef, targetRef, placement, focusedPath }) {
|
|
257
1773
|
const activeDescendantId = computed(() => focusedPath.value.length === 0 ? void 0 : getItemId(focusedPath.value));
|
|
258
1774
|
function focusMenu() {
|
|
259
1775
|
nextTick(() => menuRef.value?.focus());
|
|
260
1776
|
}
|
|
261
1777
|
function focusTrigger() {
|
|
262
1778
|
nextTick(() => {
|
|
1779
|
+
if (targetRef.value instanceof HTMLElement) {
|
|
1780
|
+
targetRef.value.focus();
|
|
1781
|
+
return;
|
|
1782
|
+
}
|
|
263
1783
|
(rootRef.value?.querySelector("[aria-haspopup=\"menu\"]"))?.focus();
|
|
264
1784
|
});
|
|
265
1785
|
}
|
|
@@ -457,15 +1977,22 @@ function useDropdownMenuInteractions({ props, emit, isDisabled, focusedPath, ope
|
|
|
457
1977
|
function activateItem(item, path, event) {
|
|
458
1978
|
if (item.disabled) return;
|
|
459
1979
|
if (hasItemSubmenu(item)) {
|
|
460
|
-
openSubmenu(path, DEFAULT_FOCUS_TARGET, event ? getEventPoint(event) : void 0);
|
|
1980
|
+
openSubmenu(path, DEFAULT_FOCUS_TARGET, event instanceof MouseEvent ? getEventPoint(event) : void 0);
|
|
461
1981
|
return;
|
|
462
1982
|
}
|
|
463
|
-
selectItem(item);
|
|
1983
|
+
selectItem(item, event);
|
|
464
1984
|
}
|
|
465
|
-
function selectItem(item) {
|
|
1985
|
+
function selectItem(item, originalEvent = new Event("select")) {
|
|
466
1986
|
if (item.disabled) return;
|
|
467
|
-
|
|
468
|
-
|
|
1987
|
+
const event = new CustomEvent("dropdown-menu-select", {
|
|
1988
|
+
cancelable: true,
|
|
1989
|
+
detail: {
|
|
1990
|
+
originalEvent,
|
|
1991
|
+
value: item.value
|
|
1992
|
+
}
|
|
1993
|
+
});
|
|
1994
|
+
emit.select?.(item, event);
|
|
1995
|
+
if (!event.defaultPrevented && props.closeOnSelect !== false) disclosure.close({ focusTrigger: true });
|
|
469
1996
|
}
|
|
470
1997
|
function closeSubmenusAfter(menuPath) {
|
|
471
1998
|
submenus.closeSubmenusAfter(menuPath);
|
|
@@ -497,10 +2024,10 @@ function useDropdownMenuInteractions({ props, emit, isDisabled, focusedPath, ope
|
|
|
497
2024
|
const path = normalizePath(indexOrPath);
|
|
498
2025
|
hoverIntent.handleItemHover(item, path, event, commitHoveredItem);
|
|
499
2026
|
}
|
|
500
|
-
function selectFocusedItem() {
|
|
2027
|
+
function selectFocusedItem(event) {
|
|
501
2028
|
const item = getItemAtPath(focusedPath.value);
|
|
502
2029
|
if (!item) return;
|
|
503
|
-
activateItem(item, focusedPath.value);
|
|
2030
|
+
activateItem(item, focusedPath.value, event);
|
|
504
2031
|
}
|
|
505
2032
|
function moveFocusedItem(direction) {
|
|
506
2033
|
const menuPath = moveFocus(direction);
|
|
@@ -553,7 +2080,7 @@ function useDropdownMenuInteractions({ props, emit, isDisabled, focusedPath, ope
|
|
|
553
2080
|
case "Enter":
|
|
554
2081
|
case " ":
|
|
555
2082
|
event.preventDefault();
|
|
556
|
-
selectFocusedItem();
|
|
2083
|
+
selectFocusedItem(event);
|
|
557
2084
|
break;
|
|
558
2085
|
case "Escape":
|
|
559
2086
|
event.preventDefault();
|
|
@@ -655,8 +2182,30 @@ function useDropdownMenuNavigation(items) {
|
|
|
655
2182
|
};
|
|
656
2183
|
}
|
|
657
2184
|
//#endregion
|
|
2185
|
+
//#region src/components/dropdown-menu/useDropdownMenuPortalPosition.ts
|
|
2186
|
+
function useDropdownMenuPortalPosition(options) {
|
|
2187
|
+
const floating = useFloatingPosition({
|
|
2188
|
+
reference: options.reference,
|
|
2189
|
+
floating: options.menuRef,
|
|
2190
|
+
arrow: options.arrowRef,
|
|
2191
|
+
open: options.isVisible,
|
|
2192
|
+
placement: () => options.placement.value,
|
|
2193
|
+
strategy: () => options.props.strategy ?? "absolute",
|
|
2194
|
+
offset: () => options.props.offset,
|
|
2195
|
+
flip: () => options.props.flip !== false,
|
|
2196
|
+
shift: () => options.props.shift !== false,
|
|
2197
|
+
collisionPadding: () => options.props.collisionPadding ?? 8,
|
|
2198
|
+
restartKey: options.restartKey
|
|
2199
|
+
});
|
|
2200
|
+
return {
|
|
2201
|
+
actualPlacement: floating.actualPlacement,
|
|
2202
|
+
arrowStyle: floating.arrowStyle,
|
|
2203
|
+
contentStyle: floating.floatingStyle
|
|
2204
|
+
};
|
|
2205
|
+
}
|
|
2206
|
+
//#endregion
|
|
658
2207
|
//#region src/components/dropdown-menu/useDropdownMenuRenderItems.ts
|
|
659
|
-
function useDropdownMenuRenderItems({ items, getItemId, getSubmenuId, getMenuActiveDescendant, isItemFocused, isSubmenuOpen, activateItem, focusHoveredItem, selectItem, openSubmenu, closeSubmenu, close }) {
|
|
2208
|
+
function useDropdownMenuRenderItems({ props, actualPlacement, items, getItemId, getSubmenuId, getMenuActiveDescendant, getItemElement, isItemFocused, isSubmenuOpen, activateItem, focusHoveredItem, selectItem, openSubmenu, closeSubmenu, close }) {
|
|
660
2209
|
const renderedItems = computed(() => getRenderedItems(items.value));
|
|
661
2210
|
function getRenderedItems(dropdownItems, parentPath = []) {
|
|
662
2211
|
return dropdownItems.map((item, index) => {
|
|
@@ -697,9 +2246,9 @@ function useDropdownMenuRenderItems({ items, getItemId, getSubmenuId, getMenuAct
|
|
|
697
2246
|
"aria-expanded": hasSubmenu ? resolvedSubmenuOpen : void 0,
|
|
698
2247
|
"aria-haspopup": hasSubmenu ? "menu" : void 0,
|
|
699
2248
|
"aria-disabled": disabled || void 0,
|
|
700
|
-
"data-disabled": disabled
|
|
701
|
-
"data-
|
|
702
|
-
"data-submenu": hasSubmenu
|
|
2249
|
+
"data-disabled": disabled ? "" : void 0,
|
|
2250
|
+
"data-highlighted": focused ? "" : void 0,
|
|
2251
|
+
"data-submenu": hasSubmenu ? "" : void 0,
|
|
703
2252
|
onClick: (event) => activateItem(item, path, event),
|
|
704
2253
|
onMouseenter: (event) => focusHoveredItem(item, path, event)
|
|
705
2254
|
};
|
|
@@ -742,7 +2291,13 @@ function useDropdownMenuRenderItems({ items, getItemId, getSubmenuId, getMenuAct
|
|
|
742
2291
|
isSubmenuOpen,
|
|
743
2292
|
getItemProps,
|
|
744
2293
|
getSubmenuProps,
|
|
745
|
-
getItemSlotProps
|
|
2294
|
+
getItemSlotProps,
|
|
2295
|
+
getItemElement,
|
|
2296
|
+
getSubmenuPlacement: () => actualPlacement.value.endsWith("end") ? "left-start" : "right-start",
|
|
2297
|
+
getStrategy: () => props.strategy ?? "absolute",
|
|
2298
|
+
getFlip: () => props.flip !== false,
|
|
2299
|
+
getShift: () => props.shift !== false,
|
|
2300
|
+
getCollisionPadding: () => props.collisionPadding ?? 8
|
|
746
2301
|
},
|
|
747
2302
|
getItemProps,
|
|
748
2303
|
getItemSlotProps
|
|
@@ -794,16 +2349,42 @@ function useDropdownSubmenus({ focusedPath, getItemAtPath, focusItem }) {
|
|
|
794
2349
|
function useDropdownMenu(props, emit = {}) {
|
|
795
2350
|
const rootRef = ref(null);
|
|
796
2351
|
const menuRef = ref(null);
|
|
2352
|
+
const arrowRef = ref(null);
|
|
797
2353
|
const uncontrolledOpen = ref(false);
|
|
798
2354
|
const generatedId = useId();
|
|
799
2355
|
const menuId = computed(() => props.id ?? `${generatedId}-menu`);
|
|
800
2356
|
const placement = computed(() => props.placement ?? "bottom-start");
|
|
2357
|
+
const requestedTeleportTarget = computed(() => props.portalTo ?? props.teleportTo);
|
|
2358
|
+
const teleportTo = useTeleportTarget(() => requestedTeleportTarget.value);
|
|
2359
|
+
const teleportPositioningKey = useTeleportPositioningKey();
|
|
2360
|
+
const shouldTeleport = computed(() => props.portal ?? props.teleport !== false);
|
|
2361
|
+
const { isExplicitTarget, reference, resolvedTarget } = useFloatingTarget(() => props.target, rootRef);
|
|
2362
|
+
const targetElement = computed(() => isElementReference(resolvedTarget.value) ? resolvedTarget.value : null);
|
|
801
2363
|
const visibleItems = computed(() => props.items ?? []);
|
|
802
2364
|
const isDisabled = computed(() => Boolean(props.disabled));
|
|
803
2365
|
const isOpen = computed(() => props.open ?? uncontrolledOpen.value);
|
|
804
2366
|
const isVisible = computed(() => isOpen.value && !isDisabled.value);
|
|
2367
|
+
const layer = useOverlayLayer({
|
|
2368
|
+
active: isVisible,
|
|
2369
|
+
element: menuRef,
|
|
2370
|
+
baseZIndex: 100
|
|
2371
|
+
});
|
|
805
2372
|
const contentHasSubmenu = computed(() => hasNestedItems(visibleItems.value));
|
|
806
2373
|
const isEmpty = computed(() => visibleItems.value.length === 0);
|
|
2374
|
+
const { actualPlacement, arrowStyle, contentStyle } = useDropdownMenuPortalPosition({
|
|
2375
|
+
props,
|
|
2376
|
+
reference,
|
|
2377
|
+
menuRef,
|
|
2378
|
+
arrowRef,
|
|
2379
|
+
isVisible,
|
|
2380
|
+
placement,
|
|
2381
|
+
restartKey: () => [
|
|
2382
|
+
shouldTeleport.value,
|
|
2383
|
+
teleportTo.value,
|
|
2384
|
+
teleportPositioningKey.value
|
|
2385
|
+
]
|
|
2386
|
+
});
|
|
2387
|
+
const placementSide = computed(() => actualPlacement.value.split("-")[0]);
|
|
807
2388
|
const { focusedPath, focusedIndex, getItemAtPath, focusItem, resetFocus, isItemFocused, moveFocus } = useDropdownMenuNavigation(visibleItems);
|
|
808
2389
|
const submenus = useDropdownSubmenus({
|
|
809
2390
|
focusedPath,
|
|
@@ -815,7 +2396,8 @@ function useDropdownMenu(props, emit = {}) {
|
|
|
815
2396
|
menuId,
|
|
816
2397
|
rootRef,
|
|
817
2398
|
menuRef,
|
|
818
|
-
|
|
2399
|
+
targetRef: targetElement,
|
|
2400
|
+
placement: actualPlacement,
|
|
819
2401
|
focusedPath
|
|
820
2402
|
});
|
|
821
2403
|
const hoverIntent = useDropdownMenuHoverIntent({
|
|
@@ -827,6 +2409,8 @@ function useDropdownMenu(props, emit = {}) {
|
|
|
827
2409
|
props,
|
|
828
2410
|
emit,
|
|
829
2411
|
rootRef,
|
|
2412
|
+
menuRef,
|
|
2413
|
+
targetRef: targetElement,
|
|
830
2414
|
uncontrolledOpen,
|
|
831
2415
|
isDisabled,
|
|
832
2416
|
isOpen,
|
|
@@ -837,7 +2421,8 @@ function useDropdownMenu(props, emit = {}) {
|
|
|
837
2421
|
resetHoverIntent: hoverIntent.resetHoverIntent,
|
|
838
2422
|
focusItem,
|
|
839
2423
|
focusMenu,
|
|
840
|
-
focusTrigger
|
|
2424
|
+
focusTrigger,
|
|
2425
|
+
layer
|
|
841
2426
|
});
|
|
842
2427
|
const { open, close, toggle } = disclosure;
|
|
843
2428
|
const { activateItem, selectItem, openSubmenu, closeSubmenu, focusHoveredItem, onTriggerClick, onTriggerKeydown, onMenuKeydown, onMenuMousemove, onMenuMouseleave } = useDropdownMenuInteractions({
|
|
@@ -855,7 +2440,8 @@ function useDropdownMenu(props, emit = {}) {
|
|
|
855
2440
|
isSubmenuOpeningLeft
|
|
856
2441
|
});
|
|
857
2442
|
const rootClass = computed(() => bem("rp-dropdown-menu", {
|
|
858
|
-
[`placement-${
|
|
2443
|
+
[`placement-${actualPlacement.value}`]: true,
|
|
2444
|
+
target: isExplicitTarget.value,
|
|
859
2445
|
open: isVisible.value,
|
|
860
2446
|
disabled: isDisabled.value
|
|
861
2447
|
}));
|
|
@@ -886,10 +2472,13 @@ function useDropdownMenu(props, emit = {}) {
|
|
|
886
2472
|
toggle
|
|
887
2473
|
}));
|
|
888
2474
|
const { renderedItems, renderContext, getItemProps, getItemSlotProps } = useDropdownMenuRenderItems({
|
|
2475
|
+
props,
|
|
2476
|
+
actualPlacement,
|
|
889
2477
|
items: visibleItems,
|
|
890
2478
|
getItemId,
|
|
891
2479
|
getSubmenuId,
|
|
892
2480
|
getMenuActiveDescendant,
|
|
2481
|
+
getItemElement,
|
|
893
2482
|
isItemFocused,
|
|
894
2483
|
isSubmenuOpen,
|
|
895
2484
|
activateItem,
|
|
@@ -899,9 +2488,49 @@ function useDropdownMenu(props, emit = {}) {
|
|
|
899
2488
|
closeSubmenu,
|
|
900
2489
|
close
|
|
901
2490
|
});
|
|
2491
|
+
watch([isExplicitTarget, targetElement], ([explicit, target], _previous, onCleanup) => {
|
|
2492
|
+
if (!explicit || !target) return;
|
|
2493
|
+
target.addEventListener("click", onTriggerClick);
|
|
2494
|
+
target.addEventListener("keydown", onTriggerKeydown);
|
|
2495
|
+
onCleanup(() => {
|
|
2496
|
+
target.removeEventListener("click", onTriggerClick);
|
|
2497
|
+
target.removeEventListener("keydown", onTriggerKeydown);
|
|
2498
|
+
});
|
|
2499
|
+
}, { flush: "sync" });
|
|
2500
|
+
watch([
|
|
2501
|
+
isExplicitTarget,
|
|
2502
|
+
targetElement,
|
|
2503
|
+
menuId,
|
|
2504
|
+
isVisible,
|
|
2505
|
+
isDisabled
|
|
2506
|
+
], ([explicit, target, id, visible, disabled], _previous, onCleanup) => {
|
|
2507
|
+
if (!explicit || !target) return;
|
|
2508
|
+
const snapshot = new Map([
|
|
2509
|
+
"aria-controls",
|
|
2510
|
+
"aria-expanded",
|
|
2511
|
+
"aria-haspopup",
|
|
2512
|
+
"aria-disabled"
|
|
2513
|
+
].map((attribute) => [attribute, target.getAttribute(attribute)]));
|
|
2514
|
+
if (disabled) {
|
|
2515
|
+
target.removeAttribute("aria-controls");
|
|
2516
|
+
target.removeAttribute("aria-expanded");
|
|
2517
|
+
target.removeAttribute("aria-haspopup");
|
|
2518
|
+
target.setAttribute("aria-disabled", "true");
|
|
2519
|
+
} else {
|
|
2520
|
+
target.setAttribute("aria-controls", id);
|
|
2521
|
+
target.setAttribute("aria-expanded", String(visible));
|
|
2522
|
+
target.setAttribute("aria-haspopup", "menu");
|
|
2523
|
+
target.removeAttribute("aria-disabled");
|
|
2524
|
+
}
|
|
2525
|
+
onCleanup(() => {
|
|
2526
|
+
for (const [attribute, value] of snapshot) if (value == null) target.removeAttribute(attribute);
|
|
2527
|
+
else target.setAttribute(attribute, value);
|
|
2528
|
+
});
|
|
2529
|
+
}, { flush: "sync" });
|
|
902
2530
|
return {
|
|
903
2531
|
rootRef,
|
|
904
2532
|
menuRef,
|
|
2533
|
+
arrowRef,
|
|
905
2534
|
menuId,
|
|
906
2535
|
isVisible,
|
|
907
2536
|
isEmpty,
|
|
@@ -913,6 +2542,16 @@ function useDropdownMenu(props, emit = {}) {
|
|
|
913
2542
|
activeDescendantId,
|
|
914
2543
|
rootClass,
|
|
915
2544
|
contentClass,
|
|
2545
|
+
contentStyle: computed(() => ({
|
|
2546
|
+
...contentStyle.value,
|
|
2547
|
+
zIndex: layer.zIndex.value
|
|
2548
|
+
})),
|
|
2549
|
+
arrowStyle,
|
|
2550
|
+
actualPlacement,
|
|
2551
|
+
placementSide,
|
|
2552
|
+
isTargetMode: isExplicitTarget,
|
|
2553
|
+
teleportTo,
|
|
2554
|
+
shouldTeleport,
|
|
916
2555
|
triggerProps,
|
|
917
2556
|
contentProps,
|
|
918
2557
|
slotProps,
|
|
@@ -931,22 +2570,22 @@ function useDropdownMenu(props, emit = {}) {
|
|
|
931
2570
|
}
|
|
932
2571
|
//#endregion
|
|
933
2572
|
//#region src/components/dropdown-menu/dropdown-menu.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
934
|
-
var t0 = template("
|
|
935
|
-
var t1 = template("
|
|
936
|
-
var t2 = template("<
|
|
937
|
-
var t3 = template("<
|
|
938
|
-
var t4 = template("<
|
|
939
|
-
var t5 = template("<
|
|
2573
|
+
var t0 = template("<span class=rp-dropdown-menu__arrow aria-hidden=true>");
|
|
2574
|
+
var t1 = template("No actions", 2);
|
|
2575
|
+
var t2 = template("<div>");
|
|
2576
|
+
var t3 = template("<span> </span>");
|
|
2577
|
+
var t4 = template("<kbd> ");
|
|
2578
|
+
var t5 = template("<span>");
|
|
940
2579
|
var t6 = template("<span>", 1);
|
|
941
2580
|
//#endregion
|
|
942
2581
|
//#region src/components/dropdown-menu/dropdown-menu.vue
|
|
943
2582
|
var dropdown_menu_default = /* @__PURE__ */ defineVaporComponent({
|
|
944
2583
|
name: "RpDropdownMenu",
|
|
2584
|
+
inheritAttrs: false,
|
|
945
2585
|
__name: "dropdown-menu",
|
|
946
2586
|
props: {
|
|
947
2587
|
id: {},
|
|
948
2588
|
items: { default: () => [] },
|
|
949
|
-
placement: { default: "bottom-start" },
|
|
950
2589
|
open: {
|
|
951
2590
|
type: Boolean,
|
|
952
2591
|
default: void 0
|
|
@@ -959,64 +2598,181 @@ var dropdown_menu_default = /* @__PURE__ */ defineVaporComponent({
|
|
|
959
2598
|
type: Boolean,
|
|
960
2599
|
default: true
|
|
961
2600
|
},
|
|
962
|
-
ariaLabel: {}
|
|
2601
|
+
ariaLabel: {},
|
|
2602
|
+
modal: {
|
|
2603
|
+
type: Boolean,
|
|
2604
|
+
default: false
|
|
2605
|
+
},
|
|
2606
|
+
ignore: {},
|
|
2607
|
+
portal: {
|
|
2608
|
+
type: Boolean,
|
|
2609
|
+
default: void 0
|
|
2610
|
+
},
|
|
2611
|
+
portalTo: {},
|
|
2612
|
+
target: {},
|
|
2613
|
+
placement: { default: "bottom-start" },
|
|
2614
|
+
strategy: { default: "absolute" },
|
|
2615
|
+
offset: {},
|
|
2616
|
+
flip: {
|
|
2617
|
+
type: Boolean,
|
|
2618
|
+
default: true
|
|
2619
|
+
},
|
|
2620
|
+
shift: {
|
|
2621
|
+
type: Boolean,
|
|
2622
|
+
default: true
|
|
2623
|
+
},
|
|
2624
|
+
collisionPadding: { default: 8 },
|
|
2625
|
+
arrow: {
|
|
2626
|
+
type: Boolean,
|
|
2627
|
+
default: false
|
|
2628
|
+
},
|
|
2629
|
+
teleport: {
|
|
2630
|
+
type: Boolean,
|
|
2631
|
+
default: true
|
|
2632
|
+
},
|
|
2633
|
+
teleportTo: {},
|
|
2634
|
+
classNames: {},
|
|
2635
|
+
styles: {}
|
|
963
2636
|
},
|
|
964
|
-
emits: [
|
|
2637
|
+
emits: [
|
|
2638
|
+
"update:open",
|
|
2639
|
+
"select",
|
|
2640
|
+
"pointerDownOutside",
|
|
2641
|
+
"focusOutside",
|
|
2642
|
+
"interactOutside"
|
|
2643
|
+
],
|
|
965
2644
|
setup(__props, { emit: __emit }) {
|
|
966
2645
|
const props = __props;
|
|
967
2646
|
const emit = __emit;
|
|
968
|
-
const { rootRef, menuRef, isVisible, isEmpty, visibleItems, renderContext, rootClass, contentClass, contentProps, slotProps } = useDropdownMenu(props, {
|
|
2647
|
+
const { rootRef, menuRef, arrowRef, isVisible, isEmpty, visibleItems, renderContext, rootClass, contentClass, contentStyle, arrowStyle, actualPlacement, placementSide, isTargetMode, teleportTo, shouldTeleport, contentProps, slotProps } = useDropdownMenu(props, {
|
|
969
2648
|
openChange: (open) => emit("update:open", open),
|
|
970
|
-
select: (item) => emit("select", item)
|
|
2649
|
+
select: (item, event) => emit("select", item, event),
|
|
2650
|
+
pointerDownOutside: (event) => emit("pointerDownOutside", event),
|
|
2651
|
+
focusOutside: (event) => emit("focusOutside", event),
|
|
2652
|
+
interactOutside: (event) => emit("interactOutside", event)
|
|
2653
|
+
});
|
|
2654
|
+
const { getPartAttrs, getRootAttrs } = useStylesApi(props, "root");
|
|
2655
|
+
const state = computed(() => isVisible.value ? "open" : "closed");
|
|
2656
|
+
const rootAttrs = computed(() => getRootAttrs({
|
|
2657
|
+
class: rootClass.value,
|
|
2658
|
+
"data-state": state.value,
|
|
2659
|
+
"data-disabled": presence(props.disabled)
|
|
2660
|
+
}));
|
|
2661
|
+
const publicSlotProps = computed(() => {
|
|
2662
|
+
const partAttrs = getPartAttrs("trigger");
|
|
2663
|
+
return {
|
|
2664
|
+
...slotProps.value,
|
|
2665
|
+
triggerProps: {
|
|
2666
|
+
...slotProps.value.triggerProps,
|
|
2667
|
+
...props.classNames?.trigger !== void 0 ? { class: partAttrs.class } : {},
|
|
2668
|
+
...props.styles?.trigger !== void 0 ? { style: partAttrs.style } : {},
|
|
2669
|
+
"data-state": state.value,
|
|
2670
|
+
"data-disabled": presence(props.disabled)
|
|
2671
|
+
}
|
|
2672
|
+
};
|
|
971
2673
|
});
|
|
2674
|
+
const publicContentProps = computed(() => ({
|
|
2675
|
+
...contentProps.value,
|
|
2676
|
+
...getPartAttrs("content", {
|
|
2677
|
+
class: contentClass.value,
|
|
2678
|
+
style: contentStyle.value
|
|
2679
|
+
}),
|
|
2680
|
+
"data-state": state.value,
|
|
2681
|
+
"data-placement": actualPlacement.value
|
|
2682
|
+
}));
|
|
2683
|
+
const publicRenderContext = computed(() => ({
|
|
2684
|
+
...renderContext,
|
|
2685
|
+
getPublicPartAttrs: getPartAttrs
|
|
2686
|
+
}));
|
|
972
2687
|
const _setTemplateRef = createTemplateRefSetter();
|
|
973
|
-
const
|
|
974
|
-
renderEffect(() =>
|
|
975
|
-
setInsertionState(
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
2688
|
+
const n29 = t6();
|
|
2689
|
+
renderEffect(() => setDynamicProps(n29, [rootAttrs.value]));
|
|
2690
|
+
setInsertionState(n29, null, 0);
|
|
2691
|
+
createIf(() => !unref(isTargetMode), () => {
|
|
2692
|
+
return createSlot("default", { $: [() => publicSlotProps.value] });
|
|
2693
|
+
});
|
|
2694
|
+
setInsertionState(n29, null, 1);
|
|
2695
|
+
createComponent(VaporTeleport, {
|
|
2696
|
+
to: () => unref(teleportTo),
|
|
2697
|
+
disabled: () => !unref(shouldTeleport)
|
|
2698
|
+
}, () => {
|
|
2699
|
+
return createComponent(VaporTransition, { name: "rp-dropdown-menu-content" }, extend(() => {
|
|
2700
|
+
return createIf(() => unref(isVisible), () => {
|
|
2701
|
+
const n26 = t2();
|
|
2702
|
+
renderEffect(() => setDynamicProps(n26, [publicContentProps.value, { "data-side": unref(placementSide) }]));
|
|
2703
|
+
setInsertionState(n26, null, 0);
|
|
2704
|
+
createIf(() => __props.arrow, () => {
|
|
2705
|
+
const n7 = t0();
|
|
2706
|
+
_setTemplateRef(n7, arrowRef, null, "arrowRef");
|
|
2707
|
+
renderEffect(() => {
|
|
2708
|
+
setAttr(n7, "data-side", unref(placementSide));
|
|
2709
|
+
setStyle(n7, unref(arrowStyle));
|
|
2710
|
+
});
|
|
2711
|
+
return n7;
|
|
988
2712
|
});
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
2713
|
+
setInsertionState(n26, null, 1);
|
|
2714
|
+
createIf(() => unref(isEmpty), () => {
|
|
2715
|
+
const n13 = t2();
|
|
2716
|
+
renderEffect(() => setDynamicProps(n13, [unref(getPartAttrs)("empty", { class: "rp-dropdown-menu__empty" })]));
|
|
2717
|
+
setInsertionState(n13, null, 0);
|
|
2718
|
+
createSlot("empty", null, () => {
|
|
2719
|
+
return t1();
|
|
2720
|
+
});
|
|
2721
|
+
return n13;
|
|
2722
|
+
});
|
|
2723
|
+
setInsertionState(n26, null, 2);
|
|
2724
|
+
createComponent(dropdown_menu_items_default, {
|
|
2725
|
+
items: () => unref(visibleItems),
|
|
2726
|
+
context: () => publicRenderContext.value
|
|
2727
|
+
}, { "item": extend((itemSlotProps) => {
|
|
2728
|
+
return [createSlot("item", { $: [() => itemSlotProps] }, () => {
|
|
2729
|
+
const n16 = t3();
|
|
2730
|
+
const x16 = txt(n16);
|
|
2731
|
+
renderEffect(() => {
|
|
2732
|
+
setDynamicProps(n16, [unref(getPartAttrs)("label", { class: "rp-dropdown-menu__label" })]);
|
|
2733
|
+
setText(x16, toDisplayString(itemSlotProps.item.label));
|
|
2734
|
+
});
|
|
2735
|
+
return [n16, createIf(() => itemSlotProps.item.shortcut, () => {
|
|
2736
|
+
const n19 = t4();
|
|
2737
|
+
const x19 = txt(n19);
|
|
2738
|
+
renderEffect(() => {
|
|
2739
|
+
setDynamicProps(n19, [unref(getPartAttrs)("shortcut", { class: "rp-dropdown-menu__shortcut" })]);
|
|
2740
|
+
setText(x19, toDisplayString(itemSlotProps.item.shortcut));
|
|
2741
|
+
});
|
|
2742
|
+
return n19;
|
|
2743
|
+
}, null, 129)];
|
|
2744
|
+
}), createIf(() => itemSlotProps.hasSubmenu, () => {
|
|
2745
|
+
const n23 = t5();
|
|
2746
|
+
renderEffect(() => setDynamicProps(n23, [unref(getPartAttrs)("submenuIndicator", { class: "rp-dropdown-menu__submenu-icon" }), { "aria-hidden": "true" }]));
|
|
2747
|
+
setInsertionState(n23, null, 0);
|
|
2748
|
+
createComponent(unref(chevron_right_default));
|
|
2749
|
+
return n23;
|
|
1005
2750
|
}, null, 129)];
|
|
1006
|
-
}
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
return n21;
|
|
1015
|
-
}, null, 129);
|
|
1016
|
-
}, { _: 8 }));
|
|
1017
|
-
setStaticTemplateRef(n23, rootRef, null, "rootRef");
|
|
1018
|
-
return n23;
|
|
2751
|
+
}, { _: 8 }) });
|
|
2752
|
+
_setTemplateRef(n26, menuRef, null, "menuRef");
|
|
2753
|
+
return n26;
|
|
2754
|
+
}, null, 129);
|
|
2755
|
+
}, { _: 8 }));
|
|
2756
|
+
});
|
|
2757
|
+
setStaticTemplateRef(n29, rootRef, null, "rootRef");
|
|
2758
|
+
return n29;
|
|
1019
2759
|
}
|
|
1020
2760
|
});
|
|
1021
2761
|
//#endregion
|
|
1022
|
-
|
|
2762
|
+
//#region src/components/dropdown-menu/types.ts
|
|
2763
|
+
var dropdownMenuParts = [
|
|
2764
|
+
"root",
|
|
2765
|
+
"trigger",
|
|
2766
|
+
"content",
|
|
2767
|
+
"item",
|
|
2768
|
+
"label",
|
|
2769
|
+
"shortcut",
|
|
2770
|
+
"submenu",
|
|
2771
|
+
"submenuIndicator",
|
|
2772
|
+
"empty"
|
|
2773
|
+
];
|
|
2774
|
+
//#endregion
|
|
2775
|
+
//#region src/components/dropdown-menu/index.ts
|
|
2776
|
+
var DropdownMenuItem = dropdown_menu_item_default;
|
|
2777
|
+
//#endregion
|
|
2778
|
+
export { dropdown_menu_content_default as _, dropdown_menu_trigger_default as a, dropdown_menu_sub_default as c, dropdown_menu_radio_item_default as d, dropdown_menu_radio_group_default as f, dropdown_menu_context_trigger_default as g, dropdown_menu_item_indicator_default as h, useDropdownMenu as i, dropdown_menu_separator_default as l, dropdown_menu_label_default as m, dropdownMenuParts as n, dropdown_menu_sub_trigger_default as o, dropdown_menu_portal_default as p, dropdown_menu_default as r, dropdown_menu_sub_content_default as s, DropdownMenuItem as t, dropdown_menu_root_default as u, dropdown_menu_checkbox_item_default as v };
|