@expcat/tigercat-vue 2.0.0 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-KE6RGD4Y.mjs → chunk-26OI3TEA.mjs} +25 -55
- package/dist/{chunk-A7QIMKWQ.mjs → chunk-2T2NEZRZ.mjs} +1 -1
- package/dist/chunk-4HUYX5WW.mjs +239 -0
- package/dist/{chunk-IDUEWMWN.mjs → chunk-7KCOF5US.mjs} +61 -62
- package/dist/{chunk-RHV6DWY6.mjs → chunk-7VHXZX7Y.mjs} +20 -28
- package/dist/{chunk-IZRQ7LB3.mjs → chunk-AU6IC6K7.mjs} +1 -1
- package/dist/{chunk-O6BN5R6J.mjs → chunk-AUMTHL6N.mjs} +1 -1
- package/dist/{chunk-MNSVJBNH.mjs → chunk-B4MDHE3L.mjs} +18 -4
- package/dist/{chunk-N7LWKAYS.mjs → chunk-BZ6MVFV7.mjs} +190 -174
- package/dist/{chunk-TK3QU367.mjs → chunk-DI6RRAGQ.mjs} +3 -3
- package/dist/{chunk-4ZZYQITT.mjs → chunk-FWO7RNGI.mjs} +249 -220
- package/dist/{chunk-EZZD4OCV.mjs → chunk-GS4SV2HK.mjs} +1 -1
- package/dist/{chunk-EUSODI5E.mjs → chunk-HKYRRQS7.mjs} +11 -5
- package/dist/{chunk-D4APFWWS.mjs → chunk-IPGPLFUZ.mjs} +18 -4
- package/dist/{chunk-JKPXJ3VB.mjs → chunk-JALHMWKW.mjs} +14 -6
- package/dist/{chunk-OHPXOLNB.mjs → chunk-K3WTQBE4.mjs} +40 -15
- package/dist/{chunk-VMYV5EWI.mjs → chunk-KICZSLOX.mjs} +9 -8
- package/dist/{chunk-SK2QJ66E.mjs → chunk-KROVW4AW.mjs} +19 -59
- package/dist/{chunk-AQMPCLX7.mjs → chunk-NMAJD353.mjs} +248 -253
- package/dist/{chunk-4BO6JNA6.mjs → chunk-OAPIT53X.mjs} +4 -4
- package/dist/{chunk-SYRRMZT2.mjs → chunk-OQVGB7X6.mjs} +43 -29
- package/dist/{chunk-DWK5GUMB.mjs → chunk-OTGGPXDT.mjs} +26 -19
- package/dist/{chunk-DWPZRG7A.mjs → chunk-PGF7HLLR.mjs} +43 -39
- package/dist/chunk-Q7Y22OFX.mjs +330 -0
- package/dist/{chunk-NP6DZQ3O.mjs → chunk-RID7A5V7.mjs} +1 -1
- package/dist/{chunk-DKMKJZ7A.mjs → chunk-S5RTMAQN.mjs} +1 -1
- package/dist/{chunk-SJ7W5I5H.mjs → chunk-TCV6YPH5.mjs} +1 -1
- package/dist/{chunk-LFENEILY.mjs → chunk-WC5MKASU.mjs} +110 -99
- package/dist/components/ActivityFeed.mjs +3 -3
- package/dist/components/AutoComplete.mjs +2 -1
- package/dist/components/BackTop.d.mts +2 -2
- package/dist/components/Cascader.mjs +2 -1
- package/dist/components/ColorPicker.mjs +2 -1
- package/dist/components/CropUpload.mjs +3 -3
- package/dist/components/DataExport.mjs +3 -3
- package/dist/components/DataTableWithToolbar.mjs +6 -6
- package/dist/components/DatePicker.mjs +2 -1
- package/dist/components/DonutChart.d.mts +1 -1
- package/dist/components/Drawer.d.mts +2 -2
- package/dist/components/Drawer.mjs +2 -2
- package/dist/components/Dropdown.d.mts +2 -2
- package/dist/components/Dropdown.mjs +2 -2
- package/dist/components/FloatButton.d.mts +1 -1
- package/dist/components/FormItem.mjs +2 -1
- package/dist/components/Image.mjs +3 -3
- package/dist/components/Loading.mjs +2 -2
- package/dist/components/Mentions.mjs +2 -1
- package/dist/components/Menu.mjs +2 -2
- package/dist/components/Modal.d.mts +1 -1
- package/dist/components/Modal.mjs +2 -2
- package/dist/components/NotificationCenter.mjs +3 -3
- package/dist/components/PieChart.d.mts +1 -1
- package/dist/components/Popconfirm.d.mts +2 -2
- package/dist/components/Popconfirm.mjs +3 -3
- package/dist/components/Popover.d.mts +2 -2
- package/dist/components/Popover.mjs +3 -3
- package/dist/components/Select.mjs +2 -1
- package/dist/components/Spotlight.d.mts +1 -1
- package/dist/components/Spotlight.mjs +2 -2
- package/dist/components/Table.mjs +3 -2
- package/dist/components/TimePicker.mjs +2 -1
- package/dist/components/Tooltip.d.mts +2 -2
- package/dist/components/Tooltip.mjs +3 -3
- package/dist/components/Tour.mjs +2 -2
- package/dist/components/TreeSelect.mjs +2 -1
- package/dist/index.mjs +4 -2
- package/package.json +2 -2
- package/dist/chunk-BDTPFPSB.mjs +0 -163
- package/dist/chunk-EWUHEW6W.mjs +0 -219
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
useVueFloating
|
|
5
|
-
} from "./chunk-BDTPFPSB.mjs";
|
|
2
|
+
useVueAnchoredOverlay
|
|
3
|
+
} from "./chunk-Q7Y22OFX.mjs";
|
|
6
4
|
|
|
7
5
|
// src/utils/use-floating-popup.ts
|
|
8
|
-
import { computed, ref, watch
|
|
6
|
+
import { computed, ref, watch } from "vue";
|
|
9
7
|
import {
|
|
10
|
-
getTransformOrigin,
|
|
11
|
-
FLOATING_OVERLAY_Z_INDEX,
|
|
12
8
|
buildTriggerHandlerMap,
|
|
13
9
|
restoreFocus
|
|
14
10
|
} from "@expcat/tigercat-core";
|
|
@@ -47,57 +43,28 @@ function useFloatingPopup(options) {
|
|
|
47
43
|
setVisible(false);
|
|
48
44
|
restoreTriggerFocus();
|
|
49
45
|
};
|
|
50
|
-
const {
|
|
51
|
-
x,
|
|
52
|
-
y,
|
|
53
|
-
placement: actualPlacement
|
|
54
|
-
} = useVueFloating({
|
|
55
|
-
referenceRef: triggerRef,
|
|
56
|
-
floatingRef,
|
|
57
|
-
enabled: currentVisible,
|
|
58
|
-
placement: props.placement ?? "top",
|
|
59
|
-
offset: props.offset ?? 8
|
|
60
|
-
});
|
|
61
|
-
let outsideClickCleanup;
|
|
62
|
-
let escapeKeyCleanup;
|
|
63
46
|
const effectiveTrigger = computed(
|
|
64
47
|
() => multiTrigger ? props.trigger ?? "click" : "click"
|
|
65
48
|
);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
if (visible && trigger !== "manual") {
|
|
82
|
-
escapeKeyCleanup = useVueEscapeKey({
|
|
83
|
-
enabled: currentVisible,
|
|
84
|
-
onEscape: closeAndRestoreFocus
|
|
85
|
-
});
|
|
49
|
+
const overlay = useVueAnchoredOverlay({
|
|
50
|
+
enabled: currentVisible,
|
|
51
|
+
referenceRef: triggerRef,
|
|
52
|
+
floatingRef,
|
|
53
|
+
containerRef,
|
|
54
|
+
placement: props.placement ?? "top",
|
|
55
|
+
offset: props.offset ?? 8,
|
|
56
|
+
dismissOnOutside: computed(() => effectiveTrigger.value === "click"),
|
|
57
|
+
dismissOnEscape: computed(() => effectiveTrigger.value !== "manual"),
|
|
58
|
+
onDismiss: (reason) => {
|
|
59
|
+
if (reason === "escape") {
|
|
60
|
+
closeAndRestoreFocus();
|
|
61
|
+
} else {
|
|
62
|
+
setVisible(false);
|
|
86
63
|
}
|
|
87
|
-
}
|
|
88
|
-
{ immediate: true }
|
|
89
|
-
);
|
|
90
|
-
onBeforeUnmount(() => {
|
|
91
|
-
outsideClickCleanup?.();
|
|
92
|
-
escapeKeyCleanup?.();
|
|
64
|
+
}
|
|
93
65
|
});
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
left: `${x.value}px`,
|
|
97
|
-
top: `${y.value}px`,
|
|
98
|
-
transformOrigin: getTransformOrigin(actualPlacement.value),
|
|
99
|
-
zIndex: FLOATING_OVERLAY_Z_INDEX
|
|
100
|
-
}));
|
|
66
|
+
const x = overlay.x;
|
|
67
|
+
const y = overlay.y;
|
|
101
68
|
const handleToggle = () => {
|
|
102
69
|
if (!props.disabled) setVisible(!currentVisible.value);
|
|
103
70
|
};
|
|
@@ -125,8 +92,11 @@ function useFloatingPopup(options) {
|
|
|
125
92
|
floatingRef,
|
|
126
93
|
x,
|
|
127
94
|
y,
|
|
128
|
-
actualPlacement,
|
|
129
|
-
floatingStyles,
|
|
95
|
+
actualPlacement: overlay.placement,
|
|
96
|
+
floatingStyles: overlay.floatingStyles,
|
|
97
|
+
floatingClasses: overlay.floatingClasses,
|
|
98
|
+
positioned: overlay.positioned,
|
|
99
|
+
overlayTarget: overlay.target,
|
|
130
100
|
triggerHandlers,
|
|
131
101
|
closeAndRestoreFocus
|
|
132
102
|
};
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import {
|
|
2
|
+
renderVueOverlayTeleport,
|
|
3
|
+
useVueAnchoredOverlay
|
|
4
|
+
} from "./chunk-Q7Y22OFX.mjs";
|
|
5
|
+
|
|
6
|
+
// src/components/ColorPicker.ts
|
|
7
|
+
import { defineComponent, h, ref, computed, watch } from "vue";
|
|
8
|
+
import {
|
|
9
|
+
colorPickerBaseClasses,
|
|
10
|
+
getColorPickerTriggerClasses,
|
|
11
|
+
colorPickerPanelClasses,
|
|
12
|
+
colorPickerInputClasses,
|
|
13
|
+
colorPickerPresetClasses,
|
|
14
|
+
hexToRgb,
|
|
15
|
+
rgbToHex,
|
|
16
|
+
rgbToHsv,
|
|
17
|
+
hsvToRgb,
|
|
18
|
+
formatColorString,
|
|
19
|
+
parseColorInput,
|
|
20
|
+
classNames,
|
|
21
|
+
coerceClassValue
|
|
22
|
+
} from "@expcat/tigercat-core";
|
|
23
|
+
var ColorPicker = defineComponent({
|
|
24
|
+
name: "TigerColorPicker",
|
|
25
|
+
props: {
|
|
26
|
+
modelValue: { type: String, default: "#2563eb" },
|
|
27
|
+
disabled: { type: Boolean, default: false },
|
|
28
|
+
size: { type: String, default: "md" },
|
|
29
|
+
showAlpha: { type: Boolean, default: false },
|
|
30
|
+
format: { type: String, default: "hex" },
|
|
31
|
+
presets: { type: Array, default: void 0 }
|
|
32
|
+
},
|
|
33
|
+
emits: ["update:modelValue", "change"],
|
|
34
|
+
setup(props, { emit, attrs }) {
|
|
35
|
+
const isOpen = ref(false);
|
|
36
|
+
const alpha = ref(1);
|
|
37
|
+
const containerRef = ref(null);
|
|
38
|
+
const triggerRef = ref(null);
|
|
39
|
+
const panelRef = ref(null);
|
|
40
|
+
const overlay = useVueAnchoredOverlay({
|
|
41
|
+
enabled: isOpen,
|
|
42
|
+
referenceRef: triggerRef,
|
|
43
|
+
floatingRef: panelRef,
|
|
44
|
+
containerRef,
|
|
45
|
+
placement: "bottom-start",
|
|
46
|
+
offset: 4,
|
|
47
|
+
dismissOnOutside: true,
|
|
48
|
+
dismissOnEscape: true,
|
|
49
|
+
restoreFocusOnDismiss: true,
|
|
50
|
+
onDismiss: closePanel
|
|
51
|
+
});
|
|
52
|
+
const rgb = computed(() => hexToRgb(props.modelValue));
|
|
53
|
+
const hsv = computed(() => rgbToHsv(rgb.value.r, rgb.value.g, rgb.value.b));
|
|
54
|
+
const displayValue = computed(
|
|
55
|
+
() => formatColorString(
|
|
56
|
+
rgb.value.r,
|
|
57
|
+
rgb.value.g,
|
|
58
|
+
rgb.value.b,
|
|
59
|
+
props.format,
|
|
60
|
+
props.showAlpha ? alpha.value : void 0
|
|
61
|
+
)
|
|
62
|
+
);
|
|
63
|
+
const swatchColor = computed(
|
|
64
|
+
() => props.showAlpha ? `rgba(${rgb.value.r}, ${rgb.value.g}, ${rgb.value.b}, ${alpha.value})` : props.modelValue
|
|
65
|
+
);
|
|
66
|
+
const inputValue = ref(displayValue.value);
|
|
67
|
+
watch(displayValue, (v) => {
|
|
68
|
+
inputValue.value = v;
|
|
69
|
+
});
|
|
70
|
+
function togglePanel() {
|
|
71
|
+
if (props.disabled) return;
|
|
72
|
+
isOpen.value = !isOpen.value;
|
|
73
|
+
}
|
|
74
|
+
function closePanel() {
|
|
75
|
+
isOpen.value = false;
|
|
76
|
+
}
|
|
77
|
+
function handleTriggerKeydown(e) {
|
|
78
|
+
if (props.disabled) return;
|
|
79
|
+
if (e.key === "Enter" || e.key === " " || e.key === "Spacebar") {
|
|
80
|
+
e.preventDefault();
|
|
81
|
+
isOpen.value = !isOpen.value;
|
|
82
|
+
} else if (e.key === "Escape" && isOpen.value) {
|
|
83
|
+
isOpen.value = false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function handleAlphaChange(e) {
|
|
87
|
+
alpha.value = Number(e.target.value) / 100;
|
|
88
|
+
}
|
|
89
|
+
function handleHueChange(e) {
|
|
90
|
+
const hue = Number(e.target.value);
|
|
91
|
+
const { r, g, b } = hsvToRgb(hue, hsv.value.s, hsv.value.v);
|
|
92
|
+
const hex = rgbToHex(r, g, b);
|
|
93
|
+
emit("update:modelValue", hex);
|
|
94
|
+
emit("change", hex);
|
|
95
|
+
}
|
|
96
|
+
function handleInputChange(e) {
|
|
97
|
+
const val = e.target.value;
|
|
98
|
+
inputValue.value = val;
|
|
99
|
+
const hex = parseColorInput(val);
|
|
100
|
+
if (hex) {
|
|
101
|
+
emit("update:modelValue", hex);
|
|
102
|
+
emit("change", hex);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function handlePresetClick(color) {
|
|
106
|
+
emit("update:modelValue", color);
|
|
107
|
+
emit("change", color);
|
|
108
|
+
}
|
|
109
|
+
function handlePresetKeydown(e, color) {
|
|
110
|
+
if (e.key === "Enter" || e.key === " " || e.key === "Spacebar") {
|
|
111
|
+
e.preventDefault();
|
|
112
|
+
handlePresetClick(color);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return () => h(
|
|
116
|
+
"div",
|
|
117
|
+
{
|
|
118
|
+
ref: containerRef,
|
|
119
|
+
class: classNames(colorPickerBaseClasses, coerceClassValue(attrs.class))
|
|
120
|
+
},
|
|
121
|
+
[
|
|
122
|
+
// Color trigger swatch
|
|
123
|
+
h("div", {
|
|
124
|
+
ref: triggerRef,
|
|
125
|
+
class: getColorPickerTriggerClasses(props.size, props.disabled),
|
|
126
|
+
style: { backgroundColor: swatchColor.value },
|
|
127
|
+
role: "button",
|
|
128
|
+
"aria-label": "Pick color",
|
|
129
|
+
"aria-haspopup": "dialog",
|
|
130
|
+
"aria-expanded": isOpen.value,
|
|
131
|
+
"aria-disabled": props.disabled || void 0,
|
|
132
|
+
tabindex: props.disabled ? -1 : 0,
|
|
133
|
+
onClick: togglePanel,
|
|
134
|
+
onKeydown: handleTriggerKeydown
|
|
135
|
+
}),
|
|
136
|
+
// Panel
|
|
137
|
+
isOpen.value ? renderVueOverlayTeleport(
|
|
138
|
+
h(
|
|
139
|
+
"div",
|
|
140
|
+
{
|
|
141
|
+
ref: panelRef,
|
|
142
|
+
class: classNames(colorPickerPanelClasses, overlay.floatingClasses.value),
|
|
143
|
+
style: overlay.floatingStyles.value,
|
|
144
|
+
"data-positioned": overlay.positioned.value
|
|
145
|
+
},
|
|
146
|
+
[
|
|
147
|
+
// Hue slider
|
|
148
|
+
h("div", { class: "mb-2" }, [
|
|
149
|
+
h(
|
|
150
|
+
"label",
|
|
151
|
+
{ class: "block text-xs text-[var(--tiger-text-muted,#6b7280)] mb-1" },
|
|
152
|
+
"Hue"
|
|
153
|
+
),
|
|
154
|
+
h("input", {
|
|
155
|
+
type: "range",
|
|
156
|
+
min: 0,
|
|
157
|
+
max: 360,
|
|
158
|
+
value: hsv.value.h,
|
|
159
|
+
class: "w-full h-2 rounded-full cursor-pointer accent-[var(--tiger-primary,#2563eb)]",
|
|
160
|
+
"aria-label": "Hue",
|
|
161
|
+
onInput: handleHueChange
|
|
162
|
+
})
|
|
163
|
+
]),
|
|
164
|
+
// Alpha slider
|
|
165
|
+
props.showAlpha ? h("div", { class: "mb-2" }, [
|
|
166
|
+
h(
|
|
167
|
+
"label",
|
|
168
|
+
{ class: "block text-xs text-[var(--tiger-text-muted,#6b7280)] mb-1" },
|
|
169
|
+
"Alpha"
|
|
170
|
+
),
|
|
171
|
+
h("input", {
|
|
172
|
+
type: "range",
|
|
173
|
+
min: 0,
|
|
174
|
+
max: 100,
|
|
175
|
+
value: Math.round(alpha.value * 100),
|
|
176
|
+
class: "w-full h-2 rounded-full cursor-pointer accent-[var(--tiger-primary,#2563eb)]",
|
|
177
|
+
"aria-label": "Alpha",
|
|
178
|
+
onInput: handleAlphaChange
|
|
179
|
+
})
|
|
180
|
+
]) : null,
|
|
181
|
+
// Color value input (rendered in the selected format)
|
|
182
|
+
h("div", { class: "mb-2" }, [
|
|
183
|
+
h(
|
|
184
|
+
"label",
|
|
185
|
+
{
|
|
186
|
+
class: "block text-xs text-[var(--tiger-text-muted,#6b7280)] mb-1 uppercase"
|
|
187
|
+
},
|
|
188
|
+
props.format
|
|
189
|
+
),
|
|
190
|
+
h("input", {
|
|
191
|
+
type: "text",
|
|
192
|
+
class: colorPickerInputClasses,
|
|
193
|
+
value: inputValue.value,
|
|
194
|
+
"aria-label": "Color value",
|
|
195
|
+
onInput: handleInputChange
|
|
196
|
+
})
|
|
197
|
+
]),
|
|
198
|
+
// Preview
|
|
199
|
+
h("div", { class: "flex items-center gap-2 mb-2" }, [
|
|
200
|
+
h("div", {
|
|
201
|
+
class: "w-8 h-8 rounded border border-[var(--tiger-border,#d1d5db)]",
|
|
202
|
+
style: { backgroundColor: swatchColor.value },
|
|
203
|
+
"aria-label": "Color preview"
|
|
204
|
+
}),
|
|
205
|
+
h(
|
|
206
|
+
"span",
|
|
207
|
+
{ class: "text-xs font-mono text-[var(--tiger-text,#111827)]" },
|
|
208
|
+
displayValue.value
|
|
209
|
+
)
|
|
210
|
+
]),
|
|
211
|
+
// Presets
|
|
212
|
+
props.presets && props.presets.length > 0 ? h("div", { class: "flex flex-wrap gap-1" }, [
|
|
213
|
+
...props.presets.map(
|
|
214
|
+
(color) => h("div", {
|
|
215
|
+
key: color,
|
|
216
|
+
class: colorPickerPresetClasses,
|
|
217
|
+
style: { backgroundColor: color },
|
|
218
|
+
role: "button",
|
|
219
|
+
tabindex: 0,
|
|
220
|
+
"aria-label": `Select ${color}`,
|
|
221
|
+
onClick: () => handlePresetClick(color),
|
|
222
|
+
onKeydown: (e) => handlePresetKeydown(e, color)
|
|
223
|
+
})
|
|
224
|
+
)
|
|
225
|
+
]) : null
|
|
226
|
+
]
|
|
227
|
+
),
|
|
228
|
+
overlay.target.value
|
|
229
|
+
) : null
|
|
230
|
+
]
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
var ColorPicker_default = ColorPicker;
|
|
235
|
+
|
|
236
|
+
export {
|
|
237
|
+
ColorPicker,
|
|
238
|
+
ColorPicker_default
|
|
239
|
+
};
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
renderVueOverlayTeleport,
|
|
3
|
+
useVueAnchoredOverlay
|
|
4
|
+
} from "./chunk-Q7Y22OFX.mjs";
|
|
1
5
|
import {
|
|
2
6
|
useTigerConfig
|
|
3
7
|
} from "./chunk-UOJOJBEU.mjs";
|
|
4
8
|
|
|
5
9
|
// src/components/AutoComplete.ts
|
|
6
|
-
import {
|
|
7
|
-
defineComponent,
|
|
8
|
-
h,
|
|
9
|
-
ref,
|
|
10
|
-
computed,
|
|
11
|
-
watch,
|
|
12
|
-
onBeforeUnmount,
|
|
13
|
-
nextTick
|
|
14
|
-
} from "vue";
|
|
10
|
+
import { defineComponent, h, ref, computed, watch, nextTick } from "vue";
|
|
15
11
|
import {
|
|
16
12
|
resolveLocaleText,
|
|
17
13
|
mergeTigerLocale,
|
|
@@ -119,6 +115,20 @@ var AutoComplete = defineComponent({
|
|
|
119
115
|
const activeIndex = ref(-1);
|
|
120
116
|
const containerRef = ref(null);
|
|
121
117
|
const inputRef = ref(null);
|
|
118
|
+
const dropdownRef = ref(null);
|
|
119
|
+
const overlay = useVueAnchoredOverlay({
|
|
120
|
+
enabled: isOpen,
|
|
121
|
+
referenceRef: inputRef,
|
|
122
|
+
floatingRef: dropdownRef,
|
|
123
|
+
containerRef,
|
|
124
|
+
placement: "bottom-start",
|
|
125
|
+
offset: 4,
|
|
126
|
+
matchReferenceWidth: true,
|
|
127
|
+
dismissOnOutside: true,
|
|
128
|
+
dismissOnEscape: true,
|
|
129
|
+
restoreFocusOnDismiss: true,
|
|
130
|
+
onDismiss: closeDropdown
|
|
131
|
+
});
|
|
122
132
|
const filteredOptions = computed(
|
|
123
133
|
() => filterAutoCompleteOptions(props.options, inputValue.value, props.filterOption)
|
|
124
134
|
);
|
|
@@ -234,21 +244,6 @@ var AutoComplete = defineComponent({
|
|
|
234
244
|
break;
|
|
235
245
|
}
|
|
236
246
|
}
|
|
237
|
-
function handleClickOutside(e) {
|
|
238
|
-
if (containerRef.value && !containerRef.value.contains(e.target)) {
|
|
239
|
-
closeDropdown();
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
watch(isOpen, (val) => {
|
|
243
|
-
if (val) {
|
|
244
|
-
document.addEventListener("click", handleClickOutside);
|
|
245
|
-
} else {
|
|
246
|
-
document.removeEventListener("click", handleClickOutside);
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
onBeforeUnmount(() => {
|
|
250
|
-
document.removeEventListener("click", handleClickOutside);
|
|
251
|
-
});
|
|
252
247
|
return () => {
|
|
253
248
|
const containerClasses = classNames(autoCompleteBaseClasses, coerceClassValue(attrs.class));
|
|
254
249
|
const options = filteredOptions.value;
|
|
@@ -290,45 +285,49 @@ var AutoComplete = defineComponent({
|
|
|
290
285
|
[ClearIcon]
|
|
291
286
|
) : null,
|
|
292
287
|
// Dropdown
|
|
293
|
-
isOpen.value && options.length > 0 ?
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
288
|
+
isOpen.value && (options.length > 0 || inputValue.value) ? renderVueOverlayTeleport(
|
|
289
|
+
h(
|
|
290
|
+
"div",
|
|
291
|
+
{
|
|
292
|
+
ref: dropdownRef,
|
|
293
|
+
...options.length > 0 ? getPickerListboxAria({ id: listboxId }) : {},
|
|
294
|
+
class: classNames(
|
|
295
|
+
autoCompleteDropdownClasses,
|
|
296
|
+
options.length === 0 && autoCompleteEmptyStateClasses,
|
|
297
|
+
overlay.floatingClasses.value
|
|
298
|
+
),
|
|
299
|
+
style: overlay.floatingStyles.value,
|
|
300
|
+
"data-positioned": overlay.positioned.value
|
|
301
|
+
},
|
|
302
|
+
options.length > 0 ? options.map(
|
|
303
|
+
(option, index) => h(
|
|
304
|
+
"div",
|
|
305
|
+
{
|
|
306
|
+
id: getPickerOptionId(listboxId, index),
|
|
307
|
+
...getPickerOptionAria({
|
|
308
|
+
selected: String(option.value) === String(props.modelValue),
|
|
309
|
+
disabled: !!option.disabled
|
|
310
|
+
}),
|
|
311
|
+
class: getAutoCompleteOptionClasses(
|
|
312
|
+
String(option.value) === String(props.modelValue),
|
|
313
|
+
!!option.disabled,
|
|
314
|
+
props.size
|
|
315
|
+
),
|
|
316
|
+
onMousedown: (e) => e.preventDefault(),
|
|
317
|
+
onClick: () => handleSelect(option),
|
|
318
|
+
onMouseenter: () => {
|
|
319
|
+
activeIndex.value = index;
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
option.label
|
|
323
|
+
)
|
|
324
|
+
) : resolveLocaleText(
|
|
325
|
+
"No matches found",
|
|
326
|
+
props.emptyText,
|
|
327
|
+
mergedLocale.value?.common?.emptyText
|
|
320
328
|
)
|
|
321
|
-
)
|
|
322
|
-
|
|
323
|
-
"div",
|
|
324
|
-
{
|
|
325
|
-
class: classNames(autoCompleteDropdownClasses, autoCompleteEmptyStateClasses)
|
|
326
|
-
},
|
|
327
|
-
resolveLocaleText(
|
|
328
|
-
"No matches found",
|
|
329
|
-
props.emptyText,
|
|
330
|
-
mergedLocale.value?.common?.emptyText
|
|
331
|
-
)
|
|
329
|
+
),
|
|
330
|
+
overlay.target.value
|
|
332
331
|
) : null
|
|
333
332
|
]
|
|
334
333
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
2
|
+
renderVueOverlayTeleport,
|
|
3
|
+
useVueAnchoredOverlay
|
|
4
|
+
} from "./chunk-Q7Y22OFX.mjs";
|
|
5
5
|
|
|
6
6
|
// src/components/Menu.ts
|
|
7
7
|
import {
|
|
@@ -26,8 +26,6 @@ import {
|
|
|
26
26
|
getMenuItemIndent,
|
|
27
27
|
getSubMenuTitleClasses,
|
|
28
28
|
getSubMenuExpandIconClasses,
|
|
29
|
-
getSubmenuPopupZIndex,
|
|
30
|
-
getTransformOrigin,
|
|
31
29
|
filterMenuItems,
|
|
32
30
|
isKeySelected,
|
|
33
31
|
isKeyOpen,
|
|
@@ -679,16 +677,18 @@ var SubMenu = defineComponent({
|
|
|
679
677
|
const popupPlacement = computed(
|
|
680
678
|
() => menuContext?.mode.value === "horizontal" && props.level === 0 ? "bottom-start" : "right-start"
|
|
681
679
|
);
|
|
682
|
-
const {
|
|
683
|
-
x: popupX,
|
|
684
|
-
y: popupY,
|
|
685
|
-
placement: currentPopupPlacement
|
|
686
|
-
} = useVueFloating({
|
|
680
|
+
const overlay = useVueAnchoredOverlay({
|
|
687
681
|
referenceRef: titleEl,
|
|
688
682
|
floatingRef: popupEl,
|
|
689
|
-
enabled: computed(() =>
|
|
683
|
+
enabled: computed(() => isPopup.value && isExpanded.value),
|
|
690
684
|
placement: popupPlacement.value,
|
|
691
|
-
offset: 4
|
|
685
|
+
offset: 4,
|
|
686
|
+
portal: popupPortal,
|
|
687
|
+
dismissOnEscape: true,
|
|
688
|
+
onDismiss: () => {
|
|
689
|
+
isOpenByKeyboard.value = false;
|
|
690
|
+
isHovered.value = false;
|
|
691
|
+
}
|
|
692
692
|
});
|
|
693
693
|
const disposeHeightTransition = () => {
|
|
694
694
|
heightTransitionController?.dispose();
|
|
@@ -748,7 +748,6 @@ var SubMenu = defineComponent({
|
|
|
748
748
|
if (menuContext.mode.value === "inline") return submenuContentInlineClasses;
|
|
749
749
|
return submenuContentVerticalClasses;
|
|
750
750
|
});
|
|
751
|
-
const popupZIndex = computed(() => isPopup.value ? getSubmenuPopupZIndex(props.level) : {});
|
|
752
751
|
const handleTitleClick = () => {
|
|
753
752
|
if (!menuContext || props.disabled) return;
|
|
754
753
|
if (menuContext.mode.value === "horizontal") return;
|
|
@@ -933,23 +932,16 @@ var SubMenu = defineComponent({
|
|
|
933
932
|
titleChildren
|
|
934
933
|
);
|
|
935
934
|
const popupContentNode = () => {
|
|
936
|
-
const popupStyle = popupPortal.value ? {
|
|
937
|
-
display: isExpanded.value ? "block" : "none",
|
|
938
|
-
position: "absolute",
|
|
939
|
-
left: `${popupX.value}px`,
|
|
940
|
-
top: `${popupY.value}px`,
|
|
941
|
-
transformOrigin: getTransformOrigin(currentPopupPlacement.value),
|
|
942
|
-
...popupZIndex.value
|
|
943
|
-
} : {
|
|
944
|
-
display: isExpanded.value ? "block" : "none",
|
|
945
|
-
...popupZIndex.value
|
|
946
|
-
};
|
|
947
935
|
const node = h(
|
|
948
936
|
"ul",
|
|
949
937
|
{
|
|
950
|
-
ref:
|
|
951
|
-
class: contentClasses.value,
|
|
952
|
-
style:
|
|
938
|
+
ref: popupEl,
|
|
939
|
+
class: classNames(contentClasses.value, overlay.floatingClasses.value),
|
|
940
|
+
style: {
|
|
941
|
+
...overlay.floatingStyles.value,
|
|
942
|
+
display: isExpanded.value ? "block" : "none"
|
|
943
|
+
},
|
|
944
|
+
"data-positioned": overlay.positioned.value,
|
|
953
945
|
role: "menu",
|
|
954
946
|
"aria-hidden": isExpanded.value ? void 0 : "true",
|
|
955
947
|
onMouseenter: popupPortal.value ? handleMouseEnter : void 0,
|
|
@@ -958,7 +950,7 @@ var SubMenu = defineComponent({
|
|
|
958
950
|
},
|
|
959
951
|
withChildLevel(slots.default?.())
|
|
960
952
|
);
|
|
961
|
-
return popupPortal.value
|
|
953
|
+
return renderVueOverlayTeleport(node, overlay.target.value, !popupPortal.value);
|
|
962
954
|
};
|
|
963
955
|
const contentNode = isPopup.value ? popupContentNode() : hasRenderedInline.value ? h(
|
|
964
956
|
"div",
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
useVueBodyScrollLock,
|
|
4
4
|
useVueEscapeKey,
|
|
5
5
|
useVueFocusTrap
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-Q7Y22OFX.mjs";
|
|
7
7
|
import {
|
|
8
8
|
useTigerConfig
|
|
9
9
|
} from "./chunk-UOJOJBEU.mjs";
|
|
@@ -221,6 +221,7 @@ var Drawer = defineComponent({
|
|
|
221
221
|
const hasBeenOpened = ref(false);
|
|
222
222
|
const deferredRendered = ref(props.open);
|
|
223
223
|
const dialogRef = ref(null);
|
|
224
|
+
const rootRef = ref(null);
|
|
224
225
|
const closeButtonRef = ref(null);
|
|
225
226
|
const previousActiveElement = ref(null);
|
|
226
227
|
let touchStartPoint = null;
|
|
@@ -276,11 +277,12 @@ var Drawer = defineComponent({
|
|
|
276
277
|
const escapeEnabled = computed(() => props.open);
|
|
277
278
|
let cleanupEscape;
|
|
278
279
|
useVueBodyScrollLock(escapeEnabled);
|
|
279
|
-
useVueFocusTrap({ enabled: escapeEnabled, containerRef:
|
|
280
|
+
useVueFocusTrap({ enabled: escapeEnabled, containerRef: rootRef });
|
|
280
281
|
onMounted(() => {
|
|
281
282
|
cleanupEscape = useVueEscapeKey({
|
|
282
283
|
enabled: escapeEnabled,
|
|
283
|
-
onEscape: handleClose
|
|
284
|
+
onEscape: handleClose,
|
|
285
|
+
layerRef: rootRef
|
|
284
286
|
});
|
|
285
287
|
});
|
|
286
288
|
onBeforeUnmount(() => {
|
|
@@ -324,6 +326,7 @@ var Drawer = defineComponent({
|
|
|
324
326
|
);
|
|
325
327
|
const ariaLabelledbyFromAttrs = typeof attrs["aria-labelledby"] === "string" ? attrs["aria-labelledby"] : void 0;
|
|
326
328
|
const ariaLabelledby = ariaLabelledbyFromAttrs ?? (props.title || slots.header ? titleId.value : void 0);
|
|
329
|
+
const overlayHostId = `${instanceId.value}-overlay-host`;
|
|
327
330
|
const containerClasses = classNames(
|
|
328
331
|
getDrawerContainerClasses(),
|
|
329
332
|
!props.open && "pointer-events-none"
|
|
@@ -409,6 +412,7 @@ var Drawer = defineComponent({
|
|
|
409
412
|
role: "dialog",
|
|
410
413
|
"aria-modal": "true",
|
|
411
414
|
"aria-labelledby": ariaLabelledby,
|
|
415
|
+
"aria-owns": overlayHostId,
|
|
412
416
|
tabindex: -1,
|
|
413
417
|
ref: dialogRef,
|
|
414
418
|
onTouchstart: handleTouchStart,
|
|
@@ -423,12 +427,22 @@ var Drawer = defineComponent({
|
|
|
423
427
|
"div",
|
|
424
428
|
{
|
|
425
429
|
class: containerClasses,
|
|
430
|
+
ref: rootRef,
|
|
426
431
|
style: { zIndex: props.zIndex },
|
|
427
432
|
hidden: !props.open && !(props.destroyOnClose && props.deferDestroyOnClose),
|
|
428
433
|
"aria-hidden": !props.open ? "true" : void 0,
|
|
434
|
+
"data-tiger-overlay-layer": "",
|
|
429
435
|
"data-tiger-drawer-root": ""
|
|
430
436
|
},
|
|
431
|
-
[
|
|
437
|
+
[
|
|
438
|
+
mask,
|
|
439
|
+
panel,
|
|
440
|
+
h("div", {
|
|
441
|
+
id: overlayHostId,
|
|
442
|
+
class: "contents",
|
|
443
|
+
"data-tiger-overlay-host": ""
|
|
444
|
+
})
|
|
445
|
+
]
|
|
432
446
|
);
|
|
433
447
|
return renderVueBodyTeleport([root]);
|
|
434
448
|
};
|