@brumaombra/ui-vintage 0.1.0 → 0.2.0
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/LICENSE +20 -20
- package/README.md +75 -78
- package/dist/{AlertDialogTitle.vue_vue_type_script_setup_true_lang-CWCr2erD.js → AlertDialogTitle.vue_vue_type_script_setup_true_lang-Ca0g2mVz.js} +8 -8
- package/dist/{Busy-B65Nd9ec.js → Busy-DSyPtpVD.js} +1 -1
- package/dist/BusyIndicator-D-4YHN2L.js +4 -0
- package/dist/{CalendarPrevButton.vue_vue_type_script_setup_true_lang-C-WnFnvj.js → CalendarPrevButton.vue_vue_type_script_setup_true_lang-Dqz6DIGp.js} +22 -22
- package/dist/{Collection-CmOoLBo7.js → Collection-Coi6nyvb.js} +1 -1
- package/dist/ConfirmDialog-Zu4m9TY-.js +4 -0
- package/dist/{DialogClose-BNlqG4G2.js → DialogClose-DDtZ0Em0.js} +2 -2
- package/dist/{x-2_VzbDS9.js → DialogPortal-BTVR2QvT.js} +12 -12
- package/dist/{DialogTitle-DXj0nkXn.js → DialogTitle-CLuntLBB.js} +5 -5
- package/dist/{DialogTitle.vue_vue_type_script_setup_true_lang-Bw40D4AK.js → DialogTitle.vue_vue_type_script_setup_true_lang-83YQbiAn.js} +4 -4
- package/dist/{DialogTrigger-CpyKnu11.js → DialogTrigger-CjJ8QNL_.js} +3 -3
- package/dist/{FocusScope-C3mcVwsf.js → FocusScope-DYbCtSNc.js} +4 -4
- package/dist/{Input.vue_vue_type_script_setup_true_lang-U778IWa0.js → Input.vue_vue_type_script_setup_true_lang-6SfPeT8d.js} +1 -1
- package/dist/{Label.vue_vue_type_script_setup_true_lang-B_fwvfJ-.js → Label.vue_vue_type_script_setup_true_lang-pMIzCHzV.js} +2 -2
- package/dist/MessageDialog-ChS4d2qN.js +4 -0
- package/dist/{NativeSelectOption.vue_vue_type_script_setup_true_lang-DS87OTLT.js → NativeSelectOption.vue_vue_type_script_setup_true_lang-CWhL2Lw8.js} +2 -2
- package/dist/{PopoverTrigger.vue_vue_type_script_setup_true_lang-KTcg6Jnl.js → PopoverTrigger.vue_vue_type_script_setup_true_lang-DFZJvU_P.js} +9 -9
- package/dist/{PopperContent-BiM0YLO3.js → PopperContent-h-thLTz8.js} +3 -3
- package/dist/{Separator.vue_vue_type_script_setup_true_lang-COrZ60NR.js → Separator.vue_vue_type_script_setup_true_lang-CMRkdntA.js} +1 -1
- package/dist/{SheetTitle.vue_vue_type_script_setup_true_lang-DLoXGMbx.js → SheetTitle.vue_vue_type_script_setup_true_lang-fx9jbBwT.js} +4 -4
- package/dist/{Slider.vue_vue_type_script_setup_true_lang-D-cAN-4Q.js → Slider.vue_vue_type_script_setup_true_lang-C_CsSGAt.js} +7 -7
- package/dist/{Switch.vue_vue_type_script_setup_true_lang-BWKCycMm.js → Switch.vue_vue_type_script_setup_true_lang-BG6nkPSO.js} +5 -5
- package/dist/{Teleport-CuUn4UkG.js → Teleport-CV0tKbq5.js} +3 -3
- package/dist/{TooltipTrigger.vue_vue_type_script_setup_true_lang-BRyHTWgw.js → TooltipTrigger.vue_vue_type_script_setup_true_lang-DEPKysA_.js} +5 -5
- package/dist/{VisuallyHiddenInput-DLAsRwUw.js → VisuallyHiddenInput-1G1IEkBL.js} +1 -1
- package/dist/alert-dialog.js +161 -9
- package/dist/busy-indicator.js +64 -4
- package/dist/busy.js +1 -1
- package/dist/calendar.js +1 -1
- package/dist/card.js +110 -7
- package/dist/command.js +20 -20
- package/dist/components/dashboard-shell/DashboardShell.vue.d.ts +1 -1
- package/dist/components/ui/button/index.d.ts +1 -1
- package/dist/components/ui/sidebar/SidebarMenuButton.vue.d.ts +1 -1
- package/dist/components/ui/sidebar/SidebarMenuButtonChild.vue.d.ts +1 -1
- package/dist/confirm-dialog.js +228 -7
- package/dist/dashboard-shell.js +170 -3
- package/dist/date-picker.js +91 -3
- package/dist/dialog.js +140 -6
- package/dist/field.js +2 -2
- package/dist/{index-C1_fxYhb.js → index-Cq9Ekgtb.js} +2 -2
- package/dist/{index-Dfi5ESP2.js → index-qGMU40e1.js} +1 -1
- package/dist/input.js +1 -1
- package/dist/label.js +1 -1
- package/dist/message-dialog.js +240 -6
- package/dist/native-select.js +1 -1
- package/dist/popover.js +62 -5
- package/dist/select.js +2122 -12
- package/dist/separator.js +1 -1
- package/dist/sheet.js +61 -5
- package/dist/sidebar.js +6 -6
- package/dist/slider-form-component.js +58 -3
- package/dist/slider.js +1 -1
- package/dist/style.css +4 -4016
- package/dist/switch-form-component.js +38 -3
- package/dist/switch.js +1 -1
- package/dist/tooltip.js +27 -3
- package/dist/{useFocusGuards-tgErlvMF.js → useFocusGuards-WYWvpJy2.js} +1 -1
- package/dist/{useFormControl-7ytzz-r7.js → useFormControl-CyoJwp9r.js} +1 -1
- package/dist/{useForwardExpose-CNVHwdF2.js → useForwardExpose-BiRQH8eO.js} +1 -1
- package/dist/{usePrimitiveElement-CijaRBgF.js → usePrimitiveElement-Bk3ZOslv.js} +1 -1
- package/dist/{useSize-DO9Z3wC4.js → useSize-BLYTFgnQ.js} +1 -1
- package/dist/{useTypeahead-Dqe1QXq1.js → useTypeahead-KTl4-oeq.js} +2 -2
- package/dist/{utils-RRmyeqLm.js → utils-BXBXPGDA.js} +1 -1
- package/package.json +188 -186
- package/dist/AlertDialogTrigger.vue_vue_type_script_setup_true_lang-vNwxOYhM.js +0 -158
- package/dist/BusyIndicator-CnWzSMDb.js +0 -4
- package/dist/BusyIndicator.vue_vue_type_script_setup_true_lang-CYeXMI_V.js +0 -66
- package/dist/CardTitle.vue_vue_type_script_setup_true_lang-DVAd7AWF.js +0 -112
- package/dist/ConfirmDialog-DEsvF0b_.js +0 -4
- package/dist/ConfirmDialog.vue_vue_type_script_setup_true_lang-BAd1l1zF.js +0 -230
- package/dist/DashboardShell.vue_vue_type_script_setup_true_lang-CT2SQBXv.js +0 -171
- package/dist/DatePicker.vue_vue_type_script_setup_true_lang-D8mev2ha.js +0 -92
- package/dist/DialogTrigger.vue_vue_type_script_setup_true_lang-DLrFiCsw.js +0 -141
- package/dist/MessageDialog-BrowppID.js +0 -4
- package/dist/MessageDialog.vue_vue_type_script_setup_true_lang-Ddih5Isd.js +0 -242
- package/dist/PopoverAnchor.vue_vue_type_script_setup_true_lang-CsfybvZp.js +0 -61
- package/dist/SelectValue.vue_vue_type_script_setup_true_lang-DGAI4hw5.js +0 -2124
- package/dist/SheetTrigger.vue_vue_type_script_setup_true_lang-CE2XJNHy.js +0 -62
- package/dist/SliderFormComponent.vue_vue_type_script_setup_true_lang-KPzC_Lmr.js +0 -59
- package/dist/SwitchFormComponent.vue_vue_type_script_setup_true_lang-XOBEs3pa.js +0 -39
- package/dist/TooltipProvider.vue_vue_type_script_setup_true_lang-DwIfCQjY.js +0 -28
- package/dist/alert-dialog.d.ts +0 -2
- package/dist/alert.d.ts +0 -2
- package/dist/background-grid.d.ts +0 -6
- package/dist/busy-indicator.d.ts +0 -2
- package/dist/busy.d.ts +0 -2
- package/dist/button.d.ts +0 -2
- package/dist/calendar.d.ts +0 -2
- package/dist/card.d.ts +0 -2
- package/dist/command.d.ts +0 -2
- package/dist/confirm-dialog.d.ts +0 -2
- package/dist/dashboard-shell.d.ts +0 -6
- package/dist/date-picker.d.ts +0 -6
- package/dist/dialog.d.ts +0 -2
- package/dist/field.d.ts +0 -2
- package/dist/index.d.ts +0 -28
- package/dist/index.js +0 -171
- package/dist/input.d.ts +0 -2
- package/dist/label.d.ts +0 -2
- package/dist/message-dialog.d.ts +0 -2
- package/dist/native-select.d.ts +0 -2
- package/dist/popover.d.ts +0 -2
- package/dist/select.d.ts +0 -2
- package/dist/separator.d.ts +0 -2
- package/dist/sheet.d.ts +0 -2
- package/dist/sidebar.d.ts +0 -2
- package/dist/skeleton.d.ts +0 -2
- package/dist/slider-form-component.d.ts +0 -6
- package/dist/slider.d.ts +0 -2
- package/dist/switch-form-component.d.ts +0 -6
- package/dist/switch.d.ts +0 -2
- package/dist/tooltip.d.ts +0 -2
- package/dist/utils.d.ts +0 -2
package/dist/select.js
CHANGED
|
@@ -1,14 +1,2124 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ref, computed, defineComponent, toRefs, openBlock, createBlock, unref, withCtx, renderSlot, createElementBlock, createCommentVNode, Fragment, renderList, mergeProps, watch, createElementVNode, watchEffect, createVNode, withModifiers, resolveDynamicComponent, onMounted, nextTick, normalizeStyle, normalizeProps, guardReactiveProps, Teleport, createTextVNode, onUnmounted, onBeforeUnmount, toDisplayString, normalizeClass } from "vue";
|
|
2
|
+
import { c as createContext, a as useForwardProps, u as useForwardPropsEmits } from "./useForwardPropsEmits-DmumnZO5.js";
|
|
3
|
+
import { i as isNullish, D as DismissableLayer_default, P as Presence_default, u as useId, h as handleAndDispatchCustomEvent, T as Teleport_default } from "./Teleport-CV0tKbq5.js";
|
|
4
|
+
import { u as useDirection } from "./useDirection-SIyEYNxv.js";
|
|
5
|
+
import { u as useFormControl } from "./useFormControl-CyoJwp9r.js";
|
|
6
|
+
import { u as useCollection } from "./Collection-Coi6nyvb.js";
|
|
7
|
+
import { a as PopperRoot_default, b as PopperContent_default, P as PopperAnchor_default } from "./PopperContent-h-thLTz8.js";
|
|
8
|
+
import { V as VisuallyHidden_default } from "./VisuallyHidden-udQT2Fmo.js";
|
|
9
|
+
import { i as isEqual, u as useTypeahead } from "./useTypeahead-KTl4-oeq.js";
|
|
10
|
+
import { u as useVModel, a as unrefElement, h as useResizeObserver } from "./index-Cq9Ekgtb.js";
|
|
11
|
+
import { u as useBodyScrollLock, a as useHideOthers, F as FocusScope_default, g as getActiveElement } from "./FocusScope-DYbCtSNc.js";
|
|
12
|
+
import { u as useFocusGuards } from "./useFocusGuards-WYWvpJy2.js";
|
|
13
|
+
import { f as focusFirst } from "./utils-BXBXPGDA.js";
|
|
14
|
+
import { c as clamp } from "./clamp-D5Ye0kJT.js";
|
|
15
|
+
import { u as useForwardExpose } from "./useForwardExpose-BiRQH8eO.js";
|
|
16
|
+
import { P as Primitive } from "./Primitive-D3IcFg81.js";
|
|
17
|
+
import { i as injectConfigProviderContext } from "./ConfigProvider-D2O0Jles.js";
|
|
18
|
+
import { c as cn } from "./utils-Bz4m9VPB.js";
|
|
19
|
+
import { r as reactiveOmit } from "./index-qGMU40e1.js";
|
|
20
|
+
import { C as ChevronDown } from "./chevron-down-DP-oz-sL.js";
|
|
21
|
+
import { c as createLucideIcon } from "./createLucideIcon-CCMB2vDW.js";
|
|
22
|
+
import { C as Check } from "./check-iejznCzf.js";
|
|
23
|
+
/**
|
|
24
|
+
* @license lucide-vue-next v1.0.0 - ISC
|
|
25
|
+
*
|
|
26
|
+
* This source code is licensed under the ISC license.
|
|
27
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
28
|
+
*/
|
|
29
|
+
const ChevronUp = createLucideIcon("chevron-up", [
|
|
30
|
+
["path", { d: "m18 15-6-6-6 6", key: "153udz" }]
|
|
31
|
+
]);
|
|
32
|
+
function useNonce(nonce) {
|
|
33
|
+
const context = injectConfigProviderContext({ nonce: ref() });
|
|
34
|
+
return computed(() => {
|
|
35
|
+
var _a;
|
|
36
|
+
return (nonce == null ? void 0 : nonce.value) || ((_a = context.nonce) == null ? void 0 : _a.value);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const OPEN_KEYS = [
|
|
40
|
+
" ",
|
|
41
|
+
"Enter",
|
|
42
|
+
"ArrowUp",
|
|
43
|
+
"ArrowDown"
|
|
44
|
+
];
|
|
45
|
+
const SELECTION_KEYS = [" ", "Enter"];
|
|
46
|
+
const CONTENT_MARGIN = 10;
|
|
47
|
+
function valueComparator(value, currentValue, comparator) {
|
|
48
|
+
if (value === void 0) return false;
|
|
49
|
+
else if (Array.isArray(value)) return value.some((val) => compare(val, currentValue, comparator));
|
|
50
|
+
else return compare(value, currentValue, comparator);
|
|
51
|
+
}
|
|
52
|
+
function compare(value, currentValue, comparator) {
|
|
53
|
+
if (value === void 0 || currentValue === void 0) return false;
|
|
54
|
+
if (typeof value === "string") return value === currentValue;
|
|
55
|
+
if (typeof comparator === "function") return comparator(value, currentValue);
|
|
56
|
+
if (typeof comparator === "string") return (value == null ? void 0 : value[comparator]) === (currentValue == null ? void 0 : currentValue[comparator]);
|
|
57
|
+
return isEqual(value, currentValue);
|
|
58
|
+
}
|
|
59
|
+
function shouldShowPlaceholder(value) {
|
|
60
|
+
return value === void 0 || value === null || value === "" || Array.isArray(value) && value.length === 0;
|
|
61
|
+
}
|
|
62
|
+
const _hoisted_1$2 = {
|
|
63
|
+
key: 0,
|
|
64
|
+
value: ""
|
|
65
|
+
};
|
|
66
|
+
const [injectSelectRootContext, provideSelectRootContext] = createContext("SelectRoot");
|
|
67
|
+
var SelectRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
68
|
+
inheritAttrs: false,
|
|
69
|
+
__name: "SelectRoot",
|
|
70
|
+
props: {
|
|
71
|
+
open: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
required: false,
|
|
74
|
+
default: void 0
|
|
75
|
+
},
|
|
76
|
+
defaultOpen: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
required: false
|
|
79
|
+
},
|
|
80
|
+
defaultValue: {
|
|
81
|
+
type: null,
|
|
82
|
+
required: false
|
|
83
|
+
},
|
|
84
|
+
modelValue: {
|
|
85
|
+
type: null,
|
|
86
|
+
required: false,
|
|
87
|
+
default: void 0
|
|
88
|
+
},
|
|
89
|
+
by: {
|
|
90
|
+
type: [String, Function],
|
|
91
|
+
required: false
|
|
92
|
+
},
|
|
93
|
+
dir: {
|
|
94
|
+
type: String,
|
|
95
|
+
required: false
|
|
96
|
+
},
|
|
97
|
+
multiple: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
required: false
|
|
100
|
+
},
|
|
101
|
+
autocomplete: {
|
|
102
|
+
type: String,
|
|
103
|
+
required: false
|
|
104
|
+
},
|
|
105
|
+
disabled: {
|
|
106
|
+
type: Boolean,
|
|
107
|
+
required: false
|
|
108
|
+
},
|
|
109
|
+
name: {
|
|
110
|
+
type: String,
|
|
111
|
+
required: false
|
|
112
|
+
},
|
|
113
|
+
required: {
|
|
114
|
+
type: Boolean,
|
|
115
|
+
required: false
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
emits: ["update:modelValue", "update:open"],
|
|
119
|
+
setup(__props, { emit: __emit }) {
|
|
120
|
+
const props = __props;
|
|
121
|
+
const emits = __emit;
|
|
122
|
+
const { required, disabled, multiple, dir: propDir } = toRefs(props);
|
|
123
|
+
const modelValue = useVModel(props, "modelValue", emits, {
|
|
124
|
+
defaultValue: props.defaultValue ?? (multiple.value ? [] : void 0),
|
|
125
|
+
passive: props.modelValue === void 0,
|
|
126
|
+
deep: true
|
|
127
|
+
});
|
|
128
|
+
const open = useVModel(props, "open", emits, {
|
|
129
|
+
defaultValue: props.defaultOpen,
|
|
130
|
+
passive: props.open === void 0
|
|
131
|
+
});
|
|
132
|
+
const triggerElement = ref();
|
|
133
|
+
const valueElement = ref();
|
|
134
|
+
const triggerPointerDownPosRef = ref({
|
|
135
|
+
x: 0,
|
|
136
|
+
y: 0
|
|
137
|
+
});
|
|
138
|
+
const isEmptyModelValue = computed(() => {
|
|
139
|
+
var _a;
|
|
140
|
+
if (multiple.value && Array.isArray(modelValue.value)) return ((_a = modelValue.value) == null ? void 0 : _a.length) === 0;
|
|
141
|
+
else return isNullish(modelValue.value);
|
|
142
|
+
});
|
|
143
|
+
useCollection({ isProvider: true });
|
|
144
|
+
const dir = useDirection(propDir);
|
|
145
|
+
const isFormControl = useFormControl(triggerElement);
|
|
146
|
+
const optionsSet = ref(/* @__PURE__ */ new Set());
|
|
147
|
+
const nativeSelectKey = computed(() => {
|
|
148
|
+
return Array.from(optionsSet.value).map((option) => option.value).join(";");
|
|
149
|
+
});
|
|
150
|
+
function handleValueChange(value) {
|
|
151
|
+
if (multiple.value) {
|
|
152
|
+
const array = Array.isArray(modelValue.value) ? [...modelValue.value] : [];
|
|
153
|
+
const index = array.findIndex((i) => compare(i, value, props.by));
|
|
154
|
+
index === -1 ? array.push(value) : array.splice(index, 1);
|
|
155
|
+
modelValue.value = [...array];
|
|
156
|
+
} else modelValue.value = value;
|
|
157
|
+
}
|
|
158
|
+
function getOption(value) {
|
|
159
|
+
return Array.from(optionsSet.value).find((option) => valueComparator(value, option.value, props.by));
|
|
160
|
+
}
|
|
161
|
+
provideSelectRootContext({
|
|
162
|
+
triggerElement,
|
|
163
|
+
onTriggerChange: (node) => {
|
|
164
|
+
triggerElement.value = node;
|
|
165
|
+
},
|
|
166
|
+
valueElement,
|
|
167
|
+
onValueElementChange: (node) => {
|
|
168
|
+
valueElement.value = node;
|
|
169
|
+
},
|
|
170
|
+
contentId: "",
|
|
171
|
+
modelValue,
|
|
172
|
+
onValueChange: handleValueChange,
|
|
173
|
+
by: props.by,
|
|
174
|
+
open,
|
|
175
|
+
multiple,
|
|
176
|
+
required,
|
|
177
|
+
onOpenChange: (value) => {
|
|
178
|
+
open.value = value;
|
|
179
|
+
},
|
|
180
|
+
dir,
|
|
181
|
+
triggerPointerDownPosRef,
|
|
182
|
+
disabled,
|
|
183
|
+
isEmptyModelValue,
|
|
184
|
+
optionsSet,
|
|
185
|
+
onOptionAdd: (option) => {
|
|
186
|
+
const existingOption = getOption(option.value);
|
|
187
|
+
if (existingOption) optionsSet.value.delete(existingOption);
|
|
188
|
+
optionsSet.value.add(option);
|
|
189
|
+
},
|
|
190
|
+
onOptionRemove: (option) => {
|
|
191
|
+
const existingOption = getOption(option.value);
|
|
192
|
+
if (existingOption) optionsSet.value.delete(existingOption);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
return (_ctx, _cache) => {
|
|
196
|
+
return openBlock(), createBlock(unref(PopperRoot_default), null, {
|
|
197
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default", {
|
|
198
|
+
modelValue: unref(modelValue),
|
|
199
|
+
open: unref(open)
|
|
200
|
+
}), unref(isFormControl) ? (openBlock(), createBlock(BubbleSelect_default, {
|
|
201
|
+
key: nativeSelectKey.value,
|
|
202
|
+
"aria-hidden": "true",
|
|
203
|
+
tabindex: "-1",
|
|
204
|
+
multiple: unref(multiple),
|
|
205
|
+
required: unref(required),
|
|
206
|
+
name: _ctx.name,
|
|
207
|
+
autocomplete: _ctx.autocomplete,
|
|
208
|
+
disabled: unref(disabled),
|
|
209
|
+
value: unref(modelValue)
|
|
210
|
+
}, {
|
|
211
|
+
default: withCtx(() => [unref(isNullish)(unref(modelValue)) ? (openBlock(), createElementBlock("option", _hoisted_1$2)) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(Array.from(optionsSet.value), (option) => {
|
|
212
|
+
return openBlock(), createElementBlock("option", mergeProps({ key: option.value ?? "" }, { ref_for: true }, option), null, 16);
|
|
213
|
+
}), 128))]),
|
|
214
|
+
_: 1
|
|
215
|
+
}, 8, [
|
|
216
|
+
"multiple",
|
|
217
|
+
"required",
|
|
218
|
+
"name",
|
|
219
|
+
"autocomplete",
|
|
220
|
+
"disabled",
|
|
221
|
+
"value"
|
|
222
|
+
])) : createCommentVNode("v-if", true)]),
|
|
223
|
+
_: 3
|
|
224
|
+
});
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
var SelectRoot_default = SelectRoot_vue_vue_type_script_setup_true_lang_default;
|
|
229
|
+
var BubbleSelect_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
230
|
+
__name: "BubbleSelect",
|
|
231
|
+
props: {
|
|
232
|
+
autocomplete: {
|
|
233
|
+
type: String,
|
|
234
|
+
required: false
|
|
235
|
+
},
|
|
236
|
+
autofocus: {
|
|
237
|
+
type: Boolean,
|
|
238
|
+
required: false
|
|
239
|
+
},
|
|
240
|
+
disabled: {
|
|
241
|
+
type: Boolean,
|
|
242
|
+
required: false
|
|
243
|
+
},
|
|
244
|
+
form: {
|
|
245
|
+
type: String,
|
|
246
|
+
required: false
|
|
247
|
+
},
|
|
248
|
+
multiple: {
|
|
249
|
+
type: Boolean,
|
|
250
|
+
required: false
|
|
251
|
+
},
|
|
252
|
+
name: {
|
|
253
|
+
type: String,
|
|
254
|
+
required: false
|
|
255
|
+
},
|
|
256
|
+
required: {
|
|
257
|
+
type: Boolean,
|
|
258
|
+
required: false
|
|
259
|
+
},
|
|
260
|
+
size: {
|
|
261
|
+
type: Number,
|
|
262
|
+
required: false
|
|
263
|
+
},
|
|
264
|
+
value: {
|
|
265
|
+
type: null,
|
|
266
|
+
required: false
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
setup(__props) {
|
|
270
|
+
const props = __props;
|
|
271
|
+
const selectElement = ref();
|
|
272
|
+
const rootContext = injectSelectRootContext();
|
|
273
|
+
watch(() => props.value, (cur, prev) => {
|
|
274
|
+
const selectProto = window.HTMLSelectElement.prototype;
|
|
275
|
+
const descriptor = Object.getOwnPropertyDescriptor(selectProto, "value");
|
|
276
|
+
const setValue = descriptor.set;
|
|
277
|
+
if (cur !== prev && setValue && selectElement.value) {
|
|
278
|
+
const event = new Event("change", { bubbles: true });
|
|
279
|
+
setValue.call(selectElement.value, cur);
|
|
280
|
+
selectElement.value.dispatchEvent(event);
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
function handleInput(event) {
|
|
284
|
+
rootContext.onValueChange(event.target.value);
|
|
285
|
+
}
|
|
286
|
+
return (_ctx, _cache) => {
|
|
287
|
+
return openBlock(), createBlock(unref(VisuallyHidden_default), { "as-child": "" }, {
|
|
288
|
+
default: withCtx(() => [createElementVNode("select", mergeProps({
|
|
289
|
+
ref_key: "selectElement",
|
|
290
|
+
ref: selectElement
|
|
291
|
+
}, props, { onInput: handleInput }), [renderSlot(_ctx.$slots, "default")], 16)]),
|
|
292
|
+
_: 3
|
|
293
|
+
});
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
var BubbleSelect_default = BubbleSelect_vue_vue_type_script_setup_true_lang_default;
|
|
298
|
+
var SelectPopperPosition_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
299
|
+
__name: "SelectPopperPosition",
|
|
300
|
+
props: {
|
|
301
|
+
side: {
|
|
302
|
+
type: null,
|
|
303
|
+
required: false
|
|
304
|
+
},
|
|
305
|
+
sideOffset: {
|
|
306
|
+
type: Number,
|
|
307
|
+
required: false
|
|
308
|
+
},
|
|
309
|
+
sideFlip: {
|
|
310
|
+
type: Boolean,
|
|
311
|
+
required: false
|
|
312
|
+
},
|
|
313
|
+
align: {
|
|
314
|
+
type: null,
|
|
315
|
+
required: false,
|
|
316
|
+
default: "start"
|
|
317
|
+
},
|
|
318
|
+
alignOffset: {
|
|
319
|
+
type: Number,
|
|
320
|
+
required: false
|
|
321
|
+
},
|
|
322
|
+
alignFlip: {
|
|
323
|
+
type: Boolean,
|
|
324
|
+
required: false
|
|
325
|
+
},
|
|
326
|
+
avoidCollisions: {
|
|
327
|
+
type: Boolean,
|
|
328
|
+
required: false
|
|
329
|
+
},
|
|
330
|
+
collisionBoundary: {
|
|
331
|
+
type: null,
|
|
332
|
+
required: false
|
|
333
|
+
},
|
|
334
|
+
collisionPadding: {
|
|
335
|
+
type: [Number, Object],
|
|
336
|
+
required: false,
|
|
337
|
+
default: CONTENT_MARGIN
|
|
338
|
+
},
|
|
339
|
+
arrowPadding: {
|
|
340
|
+
type: Number,
|
|
341
|
+
required: false
|
|
342
|
+
},
|
|
343
|
+
hideShiftedArrow: {
|
|
344
|
+
type: Boolean,
|
|
345
|
+
required: false
|
|
346
|
+
},
|
|
347
|
+
sticky: {
|
|
348
|
+
type: String,
|
|
349
|
+
required: false
|
|
350
|
+
},
|
|
351
|
+
hideWhenDetached: {
|
|
352
|
+
type: Boolean,
|
|
353
|
+
required: false
|
|
354
|
+
},
|
|
355
|
+
positionStrategy: {
|
|
356
|
+
type: String,
|
|
357
|
+
required: false
|
|
358
|
+
},
|
|
359
|
+
updatePositionStrategy: {
|
|
360
|
+
type: String,
|
|
361
|
+
required: false
|
|
362
|
+
},
|
|
363
|
+
disableUpdateOnLayoutShift: {
|
|
364
|
+
type: Boolean,
|
|
365
|
+
required: false
|
|
366
|
+
},
|
|
367
|
+
prioritizePosition: {
|
|
368
|
+
type: Boolean,
|
|
369
|
+
required: false
|
|
370
|
+
},
|
|
371
|
+
reference: {
|
|
372
|
+
type: null,
|
|
373
|
+
required: false
|
|
374
|
+
},
|
|
375
|
+
asChild: {
|
|
376
|
+
type: Boolean,
|
|
377
|
+
required: false
|
|
378
|
+
},
|
|
379
|
+
as: {
|
|
380
|
+
type: null,
|
|
381
|
+
required: false
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
setup(__props) {
|
|
385
|
+
const props = __props;
|
|
386
|
+
const forwarded = useForwardProps(props);
|
|
387
|
+
return (_ctx, _cache) => {
|
|
388
|
+
return openBlock(), createBlock(unref(PopperContent_default), mergeProps(unref(forwarded), { style: {
|
|
389
|
+
"boxSizing": "border-box",
|
|
390
|
+
"--reka-select-content-transform-origin": "var(--reka-popper-transform-origin)",
|
|
391
|
+
"--reka-select-content-available-width": "var(--reka-popper-available-width)",
|
|
392
|
+
"--reka-select-content-available-height": "var(--reka-popper-available-height)",
|
|
393
|
+
"--reka-select-trigger-width": "var(--reka-popper-anchor-width)",
|
|
394
|
+
"--reka-select-trigger-height": "var(--reka-popper-anchor-height)"
|
|
395
|
+
} }), {
|
|
396
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
397
|
+
_: 3
|
|
398
|
+
}, 16);
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
var SelectPopperPosition_default = SelectPopperPosition_vue_vue_type_script_setup_true_lang_default;
|
|
403
|
+
const SelectContentDefaultContextValue = {
|
|
404
|
+
onViewportChange: () => {
|
|
405
|
+
},
|
|
406
|
+
itemTextRefCallback: () => {
|
|
407
|
+
},
|
|
408
|
+
itemRefCallback: () => {
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
const [injectSelectContentContext, provideSelectContentContext] = createContext("SelectContent");
|
|
412
|
+
var SelectContentImpl_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
413
|
+
__name: "SelectContentImpl",
|
|
414
|
+
props: {
|
|
415
|
+
position: {
|
|
416
|
+
type: String,
|
|
417
|
+
required: false,
|
|
418
|
+
default: "item-aligned"
|
|
419
|
+
},
|
|
420
|
+
bodyLock: {
|
|
421
|
+
type: Boolean,
|
|
422
|
+
required: false,
|
|
423
|
+
default: true
|
|
424
|
+
},
|
|
425
|
+
side: {
|
|
426
|
+
type: null,
|
|
427
|
+
required: false
|
|
428
|
+
},
|
|
429
|
+
sideOffset: {
|
|
430
|
+
type: Number,
|
|
431
|
+
required: false
|
|
432
|
+
},
|
|
433
|
+
sideFlip: {
|
|
434
|
+
type: Boolean,
|
|
435
|
+
required: false
|
|
436
|
+
},
|
|
437
|
+
align: {
|
|
438
|
+
type: null,
|
|
439
|
+
required: false,
|
|
440
|
+
default: "start"
|
|
441
|
+
},
|
|
442
|
+
alignOffset: {
|
|
443
|
+
type: Number,
|
|
444
|
+
required: false
|
|
445
|
+
},
|
|
446
|
+
alignFlip: {
|
|
447
|
+
type: Boolean,
|
|
448
|
+
required: false
|
|
449
|
+
},
|
|
450
|
+
avoidCollisions: {
|
|
451
|
+
type: Boolean,
|
|
452
|
+
required: false
|
|
453
|
+
},
|
|
454
|
+
collisionBoundary: {
|
|
455
|
+
type: null,
|
|
456
|
+
required: false
|
|
457
|
+
},
|
|
458
|
+
collisionPadding: {
|
|
459
|
+
type: [Number, Object],
|
|
460
|
+
required: false
|
|
461
|
+
},
|
|
462
|
+
arrowPadding: {
|
|
463
|
+
type: Number,
|
|
464
|
+
required: false
|
|
465
|
+
},
|
|
466
|
+
hideShiftedArrow: {
|
|
467
|
+
type: Boolean,
|
|
468
|
+
required: false
|
|
469
|
+
},
|
|
470
|
+
sticky: {
|
|
471
|
+
type: String,
|
|
472
|
+
required: false
|
|
473
|
+
},
|
|
474
|
+
hideWhenDetached: {
|
|
475
|
+
type: Boolean,
|
|
476
|
+
required: false
|
|
477
|
+
},
|
|
478
|
+
positionStrategy: {
|
|
479
|
+
type: String,
|
|
480
|
+
required: false
|
|
481
|
+
},
|
|
482
|
+
updatePositionStrategy: {
|
|
483
|
+
type: String,
|
|
484
|
+
required: false
|
|
485
|
+
},
|
|
486
|
+
disableUpdateOnLayoutShift: {
|
|
487
|
+
type: Boolean,
|
|
488
|
+
required: false
|
|
489
|
+
},
|
|
490
|
+
prioritizePosition: {
|
|
491
|
+
type: Boolean,
|
|
492
|
+
required: false
|
|
493
|
+
},
|
|
494
|
+
reference: {
|
|
495
|
+
type: null,
|
|
496
|
+
required: false
|
|
497
|
+
},
|
|
498
|
+
asChild: {
|
|
499
|
+
type: Boolean,
|
|
500
|
+
required: false
|
|
501
|
+
},
|
|
502
|
+
as: {
|
|
503
|
+
type: null,
|
|
504
|
+
required: false
|
|
505
|
+
},
|
|
506
|
+
disableOutsidePointerEvents: {
|
|
507
|
+
type: Boolean,
|
|
508
|
+
required: false,
|
|
509
|
+
default: true
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
emits: [
|
|
513
|
+
"closeAutoFocus",
|
|
514
|
+
"escapeKeyDown",
|
|
515
|
+
"pointerDownOutside"
|
|
516
|
+
],
|
|
517
|
+
setup(__props, { emit: __emit }) {
|
|
518
|
+
const props = __props;
|
|
519
|
+
const emits = __emit;
|
|
520
|
+
const rootContext = injectSelectRootContext();
|
|
521
|
+
useFocusGuards();
|
|
522
|
+
useBodyScrollLock(props.bodyLock);
|
|
523
|
+
const { CollectionSlot, getItems } = useCollection();
|
|
524
|
+
const content = ref();
|
|
525
|
+
useHideOthers(content);
|
|
526
|
+
const { search, handleTypeaheadSearch } = useTypeahead();
|
|
527
|
+
const viewport = ref();
|
|
528
|
+
const selectedItem = ref();
|
|
529
|
+
const selectedItemText = ref();
|
|
530
|
+
const isPositioned = ref(false);
|
|
531
|
+
const firstValidItemFoundRef = ref(false);
|
|
532
|
+
const firstSelectedItemInArrayFoundRef = ref(false);
|
|
533
|
+
function focusSelectedItem() {
|
|
534
|
+
if (selectedItem.value && content.value) focusFirst([selectedItem.value, content.value]);
|
|
535
|
+
}
|
|
536
|
+
watch(isPositioned, () => {
|
|
537
|
+
focusSelectedItem();
|
|
538
|
+
});
|
|
539
|
+
const { onOpenChange, triggerPointerDownPosRef } = rootContext;
|
|
540
|
+
watchEffect((cleanupFn) => {
|
|
541
|
+
if (!content.value) return;
|
|
542
|
+
let pointerMoveDelta = {
|
|
543
|
+
x: 0,
|
|
544
|
+
y: 0
|
|
545
|
+
};
|
|
546
|
+
const handlePointerMove = (event) => {
|
|
547
|
+
var _a, _b;
|
|
548
|
+
pointerMoveDelta = {
|
|
549
|
+
x: Math.abs(Math.round(event.pageX) - (((_a = triggerPointerDownPosRef.value) == null ? void 0 : _a.x) ?? 0)),
|
|
550
|
+
y: Math.abs(Math.round(event.pageY) - (((_b = triggerPointerDownPosRef.value) == null ? void 0 : _b.y) ?? 0))
|
|
551
|
+
};
|
|
552
|
+
};
|
|
553
|
+
const handlePointerUp = (event) => {
|
|
554
|
+
var _a;
|
|
555
|
+
if (event.pointerType === "touch") return;
|
|
556
|
+
if (pointerMoveDelta.x <= 10 && pointerMoveDelta.y <= 10) event.preventDefault();
|
|
557
|
+
else if (!((_a = content.value) == null ? void 0 : _a.contains(event.target))) onOpenChange(false);
|
|
558
|
+
document.removeEventListener("pointermove", handlePointerMove);
|
|
559
|
+
triggerPointerDownPosRef.value = null;
|
|
560
|
+
};
|
|
561
|
+
if (triggerPointerDownPosRef.value !== null) {
|
|
562
|
+
document.addEventListener("pointermove", handlePointerMove);
|
|
563
|
+
document.addEventListener("pointerup", handlePointerUp, {
|
|
564
|
+
capture: true,
|
|
565
|
+
once: true
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
cleanupFn(() => {
|
|
569
|
+
document.removeEventListener("pointermove", handlePointerMove);
|
|
570
|
+
document.removeEventListener("pointerup", handlePointerUp, { capture: true });
|
|
571
|
+
});
|
|
572
|
+
});
|
|
573
|
+
function handleKeyDown(event) {
|
|
574
|
+
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
575
|
+
if (event.key === "Tab") event.preventDefault();
|
|
576
|
+
if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key, getItems());
|
|
577
|
+
if ([
|
|
578
|
+
"ArrowUp",
|
|
579
|
+
"ArrowDown",
|
|
580
|
+
"Home",
|
|
581
|
+
"End"
|
|
582
|
+
].includes(event.key)) {
|
|
583
|
+
const collectionItems = getItems().map((i) => i.ref);
|
|
584
|
+
let candidateNodes = [...collectionItems];
|
|
585
|
+
if (["ArrowUp", "End"].includes(event.key)) candidateNodes = candidateNodes.slice().reverse();
|
|
586
|
+
if (["ArrowUp", "ArrowDown"].includes(event.key)) {
|
|
587
|
+
const currentElement = event.target;
|
|
588
|
+
const currentIndex = candidateNodes.indexOf(currentElement);
|
|
589
|
+
candidateNodes = candidateNodes.slice(currentIndex + 1);
|
|
590
|
+
}
|
|
591
|
+
setTimeout(() => focusFirst(candidateNodes));
|
|
592
|
+
event.preventDefault();
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
const pickedProps = computed(() => {
|
|
596
|
+
if (props.position === "popper") return props;
|
|
597
|
+
else return {};
|
|
598
|
+
});
|
|
599
|
+
const forwardedProps = useForwardProps(pickedProps.value);
|
|
600
|
+
provideSelectContentContext({
|
|
601
|
+
content,
|
|
602
|
+
viewport,
|
|
603
|
+
onViewportChange: (node) => {
|
|
604
|
+
viewport.value = node;
|
|
605
|
+
},
|
|
606
|
+
itemRefCallback: (node, value, disabled) => {
|
|
607
|
+
const isFirstValidItem = !firstValidItemFoundRef.value && !disabled;
|
|
608
|
+
const isSelectedItem = valueComparator(rootContext.modelValue.value, value, rootContext.by);
|
|
609
|
+
if (rootContext.multiple.value) {
|
|
610
|
+
if (firstSelectedItemInArrayFoundRef.value) return;
|
|
611
|
+
if (isSelectedItem || isFirstValidItem) {
|
|
612
|
+
selectedItem.value = node;
|
|
613
|
+
if (isSelectedItem) firstSelectedItemInArrayFoundRef.value = true;
|
|
614
|
+
}
|
|
615
|
+
} else if (isSelectedItem || isFirstValidItem) selectedItem.value = node;
|
|
616
|
+
if (isFirstValidItem) firstValidItemFoundRef.value = true;
|
|
617
|
+
},
|
|
618
|
+
selectedItem,
|
|
619
|
+
selectedItemText,
|
|
620
|
+
onItemLeave: () => {
|
|
621
|
+
var _a;
|
|
622
|
+
(_a = content.value) == null ? void 0 : _a.focus();
|
|
623
|
+
},
|
|
624
|
+
itemTextRefCallback: (node, value, disabled) => {
|
|
625
|
+
const isFirstValidItem = !firstValidItemFoundRef.value && !disabled;
|
|
626
|
+
const isSelectedItem = valueComparator(rootContext.modelValue.value, value, rootContext.by);
|
|
627
|
+
if (isSelectedItem || isFirstValidItem) selectedItemText.value = node;
|
|
628
|
+
},
|
|
629
|
+
focusSelectedItem,
|
|
630
|
+
position: props.position,
|
|
631
|
+
isPositioned,
|
|
632
|
+
searchRef: search
|
|
633
|
+
});
|
|
634
|
+
return (_ctx, _cache) => {
|
|
635
|
+
return openBlock(), createBlock(unref(CollectionSlot), null, {
|
|
636
|
+
default: withCtx(() => [createVNode(unref(FocusScope_default), {
|
|
637
|
+
"as-child": "",
|
|
638
|
+
onMountAutoFocus: _cache[6] || (_cache[6] = withModifiers(() => {
|
|
639
|
+
}, ["prevent"])),
|
|
640
|
+
onUnmountAutoFocus: _cache[7] || (_cache[7] = (event) => {
|
|
641
|
+
var _a;
|
|
642
|
+
emits("closeAutoFocus", event);
|
|
643
|
+
if (event.defaultPrevented) return;
|
|
644
|
+
(_a = unref(rootContext).triggerElement.value) == null ? void 0 : _a.focus({ preventScroll: true });
|
|
645
|
+
event.preventDefault();
|
|
646
|
+
})
|
|
647
|
+
}, {
|
|
648
|
+
default: withCtx(() => [createVNode(unref(DismissableLayer_default), {
|
|
649
|
+
"as-child": "",
|
|
650
|
+
"disable-outside-pointer-events": _ctx.disableOutsidePointerEvents,
|
|
651
|
+
onFocusOutside: _cache[2] || (_cache[2] = withModifiers(() => {
|
|
652
|
+
}, ["prevent"])),
|
|
653
|
+
onDismiss: _cache[3] || (_cache[3] = ($event) => unref(rootContext).onOpenChange(false)),
|
|
654
|
+
onEscapeKeyDown: _cache[4] || (_cache[4] = ($event) => emits("escapeKeyDown", $event)),
|
|
655
|
+
onPointerDownOutside: _cache[5] || (_cache[5] = ($event) => emits("pointerDownOutside", $event))
|
|
656
|
+
}, {
|
|
657
|
+
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.position === "popper" ? SelectPopperPosition_default : SelectItemAlignedPosition_default), mergeProps({
|
|
658
|
+
..._ctx.$attrs,
|
|
659
|
+
...unref(forwardedProps)
|
|
660
|
+
}, {
|
|
661
|
+
id: unref(rootContext).contentId,
|
|
662
|
+
ref: (vnode) => {
|
|
663
|
+
const el = unref(unrefElement)(vnode);
|
|
664
|
+
if (el == null ? void 0 : el.hasAttribute("data-reka-popper-content-wrapper")) content.value = el.firstElementChild;
|
|
665
|
+
else content.value = el;
|
|
666
|
+
return void 0;
|
|
667
|
+
},
|
|
668
|
+
role: "listbox",
|
|
669
|
+
"data-state": unref(rootContext).open.value ? "open" : "closed",
|
|
670
|
+
dir: unref(rootContext).dir.value,
|
|
671
|
+
style: {
|
|
672
|
+
display: "flex",
|
|
673
|
+
flexDirection: "column",
|
|
674
|
+
outline: "none"
|
|
675
|
+
},
|
|
676
|
+
onContextmenu: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
677
|
+
}, ["prevent"])),
|
|
678
|
+
onPlaced: _cache[1] || (_cache[1] = ($event) => isPositioned.value = true),
|
|
679
|
+
onKeydown: handleKeyDown
|
|
680
|
+
}), {
|
|
681
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
682
|
+
_: 3
|
|
683
|
+
}, 16, [
|
|
684
|
+
"id",
|
|
685
|
+
"data-state",
|
|
686
|
+
"dir",
|
|
687
|
+
"onKeydown"
|
|
688
|
+
]))]),
|
|
689
|
+
_: 3
|
|
690
|
+
}, 8, ["disable-outside-pointer-events"])]),
|
|
691
|
+
_: 3
|
|
692
|
+
})]),
|
|
693
|
+
_: 3
|
|
694
|
+
});
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
var SelectContentImpl_default = SelectContentImpl_vue_vue_type_script_setup_true_lang_default;
|
|
699
|
+
const [injectSelectItemAlignedPositionContext, provideSelectItemAlignedPositionContext] = createContext("SelectItemAlignedPosition");
|
|
700
|
+
var SelectItemAlignedPosition_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
701
|
+
inheritAttrs: false,
|
|
702
|
+
__name: "SelectItemAlignedPosition",
|
|
703
|
+
props: {
|
|
704
|
+
asChild: {
|
|
705
|
+
type: Boolean,
|
|
706
|
+
required: false
|
|
707
|
+
},
|
|
708
|
+
as: {
|
|
709
|
+
type: null,
|
|
710
|
+
required: false
|
|
711
|
+
}
|
|
712
|
+
},
|
|
713
|
+
emits: ["placed"],
|
|
714
|
+
setup(__props, { emit: __emit }) {
|
|
715
|
+
const props = __props;
|
|
716
|
+
const emits = __emit;
|
|
717
|
+
const { getItems } = useCollection();
|
|
718
|
+
const rootContext = injectSelectRootContext();
|
|
719
|
+
const contentContext = injectSelectContentContext();
|
|
720
|
+
const shouldExpandOnScrollRef = ref(false);
|
|
721
|
+
const shouldRepositionRef = ref(true);
|
|
722
|
+
const contentWrapperElement = ref();
|
|
723
|
+
const { forwardRef, currentElement: contentElement } = useForwardExpose();
|
|
724
|
+
const { viewport, selectedItem, selectedItemText, focusSelectedItem } = contentContext;
|
|
725
|
+
function position() {
|
|
726
|
+
if (rootContext.triggerElement.value && rootContext.valueElement.value && contentWrapperElement.value && contentElement.value && (viewport == null ? void 0 : viewport.value) && (selectedItem == null ? void 0 : selectedItem.value) && (selectedItemText == null ? void 0 : selectedItemText.value)) {
|
|
727
|
+
const triggerRect = rootContext.triggerElement.value.getBoundingClientRect();
|
|
728
|
+
const contentRect = contentElement.value.getBoundingClientRect();
|
|
729
|
+
const valueNodeRect = rootContext.valueElement.value.getBoundingClientRect();
|
|
730
|
+
const itemTextRect = selectedItemText.value.getBoundingClientRect();
|
|
731
|
+
if (rootContext.dir.value !== "rtl") {
|
|
732
|
+
const itemTextOffset = itemTextRect.left - contentRect.left;
|
|
733
|
+
const left = valueNodeRect.left - itemTextOffset;
|
|
734
|
+
const leftDelta = triggerRect.left - left;
|
|
735
|
+
const minContentWidth = triggerRect.width + leftDelta;
|
|
736
|
+
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
737
|
+
const rightEdge = window.innerWidth - CONTENT_MARGIN;
|
|
738
|
+
const clampedLeft = clamp(left, CONTENT_MARGIN, Math.max(CONTENT_MARGIN, rightEdge - contentWidth));
|
|
739
|
+
contentWrapperElement.value.style.minWidth = `${minContentWidth}px`;
|
|
740
|
+
contentWrapperElement.value.style.left = `${clampedLeft}px`;
|
|
741
|
+
} else {
|
|
742
|
+
const itemTextOffset = contentRect.right - itemTextRect.right;
|
|
743
|
+
const right = window.innerWidth - valueNodeRect.right - itemTextOffset;
|
|
744
|
+
const rightDelta = window.innerWidth - triggerRect.right - right;
|
|
745
|
+
const minContentWidth = triggerRect.width + rightDelta;
|
|
746
|
+
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
747
|
+
const leftEdge = window.innerWidth - CONTENT_MARGIN;
|
|
748
|
+
const clampedRight = clamp(right, CONTENT_MARGIN, Math.max(CONTENT_MARGIN, leftEdge - contentWidth));
|
|
749
|
+
contentWrapperElement.value.style.minWidth = `${minContentWidth}px`;
|
|
750
|
+
contentWrapperElement.value.style.right = `${clampedRight}px`;
|
|
751
|
+
}
|
|
752
|
+
const items = getItems().map((i) => i.ref);
|
|
753
|
+
const availableHeight = window.innerHeight - CONTENT_MARGIN * 2;
|
|
754
|
+
const itemsHeight = viewport.value.scrollHeight;
|
|
755
|
+
const contentStyles = window.getComputedStyle(contentElement.value);
|
|
756
|
+
const contentBorderTopWidth = Number.parseInt(contentStyles.borderTopWidth, 10);
|
|
757
|
+
const contentPaddingTop = Number.parseInt(contentStyles.paddingTop, 10);
|
|
758
|
+
const contentBorderBottomWidth = Number.parseInt(contentStyles.borderBottomWidth, 10);
|
|
759
|
+
const contentPaddingBottom = Number.parseInt(contentStyles.paddingBottom, 10);
|
|
760
|
+
const fullContentHeight = contentBorderTopWidth + contentPaddingTop + itemsHeight + contentPaddingBottom + contentBorderBottomWidth;
|
|
761
|
+
const minContentHeight = Math.min(selectedItem.value.offsetHeight * 5, fullContentHeight);
|
|
762
|
+
const viewportStyles = window.getComputedStyle(viewport.value);
|
|
763
|
+
const viewportPaddingTop = Number.parseInt(viewportStyles.paddingTop, 10);
|
|
764
|
+
const viewportPaddingBottom = Number.parseInt(viewportStyles.paddingBottom, 10);
|
|
765
|
+
const topEdgeToTriggerMiddle = triggerRect.top + triggerRect.height / 2 - CONTENT_MARGIN;
|
|
766
|
+
const triggerMiddleToBottomEdge = availableHeight - topEdgeToTriggerMiddle;
|
|
767
|
+
const selectedItemHalfHeight = selectedItem.value.offsetHeight / 2;
|
|
768
|
+
const itemOffsetMiddle = selectedItem.value.offsetTop + selectedItemHalfHeight;
|
|
769
|
+
const contentTopToItemMiddle = contentBorderTopWidth + contentPaddingTop + itemOffsetMiddle;
|
|
770
|
+
const itemMiddleToContentBottom = fullContentHeight - contentTopToItemMiddle;
|
|
771
|
+
const willAlignWithoutTopOverflow = contentTopToItemMiddle <= topEdgeToTriggerMiddle;
|
|
772
|
+
if (willAlignWithoutTopOverflow) {
|
|
773
|
+
const isLastItem = selectedItem.value === items[items.length - 1];
|
|
774
|
+
contentWrapperElement.value.style.bottom = `0px`;
|
|
775
|
+
const viewportOffsetBottom = contentElement.value.clientHeight - viewport.value.offsetTop - viewport.value.offsetHeight;
|
|
776
|
+
const clampedTriggerMiddleToBottomEdge = Math.max(triggerMiddleToBottomEdge, selectedItemHalfHeight + (isLastItem ? viewportPaddingBottom : 0) + viewportOffsetBottom + contentBorderBottomWidth);
|
|
777
|
+
const height = contentTopToItemMiddle + clampedTriggerMiddleToBottomEdge;
|
|
778
|
+
contentWrapperElement.value.style.height = `${height}px`;
|
|
779
|
+
} else {
|
|
780
|
+
const isFirstItem = selectedItem.value === items[0];
|
|
781
|
+
contentWrapperElement.value.style.top = `0px`;
|
|
782
|
+
const clampedTopEdgeToTriggerMiddle = Math.max(topEdgeToTriggerMiddle, contentBorderTopWidth + viewport.value.offsetTop + (isFirstItem ? viewportPaddingTop : 0) + selectedItemHalfHeight);
|
|
783
|
+
const height = clampedTopEdgeToTriggerMiddle + itemMiddleToContentBottom;
|
|
784
|
+
contentWrapperElement.value.style.height = `${height}px`;
|
|
785
|
+
viewport.value.scrollTop = contentTopToItemMiddle - topEdgeToTriggerMiddle + viewport.value.offsetTop;
|
|
786
|
+
}
|
|
787
|
+
contentWrapperElement.value.style.margin = `${CONTENT_MARGIN}px 0`;
|
|
788
|
+
contentWrapperElement.value.style.minHeight = `${minContentHeight}px`;
|
|
789
|
+
contentWrapperElement.value.style.maxHeight = `${availableHeight}px`;
|
|
790
|
+
emits("placed");
|
|
791
|
+
requestAnimationFrame(() => shouldExpandOnScrollRef.value = true);
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
const contentZIndex = ref("");
|
|
795
|
+
onMounted(async () => {
|
|
796
|
+
await nextTick();
|
|
797
|
+
position();
|
|
798
|
+
if (contentElement.value) contentZIndex.value = window.getComputedStyle(contentElement.value).zIndex;
|
|
799
|
+
});
|
|
800
|
+
function handleScrollButtonChange(node) {
|
|
801
|
+
if (node && shouldRepositionRef.value === true) {
|
|
802
|
+
position();
|
|
803
|
+
focusSelectedItem == null ? void 0 : focusSelectedItem();
|
|
804
|
+
shouldRepositionRef.value = false;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
useResizeObserver(rootContext.triggerElement, () => {
|
|
808
|
+
position();
|
|
809
|
+
});
|
|
810
|
+
provideSelectItemAlignedPositionContext({
|
|
811
|
+
contentWrapper: contentWrapperElement,
|
|
812
|
+
shouldExpandOnScrollRef,
|
|
813
|
+
onScrollButtonChange: handleScrollButtonChange
|
|
814
|
+
});
|
|
815
|
+
return (_ctx, _cache) => {
|
|
816
|
+
return openBlock(), createElementBlock("div", {
|
|
817
|
+
ref_key: "contentWrapperElement",
|
|
818
|
+
ref: contentWrapperElement,
|
|
819
|
+
style: normalizeStyle({
|
|
820
|
+
display: "flex",
|
|
821
|
+
flexDirection: "column",
|
|
822
|
+
position: "fixed",
|
|
823
|
+
zIndex: contentZIndex.value
|
|
824
|
+
})
|
|
825
|
+
}, [createVNode(unref(Primitive), mergeProps({
|
|
826
|
+
ref: unref(forwardRef),
|
|
827
|
+
style: {
|
|
828
|
+
boxSizing: "border-box",
|
|
829
|
+
maxHeight: "100%"
|
|
830
|
+
}
|
|
831
|
+
}, {
|
|
832
|
+
..._ctx.$attrs,
|
|
833
|
+
...props
|
|
834
|
+
}), {
|
|
835
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
836
|
+
_: 3
|
|
837
|
+
}, 16)], 4);
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
});
|
|
841
|
+
var SelectItemAlignedPosition_default = SelectItemAlignedPosition_vue_vue_type_script_setup_true_lang_default;
|
|
842
|
+
var SelectProvider_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
843
|
+
inheritAttrs: false,
|
|
844
|
+
__name: "SelectProvider",
|
|
845
|
+
props: { context: {
|
|
846
|
+
type: Object,
|
|
847
|
+
required: true
|
|
848
|
+
} },
|
|
849
|
+
setup(__props) {
|
|
850
|
+
const props = __props;
|
|
851
|
+
provideSelectRootContext(props.context);
|
|
852
|
+
provideSelectContentContext(SelectContentDefaultContextValue);
|
|
853
|
+
return (_ctx, _cache) => {
|
|
854
|
+
return renderSlot(_ctx.$slots, "default");
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
});
|
|
858
|
+
var SelectProvider_default = SelectProvider_vue_vue_type_script_setup_true_lang_default;
|
|
859
|
+
const _hoisted_1$1 = { key: 1 };
|
|
860
|
+
var SelectContent_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
861
|
+
inheritAttrs: false,
|
|
862
|
+
__name: "SelectContent",
|
|
863
|
+
props: {
|
|
864
|
+
forceMount: {
|
|
865
|
+
type: Boolean,
|
|
866
|
+
required: false
|
|
867
|
+
},
|
|
868
|
+
position: {
|
|
869
|
+
type: String,
|
|
870
|
+
required: false
|
|
871
|
+
},
|
|
872
|
+
bodyLock: {
|
|
873
|
+
type: Boolean,
|
|
874
|
+
required: false
|
|
875
|
+
},
|
|
876
|
+
side: {
|
|
877
|
+
type: null,
|
|
878
|
+
required: false
|
|
879
|
+
},
|
|
880
|
+
sideOffset: {
|
|
881
|
+
type: Number,
|
|
882
|
+
required: false
|
|
883
|
+
},
|
|
884
|
+
sideFlip: {
|
|
885
|
+
type: Boolean,
|
|
886
|
+
required: false
|
|
887
|
+
},
|
|
888
|
+
align: {
|
|
889
|
+
type: null,
|
|
890
|
+
required: false
|
|
891
|
+
},
|
|
892
|
+
alignOffset: {
|
|
893
|
+
type: Number,
|
|
894
|
+
required: false
|
|
895
|
+
},
|
|
896
|
+
alignFlip: {
|
|
897
|
+
type: Boolean,
|
|
898
|
+
required: false
|
|
899
|
+
},
|
|
900
|
+
avoidCollisions: {
|
|
901
|
+
type: Boolean,
|
|
902
|
+
required: false
|
|
903
|
+
},
|
|
904
|
+
collisionBoundary: {
|
|
905
|
+
type: null,
|
|
906
|
+
required: false
|
|
907
|
+
},
|
|
908
|
+
collisionPadding: {
|
|
909
|
+
type: [Number, Object],
|
|
910
|
+
required: false
|
|
911
|
+
},
|
|
912
|
+
arrowPadding: {
|
|
913
|
+
type: Number,
|
|
914
|
+
required: false
|
|
915
|
+
},
|
|
916
|
+
hideShiftedArrow: {
|
|
917
|
+
type: Boolean,
|
|
918
|
+
required: false
|
|
919
|
+
},
|
|
920
|
+
sticky: {
|
|
921
|
+
type: String,
|
|
922
|
+
required: false
|
|
923
|
+
},
|
|
924
|
+
hideWhenDetached: {
|
|
925
|
+
type: Boolean,
|
|
926
|
+
required: false
|
|
927
|
+
},
|
|
928
|
+
positionStrategy: {
|
|
929
|
+
type: String,
|
|
930
|
+
required: false
|
|
931
|
+
},
|
|
932
|
+
updatePositionStrategy: {
|
|
933
|
+
type: String,
|
|
934
|
+
required: false
|
|
935
|
+
},
|
|
936
|
+
disableUpdateOnLayoutShift: {
|
|
937
|
+
type: Boolean,
|
|
938
|
+
required: false
|
|
939
|
+
},
|
|
940
|
+
prioritizePosition: {
|
|
941
|
+
type: Boolean,
|
|
942
|
+
required: false
|
|
943
|
+
},
|
|
944
|
+
reference: {
|
|
945
|
+
type: null,
|
|
946
|
+
required: false
|
|
947
|
+
},
|
|
948
|
+
asChild: {
|
|
949
|
+
type: Boolean,
|
|
950
|
+
required: false
|
|
951
|
+
},
|
|
952
|
+
as: {
|
|
953
|
+
type: null,
|
|
954
|
+
required: false
|
|
955
|
+
},
|
|
956
|
+
disableOutsidePointerEvents: {
|
|
957
|
+
type: Boolean,
|
|
958
|
+
required: false
|
|
959
|
+
}
|
|
960
|
+
},
|
|
961
|
+
emits: [
|
|
962
|
+
"closeAutoFocus",
|
|
963
|
+
"escapeKeyDown",
|
|
964
|
+
"pointerDownOutside"
|
|
965
|
+
],
|
|
966
|
+
setup(__props, { emit: __emit }) {
|
|
967
|
+
const props = __props;
|
|
968
|
+
const emits = __emit;
|
|
969
|
+
const forwarded = useForwardPropsEmits(props, emits);
|
|
970
|
+
const rootContext = injectSelectRootContext();
|
|
971
|
+
const fragment = ref();
|
|
972
|
+
onMounted(() => {
|
|
973
|
+
fragment.value = new DocumentFragment();
|
|
974
|
+
});
|
|
975
|
+
const presenceRef = ref();
|
|
976
|
+
const present = computed(() => props.forceMount || rootContext.open.value);
|
|
977
|
+
const renderPresence = ref(present.value);
|
|
978
|
+
watch(present, () => {
|
|
979
|
+
setTimeout(() => renderPresence.value = present.value);
|
|
980
|
+
});
|
|
981
|
+
return (_ctx, _cache) => {
|
|
982
|
+
var _a;
|
|
983
|
+
return present.value || renderPresence.value || ((_a = presenceRef.value) == null ? void 0 : _a.present) ? (openBlock(), createBlock(unref(Presence_default), {
|
|
984
|
+
key: 0,
|
|
985
|
+
ref_key: "presenceRef",
|
|
986
|
+
ref: presenceRef,
|
|
987
|
+
present: present.value
|
|
988
|
+
}, {
|
|
989
|
+
default: withCtx(() => [createVNode(SelectContentImpl_default, normalizeProps(guardReactiveProps({
|
|
990
|
+
...unref(forwarded),
|
|
991
|
+
..._ctx.$attrs
|
|
992
|
+
})), {
|
|
993
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
994
|
+
_: 3
|
|
995
|
+
}, 16)]),
|
|
996
|
+
_: 3
|
|
997
|
+
}, 8, ["present"])) : fragment.value ? (openBlock(), createElementBlock("div", _hoisted_1$1, [(openBlock(), createBlock(Teleport, { to: fragment.value }, [createVNode(SelectProvider_default, { context: unref(rootContext) }, {
|
|
998
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
999
|
+
_: 3
|
|
1000
|
+
}, 8, ["context"])], 8, ["to"]))])) : createCommentVNode("v-if", true);
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
1003
|
+
});
|
|
1004
|
+
var SelectContent_default = SelectContent_vue_vue_type_script_setup_true_lang_default;
|
|
1005
|
+
const [injectSelectGroupContext, provideSelectGroupContext] = createContext("SelectGroup");
|
|
1006
|
+
var SelectGroup_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
1007
|
+
__name: "SelectGroup",
|
|
1008
|
+
props: {
|
|
1009
|
+
asChild: {
|
|
1010
|
+
type: Boolean,
|
|
1011
|
+
required: false
|
|
1012
|
+
},
|
|
1013
|
+
as: {
|
|
1014
|
+
type: null,
|
|
1015
|
+
required: false
|
|
1016
|
+
}
|
|
1017
|
+
},
|
|
1018
|
+
setup(__props) {
|
|
1019
|
+
const props = __props;
|
|
1020
|
+
const id = useId(void 0, "reka-select-group");
|
|
1021
|
+
provideSelectGroupContext({ id });
|
|
1022
|
+
return (_ctx, _cache) => {
|
|
1023
|
+
return openBlock(), createBlock(unref(Primitive), mergeProps({ role: "group" }, props, { "aria-labelledby": unref(id) }), {
|
|
1024
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
1025
|
+
_: 3
|
|
1026
|
+
}, 16, ["aria-labelledby"]);
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
});
|
|
1030
|
+
var SelectGroup_default = SelectGroup_vue_vue_type_script_setup_true_lang_default;
|
|
1031
|
+
var SelectIcon_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
1032
|
+
__name: "SelectIcon",
|
|
1033
|
+
props: {
|
|
1034
|
+
asChild: {
|
|
1035
|
+
type: Boolean,
|
|
1036
|
+
required: false
|
|
1037
|
+
},
|
|
1038
|
+
as: {
|
|
1039
|
+
type: null,
|
|
1040
|
+
required: false,
|
|
1041
|
+
default: "span"
|
|
1042
|
+
}
|
|
1043
|
+
},
|
|
1044
|
+
setup(__props) {
|
|
1045
|
+
return (_ctx, _cache) => {
|
|
1046
|
+
return openBlock(), createBlock(unref(Primitive), {
|
|
1047
|
+
"aria-hidden": "true",
|
|
1048
|
+
as: _ctx.as,
|
|
1049
|
+
"as-child": _ctx.asChild
|
|
1050
|
+
}, {
|
|
1051
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default", {}, () => [_cache[0] || (_cache[0] = createTextVNode("▼"))])]),
|
|
1052
|
+
_: 3
|
|
1053
|
+
}, 8, ["as", "as-child"]);
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
});
|
|
1057
|
+
var SelectIcon_default = SelectIcon_vue_vue_type_script_setup_true_lang_default;
|
|
1058
|
+
const [injectSelectItemContext, provideSelectItemContext] = createContext("SelectItem");
|
|
1059
|
+
var SelectItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
1060
|
+
__name: "SelectItem",
|
|
1061
|
+
props: {
|
|
1062
|
+
value: {
|
|
1063
|
+
type: null,
|
|
1064
|
+
required: true
|
|
1065
|
+
},
|
|
1066
|
+
disabled: {
|
|
1067
|
+
type: Boolean,
|
|
1068
|
+
required: false
|
|
1069
|
+
},
|
|
1070
|
+
textValue: {
|
|
1071
|
+
type: String,
|
|
1072
|
+
required: false
|
|
1073
|
+
},
|
|
1074
|
+
asChild: {
|
|
1075
|
+
type: Boolean,
|
|
1076
|
+
required: false
|
|
1077
|
+
},
|
|
1078
|
+
as: {
|
|
1079
|
+
type: null,
|
|
1080
|
+
required: false
|
|
1081
|
+
}
|
|
1082
|
+
},
|
|
1083
|
+
emits: ["select"],
|
|
1084
|
+
setup(__props, { emit: __emit }) {
|
|
1085
|
+
const props = __props;
|
|
1086
|
+
const emits = __emit;
|
|
1087
|
+
const { disabled } = toRefs(props);
|
|
1088
|
+
const rootContext = injectSelectRootContext();
|
|
1089
|
+
const contentContext = injectSelectContentContext();
|
|
1090
|
+
const { forwardRef, currentElement } = useForwardExpose();
|
|
1091
|
+
const { CollectionItem } = useCollection();
|
|
1092
|
+
const isSelected = computed(() => {
|
|
1093
|
+
var _a;
|
|
1094
|
+
return valueComparator((_a = rootContext.modelValue) == null ? void 0 : _a.value, props.value, rootContext.by);
|
|
1095
|
+
});
|
|
1096
|
+
const isFocused = ref(false);
|
|
1097
|
+
const textValue = ref(props.textValue ?? "");
|
|
1098
|
+
const textId = useId(void 0, "reka-select-item-text");
|
|
1099
|
+
const SELECT_SELECT = "select.select";
|
|
1100
|
+
async function handleSelectCustomEvent(ev) {
|
|
1101
|
+
if (ev.defaultPrevented) return;
|
|
1102
|
+
const eventDetail = {
|
|
1103
|
+
originalEvent: ev,
|
|
1104
|
+
value: props.value
|
|
1105
|
+
};
|
|
1106
|
+
handleAndDispatchCustomEvent(SELECT_SELECT, handleSelect, eventDetail);
|
|
1107
|
+
}
|
|
1108
|
+
async function handleSelect(ev) {
|
|
1109
|
+
await nextTick();
|
|
1110
|
+
emits("select", ev);
|
|
1111
|
+
if (ev.defaultPrevented) return;
|
|
1112
|
+
if (!disabled.value) {
|
|
1113
|
+
rootContext.onValueChange(props.value);
|
|
1114
|
+
if (!rootContext.multiple.value) rootContext.onOpenChange(false);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
async function handlePointerMove(event) {
|
|
1118
|
+
var _a, _b;
|
|
1119
|
+
await nextTick();
|
|
1120
|
+
if (event.defaultPrevented) return;
|
|
1121
|
+
if (disabled.value) (_a = contentContext.onItemLeave) == null ? void 0 : _a.call(contentContext);
|
|
1122
|
+
else (_b = event.currentTarget) == null ? void 0 : _b.focus({ preventScroll: true });
|
|
1123
|
+
}
|
|
1124
|
+
async function handlePointerLeave(event) {
|
|
1125
|
+
var _a;
|
|
1126
|
+
await nextTick();
|
|
1127
|
+
if (event.defaultPrevented) return;
|
|
1128
|
+
if (event.currentTarget === getActiveElement()) (_a = contentContext.onItemLeave) == null ? void 0 : _a.call(contentContext);
|
|
1129
|
+
}
|
|
1130
|
+
async function handleKeyDown(event) {
|
|
1131
|
+
var _a;
|
|
1132
|
+
await nextTick();
|
|
1133
|
+
if (event.defaultPrevented) return;
|
|
1134
|
+
const isTypingAhead = ((_a = contentContext.searchRef) == null ? void 0 : _a.value) !== "";
|
|
1135
|
+
if (isTypingAhead && event.key === " ") return;
|
|
1136
|
+
if (SELECTION_KEYS.includes(event.key)) handleSelectCustomEvent(event);
|
|
1137
|
+
if (event.key === " ") event.preventDefault();
|
|
1138
|
+
}
|
|
1139
|
+
if (props.value === "") throw new Error("A <SelectItem /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");
|
|
1140
|
+
onMounted(() => {
|
|
1141
|
+
if (!currentElement.value) return;
|
|
1142
|
+
contentContext.itemRefCallback(currentElement.value, props.value, props.disabled);
|
|
1143
|
+
});
|
|
1144
|
+
provideSelectItemContext({
|
|
1145
|
+
value: props.value,
|
|
1146
|
+
disabled,
|
|
1147
|
+
textId,
|
|
1148
|
+
isSelected,
|
|
1149
|
+
onItemTextChange: (node) => {
|
|
1150
|
+
textValue.value = ((textValue.value || (node == null ? void 0 : node.textContent)) ?? "").trim();
|
|
1151
|
+
}
|
|
1152
|
+
});
|
|
1153
|
+
return (_ctx, _cache) => {
|
|
1154
|
+
return openBlock(), createBlock(unref(CollectionItem), { value: { textValue: textValue.value } }, {
|
|
1155
|
+
default: withCtx(() => [createVNode(unref(Primitive), {
|
|
1156
|
+
ref: unref(forwardRef),
|
|
1157
|
+
role: "option",
|
|
1158
|
+
"aria-labelledby": unref(textId),
|
|
1159
|
+
"data-highlighted": isFocused.value ? "" : void 0,
|
|
1160
|
+
"aria-selected": isSelected.value,
|
|
1161
|
+
"data-state": isSelected.value ? "checked" : "unchecked",
|
|
1162
|
+
"aria-disabled": unref(disabled) || void 0,
|
|
1163
|
+
"data-disabled": unref(disabled) ? "" : void 0,
|
|
1164
|
+
tabindex: unref(disabled) ? void 0 : -1,
|
|
1165
|
+
as: _ctx.as,
|
|
1166
|
+
"as-child": _ctx.asChild,
|
|
1167
|
+
onFocus: _cache[0] || (_cache[0] = ($event) => isFocused.value = true),
|
|
1168
|
+
onBlur: _cache[1] || (_cache[1] = ($event) => isFocused.value = false),
|
|
1169
|
+
onPointerup: handleSelectCustomEvent,
|
|
1170
|
+
onPointerdown: _cache[2] || (_cache[2] = (event) => {
|
|
1171
|
+
event.currentTarget.focus({ preventScroll: true });
|
|
1172
|
+
}),
|
|
1173
|
+
onTouchend: _cache[3] || (_cache[3] = withModifiers(() => {
|
|
1174
|
+
}, ["prevent", "stop"])),
|
|
1175
|
+
onPointermove: handlePointerMove,
|
|
1176
|
+
onPointerleave: handlePointerLeave,
|
|
1177
|
+
onKeydown: handleKeyDown
|
|
1178
|
+
}, {
|
|
1179
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
1180
|
+
_: 3
|
|
1181
|
+
}, 8, [
|
|
1182
|
+
"aria-labelledby",
|
|
1183
|
+
"data-highlighted",
|
|
1184
|
+
"aria-selected",
|
|
1185
|
+
"data-state",
|
|
1186
|
+
"aria-disabled",
|
|
1187
|
+
"data-disabled",
|
|
1188
|
+
"tabindex",
|
|
1189
|
+
"as",
|
|
1190
|
+
"as-child"
|
|
1191
|
+
])]),
|
|
1192
|
+
_: 3
|
|
1193
|
+
}, 8, ["value"]);
|
|
1194
|
+
};
|
|
1195
|
+
}
|
|
1196
|
+
});
|
|
1197
|
+
var SelectItem_default = SelectItem_vue_vue_type_script_setup_true_lang_default;
|
|
1198
|
+
var SelectItemIndicator_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
1199
|
+
__name: "SelectItemIndicator",
|
|
1200
|
+
props: {
|
|
1201
|
+
asChild: {
|
|
1202
|
+
type: Boolean,
|
|
1203
|
+
required: false
|
|
1204
|
+
},
|
|
1205
|
+
as: {
|
|
1206
|
+
type: null,
|
|
1207
|
+
required: false,
|
|
1208
|
+
default: "span"
|
|
1209
|
+
}
|
|
1210
|
+
},
|
|
1211
|
+
setup(__props) {
|
|
1212
|
+
const props = __props;
|
|
1213
|
+
const itemContext = injectSelectItemContext();
|
|
1214
|
+
return (_ctx, _cache) => {
|
|
1215
|
+
return unref(itemContext).isSelected.value ? (openBlock(), createBlock(unref(Primitive), mergeProps({
|
|
1216
|
+
key: 0,
|
|
1217
|
+
"aria-hidden": "true"
|
|
1218
|
+
}, props), {
|
|
1219
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
1220
|
+
_: 3
|
|
1221
|
+
}, 16)) : createCommentVNode("v-if", true);
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1224
|
+
});
|
|
1225
|
+
var SelectItemIndicator_default = SelectItemIndicator_vue_vue_type_script_setup_true_lang_default;
|
|
1226
|
+
var SelectItemText_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
1227
|
+
inheritAttrs: false,
|
|
1228
|
+
__name: "SelectItemText",
|
|
1229
|
+
props: {
|
|
1230
|
+
asChild: {
|
|
1231
|
+
type: Boolean,
|
|
1232
|
+
required: false
|
|
1233
|
+
},
|
|
1234
|
+
as: {
|
|
1235
|
+
type: null,
|
|
1236
|
+
required: false,
|
|
1237
|
+
default: "span"
|
|
1238
|
+
}
|
|
1239
|
+
},
|
|
1240
|
+
setup(__props) {
|
|
1241
|
+
const props = __props;
|
|
1242
|
+
const rootContext = injectSelectRootContext();
|
|
1243
|
+
const contentContext = injectSelectContentContext();
|
|
1244
|
+
const itemContext = injectSelectItemContext();
|
|
1245
|
+
const { forwardRef, currentElement: itemTextElement } = useForwardExpose();
|
|
1246
|
+
const optionProps = computed(() => {
|
|
1247
|
+
var _a, _b;
|
|
1248
|
+
return {
|
|
1249
|
+
value: itemContext.value,
|
|
1250
|
+
disabled: itemContext.disabled.value,
|
|
1251
|
+
textContent: ((_a = itemTextElement.value) == null ? void 0 : _a.textContent) ?? ((_b = itemContext.value) == null ? void 0 : _b.toString()) ?? ""
|
|
1252
|
+
};
|
|
1253
|
+
});
|
|
1254
|
+
onMounted(() => {
|
|
1255
|
+
if (!itemTextElement.value) return;
|
|
1256
|
+
itemContext.onItemTextChange(itemTextElement.value);
|
|
1257
|
+
contentContext.itemTextRefCallback(itemTextElement.value, itemContext.value, itemContext.disabled.value);
|
|
1258
|
+
rootContext.onOptionAdd(optionProps.value);
|
|
1259
|
+
});
|
|
1260
|
+
onUnmounted(() => {
|
|
1261
|
+
rootContext.onOptionRemove(optionProps.value);
|
|
1262
|
+
});
|
|
1263
|
+
return (_ctx, _cache) => {
|
|
1264
|
+
return openBlock(), createBlock(unref(Primitive), mergeProps({
|
|
1265
|
+
id: unref(itemContext).textId,
|
|
1266
|
+
ref: unref(forwardRef)
|
|
1267
|
+
}, {
|
|
1268
|
+
...props,
|
|
1269
|
+
..._ctx.$attrs
|
|
1270
|
+
}), {
|
|
1271
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
1272
|
+
_: 3
|
|
1273
|
+
}, 16, ["id"]);
|
|
1274
|
+
};
|
|
1275
|
+
}
|
|
1276
|
+
});
|
|
1277
|
+
var SelectItemText_default = SelectItemText_vue_vue_type_script_setup_true_lang_default;
|
|
1278
|
+
var SelectLabel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
1279
|
+
__name: "SelectLabel",
|
|
1280
|
+
props: {
|
|
1281
|
+
for: {
|
|
1282
|
+
type: String,
|
|
1283
|
+
required: false
|
|
1284
|
+
},
|
|
1285
|
+
asChild: {
|
|
1286
|
+
type: Boolean,
|
|
1287
|
+
required: false
|
|
1288
|
+
},
|
|
1289
|
+
as: {
|
|
1290
|
+
type: null,
|
|
1291
|
+
required: false,
|
|
1292
|
+
default: "div"
|
|
1293
|
+
}
|
|
1294
|
+
},
|
|
1295
|
+
setup(__props) {
|
|
1296
|
+
const props = __props;
|
|
1297
|
+
const groupContext = injectSelectGroupContext({ id: "" });
|
|
1298
|
+
return (_ctx, _cache) => {
|
|
1299
|
+
return openBlock(), createBlock(unref(Primitive), mergeProps(props, { id: unref(groupContext).id }), {
|
|
1300
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
1301
|
+
_: 3
|
|
1302
|
+
}, 16, ["id"]);
|
|
1303
|
+
};
|
|
1304
|
+
}
|
|
1305
|
+
});
|
|
1306
|
+
var SelectLabel_default = SelectLabel_vue_vue_type_script_setup_true_lang_default;
|
|
1307
|
+
var SelectPortal_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
1308
|
+
__name: "SelectPortal",
|
|
1309
|
+
props: {
|
|
1310
|
+
to: {
|
|
1311
|
+
type: null,
|
|
1312
|
+
required: false
|
|
1313
|
+
},
|
|
1314
|
+
disabled: {
|
|
1315
|
+
type: Boolean,
|
|
1316
|
+
required: false
|
|
1317
|
+
},
|
|
1318
|
+
defer: {
|
|
1319
|
+
type: Boolean,
|
|
1320
|
+
required: false
|
|
1321
|
+
},
|
|
1322
|
+
forceMount: {
|
|
1323
|
+
type: Boolean,
|
|
1324
|
+
required: false
|
|
1325
|
+
}
|
|
1326
|
+
},
|
|
1327
|
+
setup(__props) {
|
|
1328
|
+
const props = __props;
|
|
1329
|
+
return (_ctx, _cache) => {
|
|
1330
|
+
return openBlock(), createBlock(unref(Teleport_default), normalizeProps(guardReactiveProps(props)), {
|
|
1331
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
1332
|
+
_: 3
|
|
1333
|
+
}, 16);
|
|
1334
|
+
};
|
|
1335
|
+
}
|
|
1336
|
+
});
|
|
1337
|
+
var SelectPortal_default = SelectPortal_vue_vue_type_script_setup_true_lang_default;
|
|
1338
|
+
var SelectScrollButtonImpl_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
1339
|
+
__name: "SelectScrollButtonImpl",
|
|
1340
|
+
emits: ["autoScroll"],
|
|
1341
|
+
setup(__props, { emit: __emit }) {
|
|
1342
|
+
const emits = __emit;
|
|
1343
|
+
const { getItems } = useCollection();
|
|
1344
|
+
const contentContext = injectSelectContentContext();
|
|
1345
|
+
const autoScrollTimerRef = ref(null);
|
|
1346
|
+
function clearAutoScrollTimer() {
|
|
1347
|
+
if (autoScrollTimerRef.value !== null) {
|
|
1348
|
+
window.clearInterval(autoScrollTimerRef.value);
|
|
1349
|
+
autoScrollTimerRef.value = null;
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
watchEffect(() => {
|
|
1353
|
+
const activeItem = getItems().map((i) => i.ref).find((item) => item === getActiveElement());
|
|
1354
|
+
activeItem == null ? void 0 : activeItem.scrollIntoView({ block: "nearest" });
|
|
1355
|
+
});
|
|
1356
|
+
function handlePointerDown() {
|
|
1357
|
+
if (autoScrollTimerRef.value === null) autoScrollTimerRef.value = window.setInterval(() => {
|
|
1358
|
+
emits("autoScroll");
|
|
1359
|
+
}, 50);
|
|
1360
|
+
}
|
|
1361
|
+
function handlePointerMove() {
|
|
1362
|
+
var _a;
|
|
1363
|
+
(_a = contentContext.onItemLeave) == null ? void 0 : _a.call(contentContext);
|
|
1364
|
+
if (autoScrollTimerRef.value === null) autoScrollTimerRef.value = window.setInterval(() => {
|
|
1365
|
+
emits("autoScroll");
|
|
1366
|
+
}, 50);
|
|
1367
|
+
}
|
|
1368
|
+
onBeforeUnmount(() => clearAutoScrollTimer());
|
|
1369
|
+
return (_ctx, _cache) => {
|
|
1370
|
+
var _a;
|
|
1371
|
+
return openBlock(), createBlock(unref(Primitive), mergeProps({
|
|
1372
|
+
"aria-hidden": "true",
|
|
1373
|
+
style: { flexShrink: 0 }
|
|
1374
|
+
}, (_a = _ctx.$parent) == null ? void 0 : _a.$props, {
|
|
1375
|
+
onPointerdown: handlePointerDown,
|
|
1376
|
+
onPointermove: handlePointerMove,
|
|
1377
|
+
onPointerleave: _cache[0] || (_cache[0] = () => {
|
|
1378
|
+
clearAutoScrollTimer();
|
|
1379
|
+
})
|
|
1380
|
+
}), {
|
|
1381
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
1382
|
+
_: 3
|
|
1383
|
+
}, 16);
|
|
1384
|
+
};
|
|
1385
|
+
}
|
|
1386
|
+
});
|
|
1387
|
+
var SelectScrollButtonImpl_default = SelectScrollButtonImpl_vue_vue_type_script_setup_true_lang_default;
|
|
1388
|
+
var SelectScrollDownButton_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
1389
|
+
__name: "SelectScrollDownButton",
|
|
1390
|
+
props: {
|
|
1391
|
+
asChild: {
|
|
1392
|
+
type: Boolean,
|
|
1393
|
+
required: false
|
|
1394
|
+
},
|
|
1395
|
+
as: {
|
|
1396
|
+
type: null,
|
|
1397
|
+
required: false
|
|
1398
|
+
}
|
|
1399
|
+
},
|
|
1400
|
+
setup(__props) {
|
|
1401
|
+
const contentContext = injectSelectContentContext();
|
|
1402
|
+
const alignedPositionContext = contentContext.position === "item-aligned" ? injectSelectItemAlignedPositionContext() : void 0;
|
|
1403
|
+
const { forwardRef, currentElement } = useForwardExpose();
|
|
1404
|
+
const canScrollDown = ref(false);
|
|
1405
|
+
watchEffect((cleanupFn) => {
|
|
1406
|
+
var _a, _b;
|
|
1407
|
+
if (((_a = contentContext.viewport) == null ? void 0 : _a.value) && ((_b = contentContext.isPositioned) == null ? void 0 : _b.value)) {
|
|
1408
|
+
let handleScroll = function() {
|
|
1409
|
+
const maxScroll = viewport.scrollHeight - viewport.clientHeight;
|
|
1410
|
+
canScrollDown.value = Math.ceil(viewport.scrollTop) < maxScroll;
|
|
1411
|
+
};
|
|
1412
|
+
const viewport = contentContext.viewport.value;
|
|
1413
|
+
handleScroll();
|
|
1414
|
+
viewport.addEventListener("scroll", handleScroll);
|
|
1415
|
+
cleanupFn(() => viewport.removeEventListener("scroll", handleScroll));
|
|
1416
|
+
}
|
|
1417
|
+
});
|
|
1418
|
+
watch(currentElement, () => {
|
|
1419
|
+
if (currentElement.value) alignedPositionContext == null ? void 0 : alignedPositionContext.onScrollButtonChange(currentElement.value);
|
|
1420
|
+
});
|
|
1421
|
+
return (_ctx, _cache) => {
|
|
1422
|
+
return canScrollDown.value ? (openBlock(), createBlock(SelectScrollButtonImpl_default, {
|
|
1423
|
+
key: 0,
|
|
1424
|
+
ref: unref(forwardRef),
|
|
1425
|
+
onAutoScroll: _cache[0] || (_cache[0] = () => {
|
|
1426
|
+
const { viewport, selectedItem } = unref(contentContext);
|
|
1427
|
+
if ((viewport == null ? void 0 : viewport.value) && (selectedItem == null ? void 0 : selectedItem.value)) viewport.value.scrollTop = viewport.value.scrollTop + selectedItem.value.offsetHeight;
|
|
1428
|
+
})
|
|
1429
|
+
}, {
|
|
1430
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
1431
|
+
_: 3
|
|
1432
|
+
}, 512)) : createCommentVNode("v-if", true);
|
|
1433
|
+
};
|
|
1434
|
+
}
|
|
1435
|
+
});
|
|
1436
|
+
var SelectScrollDownButton_default = SelectScrollDownButton_vue_vue_type_script_setup_true_lang_default;
|
|
1437
|
+
var SelectScrollUpButton_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
1438
|
+
__name: "SelectScrollUpButton",
|
|
1439
|
+
props: {
|
|
1440
|
+
asChild: {
|
|
1441
|
+
type: Boolean,
|
|
1442
|
+
required: false
|
|
1443
|
+
},
|
|
1444
|
+
as: {
|
|
1445
|
+
type: null,
|
|
1446
|
+
required: false
|
|
1447
|
+
}
|
|
1448
|
+
},
|
|
1449
|
+
setup(__props) {
|
|
1450
|
+
const contentContext = injectSelectContentContext();
|
|
1451
|
+
const alignedPositionContext = contentContext.position === "item-aligned" ? injectSelectItemAlignedPositionContext() : void 0;
|
|
1452
|
+
const { forwardRef, currentElement } = useForwardExpose();
|
|
1453
|
+
const canScrollUp = ref(false);
|
|
1454
|
+
watchEffect((cleanupFn) => {
|
|
1455
|
+
var _a, _b;
|
|
1456
|
+
if (((_a = contentContext.viewport) == null ? void 0 : _a.value) && ((_b = contentContext.isPositioned) == null ? void 0 : _b.value)) {
|
|
1457
|
+
let handleScroll = function() {
|
|
1458
|
+
canScrollUp.value = viewport.scrollTop > 0;
|
|
1459
|
+
};
|
|
1460
|
+
const viewport = contentContext.viewport.value;
|
|
1461
|
+
handleScroll();
|
|
1462
|
+
viewport.addEventListener("scroll", handleScroll);
|
|
1463
|
+
cleanupFn(() => viewport.removeEventListener("scroll", handleScroll));
|
|
1464
|
+
}
|
|
1465
|
+
});
|
|
1466
|
+
watch(currentElement, () => {
|
|
1467
|
+
if (currentElement.value) alignedPositionContext == null ? void 0 : alignedPositionContext.onScrollButtonChange(currentElement.value);
|
|
1468
|
+
});
|
|
1469
|
+
return (_ctx, _cache) => {
|
|
1470
|
+
return canScrollUp.value ? (openBlock(), createBlock(SelectScrollButtonImpl_default, {
|
|
1471
|
+
key: 0,
|
|
1472
|
+
ref: unref(forwardRef),
|
|
1473
|
+
onAutoScroll: _cache[0] || (_cache[0] = () => {
|
|
1474
|
+
const { viewport, selectedItem } = unref(contentContext);
|
|
1475
|
+
if ((viewport == null ? void 0 : viewport.value) && (selectedItem == null ? void 0 : selectedItem.value)) viewport.value.scrollTop = viewport.value.scrollTop - selectedItem.value.offsetHeight;
|
|
1476
|
+
})
|
|
1477
|
+
}, {
|
|
1478
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
1479
|
+
_: 3
|
|
1480
|
+
}, 512)) : createCommentVNode("v-if", true);
|
|
1481
|
+
};
|
|
1482
|
+
}
|
|
1483
|
+
});
|
|
1484
|
+
var SelectScrollUpButton_default = SelectScrollUpButton_vue_vue_type_script_setup_true_lang_default;
|
|
1485
|
+
var SelectSeparator_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
1486
|
+
__name: "SelectSeparator",
|
|
1487
|
+
props: {
|
|
1488
|
+
asChild: {
|
|
1489
|
+
type: Boolean,
|
|
1490
|
+
required: false
|
|
1491
|
+
},
|
|
1492
|
+
as: {
|
|
1493
|
+
type: null,
|
|
1494
|
+
required: false
|
|
1495
|
+
}
|
|
1496
|
+
},
|
|
1497
|
+
setup(__props) {
|
|
1498
|
+
const props = __props;
|
|
1499
|
+
return (_ctx, _cache) => {
|
|
1500
|
+
return openBlock(), createBlock(unref(Primitive), mergeProps({ "aria-hidden": "true" }, props), {
|
|
1501
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
1502
|
+
_: 3
|
|
1503
|
+
}, 16);
|
|
1504
|
+
};
|
|
1505
|
+
}
|
|
1506
|
+
});
|
|
1507
|
+
var SelectSeparator_default = SelectSeparator_vue_vue_type_script_setup_true_lang_default;
|
|
1508
|
+
var SelectTrigger_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
1509
|
+
__name: "SelectTrigger",
|
|
1510
|
+
props: {
|
|
1511
|
+
disabled: {
|
|
1512
|
+
type: Boolean,
|
|
1513
|
+
required: false
|
|
1514
|
+
},
|
|
1515
|
+
reference: {
|
|
1516
|
+
type: null,
|
|
1517
|
+
required: false
|
|
1518
|
+
},
|
|
1519
|
+
asChild: {
|
|
1520
|
+
type: Boolean,
|
|
1521
|
+
required: false
|
|
1522
|
+
},
|
|
1523
|
+
as: {
|
|
1524
|
+
type: null,
|
|
1525
|
+
required: false,
|
|
1526
|
+
default: "button"
|
|
1527
|
+
}
|
|
1528
|
+
},
|
|
1529
|
+
setup(__props) {
|
|
1530
|
+
const props = __props;
|
|
1531
|
+
const rootContext = injectSelectRootContext();
|
|
1532
|
+
const { forwardRef, currentElement: triggerElement } = useForwardExpose();
|
|
1533
|
+
const isDisabled = computed(() => {
|
|
1534
|
+
var _a;
|
|
1535
|
+
return ((_a = rootContext.disabled) == null ? void 0 : _a.value) || props.disabled;
|
|
1536
|
+
});
|
|
1537
|
+
rootContext.contentId || (rootContext.contentId = useId(void 0, "reka-select-content"));
|
|
1538
|
+
onMounted(() => {
|
|
1539
|
+
rootContext.onTriggerChange(triggerElement.value);
|
|
1540
|
+
});
|
|
1541
|
+
const { getItems } = useCollection();
|
|
1542
|
+
const { search, handleTypeaheadSearch, resetTypeahead } = useTypeahead();
|
|
1543
|
+
function handleOpen() {
|
|
1544
|
+
if (!isDisabled.value) {
|
|
1545
|
+
rootContext.onOpenChange(true);
|
|
1546
|
+
resetTypeahead();
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
function handlePointerOpen(event) {
|
|
1550
|
+
handleOpen();
|
|
1551
|
+
rootContext.triggerPointerDownPosRef.value = {
|
|
1552
|
+
x: Math.round(event.pageX),
|
|
1553
|
+
y: Math.round(event.pageY)
|
|
1554
|
+
};
|
|
1555
|
+
}
|
|
1556
|
+
return (_ctx, _cache) => {
|
|
1557
|
+
return openBlock(), createBlock(unref(PopperAnchor_default), {
|
|
1558
|
+
"as-child": "",
|
|
1559
|
+
reference: _ctx.reference
|
|
1560
|
+
}, {
|
|
1561
|
+
default: withCtx(() => {
|
|
1562
|
+
var _a, _b, _c, _d;
|
|
1563
|
+
return [createVNode(unref(Primitive), {
|
|
1564
|
+
ref: unref(forwardRef),
|
|
1565
|
+
role: "combobox",
|
|
1566
|
+
type: _ctx.as === "button" ? "button" : void 0,
|
|
1567
|
+
"aria-controls": unref(rootContext).contentId,
|
|
1568
|
+
"aria-expanded": unref(rootContext).open.value || false,
|
|
1569
|
+
"aria-required": (_a = unref(rootContext).required) == null ? void 0 : _a.value,
|
|
1570
|
+
"aria-autocomplete": "none",
|
|
1571
|
+
disabled: isDisabled.value,
|
|
1572
|
+
dir: (_b = unref(rootContext)) == null ? void 0 : _b.dir.value,
|
|
1573
|
+
"data-state": ((_c = unref(rootContext)) == null ? void 0 : _c.open.value) ? "open" : "closed",
|
|
1574
|
+
"data-disabled": isDisabled.value ? "" : void 0,
|
|
1575
|
+
"data-placeholder": unref(shouldShowPlaceholder)((_d = unref(rootContext).modelValue) == null ? void 0 : _d.value) ? "" : void 0,
|
|
1576
|
+
"as-child": _ctx.asChild,
|
|
1577
|
+
as: _ctx.as,
|
|
1578
|
+
onClick: _cache[0] || (_cache[0] = (event) => {
|
|
1579
|
+
var _a2;
|
|
1580
|
+
(_a2 = event == null ? void 0 : event.currentTarget) == null ? void 0 : _a2.focus();
|
|
1581
|
+
}),
|
|
1582
|
+
onPointerdown: _cache[1] || (_cache[1] = (event) => {
|
|
1583
|
+
if (event.pointerType === "touch") return event.preventDefault();
|
|
1584
|
+
const target = event.target;
|
|
1585
|
+
if (target.hasPointerCapture(event.pointerId)) target.releasePointerCapture(event.pointerId);
|
|
1586
|
+
if (event.button === 0 && event.ctrlKey === false) {
|
|
1587
|
+
handlePointerOpen(event);
|
|
1588
|
+
event.preventDefault();
|
|
1589
|
+
}
|
|
1590
|
+
}),
|
|
1591
|
+
onPointerup: _cache[2] || (_cache[2] = withModifiers((event) => {
|
|
1592
|
+
if (event.pointerType === "touch") handlePointerOpen(event);
|
|
1593
|
+
}, ["prevent"])),
|
|
1594
|
+
onKeydown: _cache[3] || (_cache[3] = (event) => {
|
|
1595
|
+
const isTypingAhead = unref(search) !== "";
|
|
1596
|
+
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
1597
|
+
if (!isModifierKey && event.key.length === 1) {
|
|
1598
|
+
if (isTypingAhead && event.key === " ") return;
|
|
1599
|
+
}
|
|
1600
|
+
unref(handleTypeaheadSearch)(event.key, unref(getItems)());
|
|
1601
|
+
if (unref(OPEN_KEYS).includes(event.key)) {
|
|
1602
|
+
handleOpen();
|
|
1603
|
+
event.preventDefault();
|
|
1604
|
+
}
|
|
1605
|
+
})
|
|
1606
|
+
}, {
|
|
1607
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
1608
|
+
_: 3
|
|
1609
|
+
}, 8, [
|
|
1610
|
+
"type",
|
|
1611
|
+
"aria-controls",
|
|
1612
|
+
"aria-expanded",
|
|
1613
|
+
"aria-required",
|
|
1614
|
+
"disabled",
|
|
1615
|
+
"dir",
|
|
1616
|
+
"data-state",
|
|
1617
|
+
"data-disabled",
|
|
1618
|
+
"data-placeholder",
|
|
1619
|
+
"as-child",
|
|
1620
|
+
"as"
|
|
1621
|
+
])];
|
|
1622
|
+
}),
|
|
1623
|
+
_: 3
|
|
1624
|
+
}, 8, ["reference"]);
|
|
1625
|
+
};
|
|
1626
|
+
}
|
|
1627
|
+
});
|
|
1628
|
+
var SelectTrigger_default = SelectTrigger_vue_vue_type_script_setup_true_lang_default;
|
|
1629
|
+
var SelectValue_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
1630
|
+
__name: "SelectValue",
|
|
1631
|
+
props: {
|
|
1632
|
+
placeholder: {
|
|
1633
|
+
type: String,
|
|
1634
|
+
required: false,
|
|
1635
|
+
default: ""
|
|
1636
|
+
},
|
|
1637
|
+
asChild: {
|
|
1638
|
+
type: Boolean,
|
|
1639
|
+
required: false
|
|
1640
|
+
},
|
|
1641
|
+
as: {
|
|
1642
|
+
type: null,
|
|
1643
|
+
required: false,
|
|
1644
|
+
default: "span"
|
|
1645
|
+
}
|
|
1646
|
+
},
|
|
1647
|
+
setup(__props) {
|
|
1648
|
+
const props = __props;
|
|
1649
|
+
const { forwardRef, currentElement } = useForwardExpose();
|
|
1650
|
+
const rootContext = injectSelectRootContext();
|
|
1651
|
+
onMounted(() => {
|
|
1652
|
+
rootContext.valueElement = currentElement;
|
|
1653
|
+
});
|
|
1654
|
+
const selectedLabel = computed(() => {
|
|
1655
|
+
var _a;
|
|
1656
|
+
let list = [];
|
|
1657
|
+
const options = Array.from(rootContext.optionsSet.value);
|
|
1658
|
+
const getOption = (value) => options.find((option) => valueComparator(value, option.value, rootContext.by));
|
|
1659
|
+
if (Array.isArray(rootContext.modelValue.value)) list = rootContext.modelValue.value.map((value) => {
|
|
1660
|
+
var _a2;
|
|
1661
|
+
return ((_a2 = getOption(value)) == null ? void 0 : _a2.textContent) ?? "";
|
|
1662
|
+
});
|
|
1663
|
+
else list = [((_a = getOption(rootContext.modelValue.value)) == null ? void 0 : _a.textContent) ?? ""];
|
|
1664
|
+
return list.filter(Boolean);
|
|
1665
|
+
});
|
|
1666
|
+
const slotText = computed(() => {
|
|
1667
|
+
return selectedLabel.value.length ? selectedLabel.value.join(", ") : props.placeholder;
|
|
1668
|
+
});
|
|
1669
|
+
return (_ctx, _cache) => {
|
|
1670
|
+
return openBlock(), createBlock(unref(Primitive), {
|
|
1671
|
+
ref: unref(forwardRef),
|
|
1672
|
+
as: _ctx.as,
|
|
1673
|
+
"as-child": _ctx.asChild,
|
|
1674
|
+
style: { pointerEvents: "none" },
|
|
1675
|
+
"data-placeholder": selectedLabel.value.length ? void 0 : props.placeholder
|
|
1676
|
+
}, {
|
|
1677
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default", {
|
|
1678
|
+
selectedLabel: selectedLabel.value,
|
|
1679
|
+
modelValue: unref(rootContext).modelValue.value
|
|
1680
|
+
}, () => [createTextVNode(toDisplayString(slotText.value), 1)])]),
|
|
1681
|
+
_: 3
|
|
1682
|
+
}, 8, [
|
|
1683
|
+
"as",
|
|
1684
|
+
"as-child",
|
|
1685
|
+
"data-placeholder"
|
|
1686
|
+
]);
|
|
1687
|
+
};
|
|
1688
|
+
}
|
|
1689
|
+
});
|
|
1690
|
+
var SelectValue_default = SelectValue_vue_vue_type_script_setup_true_lang_default;
|
|
1691
|
+
var SelectViewport_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
1692
|
+
__name: "SelectViewport",
|
|
1693
|
+
props: {
|
|
1694
|
+
nonce: {
|
|
1695
|
+
type: String,
|
|
1696
|
+
required: false
|
|
1697
|
+
},
|
|
1698
|
+
asChild: {
|
|
1699
|
+
type: Boolean,
|
|
1700
|
+
required: false
|
|
1701
|
+
},
|
|
1702
|
+
as: {
|
|
1703
|
+
type: null,
|
|
1704
|
+
required: false
|
|
1705
|
+
}
|
|
1706
|
+
},
|
|
1707
|
+
setup(__props) {
|
|
1708
|
+
const props = __props;
|
|
1709
|
+
const { nonce: propNonce } = toRefs(props);
|
|
1710
|
+
const nonce = useNonce(propNonce);
|
|
1711
|
+
const contentContext = injectSelectContentContext();
|
|
1712
|
+
const alignedPositionContext = contentContext.position === "item-aligned" ? injectSelectItemAlignedPositionContext() : void 0;
|
|
1713
|
+
const { forwardRef, currentElement } = useForwardExpose();
|
|
1714
|
+
onMounted(() => {
|
|
1715
|
+
contentContext == null ? void 0 : contentContext.onViewportChange(currentElement.value);
|
|
1716
|
+
});
|
|
1717
|
+
const prevScrollTopRef = ref(0);
|
|
1718
|
+
function handleScroll(event) {
|
|
1719
|
+
const viewport = event.currentTarget;
|
|
1720
|
+
const { shouldExpandOnScrollRef, contentWrapper } = alignedPositionContext ?? {};
|
|
1721
|
+
if ((shouldExpandOnScrollRef == null ? void 0 : shouldExpandOnScrollRef.value) && (contentWrapper == null ? void 0 : contentWrapper.value)) {
|
|
1722
|
+
const scrolledBy = Math.abs(prevScrollTopRef.value - viewport.scrollTop);
|
|
1723
|
+
if (scrolledBy > 0) {
|
|
1724
|
+
const availableHeight = window.innerHeight - CONTENT_MARGIN * 2;
|
|
1725
|
+
const cssMinHeight = Number.parseFloat(contentWrapper.value.style.minHeight);
|
|
1726
|
+
const cssHeight = Number.parseFloat(contentWrapper.value.style.height);
|
|
1727
|
+
const prevHeight = Math.max(cssMinHeight, cssHeight);
|
|
1728
|
+
if (prevHeight < availableHeight) {
|
|
1729
|
+
const nextHeight = prevHeight + scrolledBy;
|
|
1730
|
+
const clampedNextHeight = Math.min(availableHeight, nextHeight);
|
|
1731
|
+
const heightDiff = nextHeight - clampedNextHeight;
|
|
1732
|
+
contentWrapper.value.style.height = `${clampedNextHeight}px`;
|
|
1733
|
+
if (contentWrapper.value.style.bottom === "0px") {
|
|
1734
|
+
viewport.scrollTop = heightDiff > 0 ? heightDiff : 0;
|
|
1735
|
+
contentWrapper.value.style.justifyContent = "flex-end";
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
prevScrollTopRef.value = viewport.scrollTop;
|
|
1741
|
+
}
|
|
1742
|
+
return (_ctx, _cache) => {
|
|
1743
|
+
return openBlock(), createElementBlock(Fragment, null, [createVNode(unref(Primitive), mergeProps({
|
|
1744
|
+
ref: unref(forwardRef),
|
|
1745
|
+
"data-reka-select-viewport": "",
|
|
1746
|
+
role: "presentation"
|
|
1747
|
+
}, {
|
|
1748
|
+
..._ctx.$attrs,
|
|
1749
|
+
...props
|
|
1750
|
+
}, {
|
|
1751
|
+
style: {
|
|
1752
|
+
position: "relative",
|
|
1753
|
+
flex: 1,
|
|
1754
|
+
overflow: "hidden auto"
|
|
1755
|
+
},
|
|
1756
|
+
onScroll: handleScroll
|
|
1757
|
+
}), {
|
|
1758
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
1759
|
+
_: 3
|
|
1760
|
+
}, 16), createVNode(unref(Primitive), {
|
|
1761
|
+
as: "style",
|
|
1762
|
+
nonce: unref(nonce)
|
|
1763
|
+
}, {
|
|
1764
|
+
default: withCtx(() => _cache[0] || (_cache[0] = [createTextVNode(" /* Hide scrollbars cross-browser and enable momentum scroll for touch devices */ [data-reka-select-viewport] { scrollbar-width:none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } [data-reka-select-viewport]::-webkit-scrollbar { display: none; } ")])),
|
|
1765
|
+
_: 1,
|
|
1766
|
+
__: [0]
|
|
1767
|
+
}, 8, ["nonce"])], 64);
|
|
1768
|
+
};
|
|
1769
|
+
}
|
|
1770
|
+
});
|
|
1771
|
+
var SelectViewport_default = SelectViewport_vue_vue_type_script_setup_true_lang_default;
|
|
1772
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
1773
|
+
__name: "Select",
|
|
1774
|
+
props: {
|
|
1775
|
+
open: { type: Boolean },
|
|
1776
|
+
defaultOpen: { type: Boolean },
|
|
1777
|
+
defaultValue: {},
|
|
1778
|
+
modelValue: {},
|
|
1779
|
+
by: { type: [String, Function] },
|
|
1780
|
+
dir: {},
|
|
1781
|
+
multiple: { type: Boolean },
|
|
1782
|
+
autocomplete: {},
|
|
1783
|
+
disabled: { type: Boolean },
|
|
1784
|
+
name: {},
|
|
1785
|
+
required: { type: Boolean }
|
|
1786
|
+
},
|
|
1787
|
+
emits: ["update:modelValue", "update:open"],
|
|
1788
|
+
setup(__props, { emit: __emit }) {
|
|
1789
|
+
const props = __props;
|
|
1790
|
+
const emits = __emit;
|
|
1791
|
+
const forwarded = useForwardPropsEmits(props, emits);
|
|
1792
|
+
return (_ctx, _cache) => {
|
|
1793
|
+
return openBlock(), createBlock(unref(SelectRoot_default), mergeProps({ "data-slot": "select" }, unref(forwarded)), {
|
|
1794
|
+
default: withCtx((slotProps) => [
|
|
1795
|
+
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(slotProps)))
|
|
1796
|
+
]),
|
|
1797
|
+
_: 3
|
|
1798
|
+
}, 16);
|
|
1799
|
+
};
|
|
1800
|
+
}
|
|
1801
|
+
});
|
|
1802
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
1803
|
+
...{
|
|
1804
|
+
inheritAttrs: false
|
|
1805
|
+
},
|
|
1806
|
+
__name: "SelectContent",
|
|
1807
|
+
props: {
|
|
1808
|
+
forceMount: { type: Boolean },
|
|
1809
|
+
position: { default: "popper" },
|
|
1810
|
+
bodyLock: { type: Boolean },
|
|
1811
|
+
side: {},
|
|
1812
|
+
sideOffset: {},
|
|
1813
|
+
sideFlip: { type: Boolean },
|
|
1814
|
+
align: {},
|
|
1815
|
+
alignOffset: {},
|
|
1816
|
+
alignFlip: { type: Boolean },
|
|
1817
|
+
avoidCollisions: { type: Boolean },
|
|
1818
|
+
collisionBoundary: {},
|
|
1819
|
+
collisionPadding: {},
|
|
1820
|
+
arrowPadding: {},
|
|
1821
|
+
hideShiftedArrow: { type: Boolean },
|
|
1822
|
+
sticky: {},
|
|
1823
|
+
hideWhenDetached: { type: Boolean },
|
|
1824
|
+
positionStrategy: {},
|
|
1825
|
+
updatePositionStrategy: {},
|
|
1826
|
+
disableUpdateOnLayoutShift: { type: Boolean },
|
|
1827
|
+
prioritizePosition: { type: Boolean },
|
|
1828
|
+
reference: {},
|
|
1829
|
+
asChild: { type: Boolean },
|
|
1830
|
+
as: {},
|
|
1831
|
+
disableOutsidePointerEvents: { type: Boolean },
|
|
1832
|
+
class: {}
|
|
1833
|
+
},
|
|
1834
|
+
emits: ["closeAutoFocus", "escapeKeyDown", "pointerDownOutside"],
|
|
1835
|
+
setup(__props, { emit: __emit }) {
|
|
1836
|
+
const props = __props;
|
|
1837
|
+
const emits = __emit;
|
|
1838
|
+
const delegatedProps = reactiveOmit(props, "class");
|
|
1839
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
1840
|
+
return (_ctx, _cache) => {
|
|
1841
|
+
return openBlock(), createBlock(unref(SelectPortal_default), null, {
|
|
1842
|
+
default: withCtx(() => [
|
|
1843
|
+
createVNode(unref(SelectContent_default), mergeProps({ "data-slot": "select-content" }, { ..._ctx.$attrs, ...unref(forwarded) }, {
|
|
1844
|
+
class: unref(cn)(
|
|
1845
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--reka-select-content-available-height) min-w-[8rem] overflow-x-hidden overflow-y-auto rounded border border-border transition-colors duration-300 ease-in-out",
|
|
1846
|
+
_ctx.position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
1847
|
+
props.class
|
|
1848
|
+
)
|
|
1849
|
+
}), {
|
|
1850
|
+
default: withCtx(() => [
|
|
1851
|
+
createVNode(unref(_sfc_main$3)),
|
|
1852
|
+
createVNode(unref(SelectViewport_default), {
|
|
1853
|
+
class: normalizeClass(unref(cn)("p-1", _ctx.position === "popper" && "h-(--reka-select-trigger-height) w-full min-w-(--reka-select-trigger-width) scroll-my-1"))
|
|
1854
|
+
}, {
|
|
1855
|
+
default: withCtx(() => [
|
|
1856
|
+
renderSlot(_ctx.$slots, "default")
|
|
1857
|
+
]),
|
|
1858
|
+
_: 3
|
|
1859
|
+
}, 8, ["class"]),
|
|
1860
|
+
createVNode(unref(_sfc_main$4))
|
|
1861
|
+
]),
|
|
1862
|
+
_: 3
|
|
1863
|
+
}, 16, ["class"])
|
|
1864
|
+
]),
|
|
1865
|
+
_: 3
|
|
1866
|
+
});
|
|
1867
|
+
};
|
|
1868
|
+
}
|
|
1869
|
+
});
|
|
1870
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
1871
|
+
__name: "SelectGroup",
|
|
1872
|
+
props: {
|
|
1873
|
+
asChild: { type: Boolean },
|
|
1874
|
+
as: {}
|
|
1875
|
+
},
|
|
1876
|
+
setup(__props) {
|
|
1877
|
+
const props = __props;
|
|
1878
|
+
return (_ctx, _cache) => {
|
|
1879
|
+
return openBlock(), createBlock(unref(SelectGroup_default), mergeProps({ "data-slot": "select-group" }, props), {
|
|
1880
|
+
default: withCtx(() => [
|
|
1881
|
+
renderSlot(_ctx.$slots, "default")
|
|
1882
|
+
]),
|
|
1883
|
+
_: 3
|
|
1884
|
+
}, 16);
|
|
1885
|
+
};
|
|
1886
|
+
}
|
|
1887
|
+
});
|
|
1888
|
+
const _hoisted_1 = { class: "absolute right-2 flex size-3.5 items-center justify-center" };
|
|
1889
|
+
const _hoisted_2 = { class: "sr-only" };
|
|
1890
|
+
const _hoisted_3 = { class: "flex min-w-0 flex-1 flex-col" };
|
|
1891
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
1892
|
+
__name: "SelectItem",
|
|
1893
|
+
props: {
|
|
1894
|
+
value: {},
|
|
1895
|
+
disabled: { type: Boolean },
|
|
1896
|
+
textValue: {},
|
|
1897
|
+
asChild: { type: Boolean },
|
|
1898
|
+
as: {},
|
|
1899
|
+
class: {}
|
|
1900
|
+
},
|
|
1901
|
+
setup(__props) {
|
|
1902
|
+
const props = __props;
|
|
1903
|
+
const delegatedProps = reactiveOmit(props, "class");
|
|
1904
|
+
const forwardedProps = useForwardProps(delegatedProps);
|
|
1905
|
+
return (_ctx, _cache) => {
|
|
1906
|
+
return openBlock(), createBlock(unref(SelectItem_default), mergeProps({ "data-slot": "select-item" }, unref(forwardedProps), {
|
|
1907
|
+
class: unref(cn)(
|
|
1908
|
+
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-pointer items-center gap-2 rounded-sm py-2.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
1909
|
+
props.class
|
|
1910
|
+
)
|
|
1911
|
+
}), {
|
|
1912
|
+
default: withCtx(() => [
|
|
1913
|
+
createElementVNode("span", _hoisted_1, [
|
|
1914
|
+
createVNode(unref(SelectItemIndicator_default), null, {
|
|
1915
|
+
default: withCtx(() => [
|
|
1916
|
+
renderSlot(_ctx.$slots, "indicator-icon", {}, () => [
|
|
1917
|
+
createVNode(unref(Check), { class: "size-4" })
|
|
1918
|
+
])
|
|
1919
|
+
]),
|
|
1920
|
+
_: 3
|
|
1921
|
+
})
|
|
1922
|
+
]),
|
|
1923
|
+
props.textValue ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
1924
|
+
createVNode(unref(SelectItemText_default), null, {
|
|
1925
|
+
default: withCtx(() => [
|
|
1926
|
+
createElementVNode("span", _hoisted_2, toDisplayString(props.textValue), 1)
|
|
1927
|
+
]),
|
|
1928
|
+
_: 1
|
|
1929
|
+
}),
|
|
1930
|
+
createElementVNode("div", _hoisted_3, [
|
|
1931
|
+
renderSlot(_ctx.$slots, "default")
|
|
1932
|
+
])
|
|
1933
|
+
], 64)) : (openBlock(), createBlock(unref(SelectItemText_default), { key: 1 }, {
|
|
1934
|
+
default: withCtx(() => [
|
|
1935
|
+
renderSlot(_ctx.$slots, "default")
|
|
1936
|
+
]),
|
|
1937
|
+
_: 3
|
|
1938
|
+
}))
|
|
1939
|
+
]),
|
|
1940
|
+
_: 3
|
|
1941
|
+
}, 16, ["class"]);
|
|
1942
|
+
};
|
|
1943
|
+
}
|
|
1944
|
+
});
|
|
1945
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
1946
|
+
__name: "SelectItemText",
|
|
1947
|
+
props: {
|
|
1948
|
+
asChild: { type: Boolean },
|
|
1949
|
+
as: {}
|
|
1950
|
+
},
|
|
1951
|
+
setup(__props) {
|
|
1952
|
+
const props = __props;
|
|
1953
|
+
return (_ctx, _cache) => {
|
|
1954
|
+
return openBlock(), createBlock(unref(SelectItemText_default), mergeProps({ "data-slot": "select-item-text" }, props), {
|
|
1955
|
+
default: withCtx(() => [
|
|
1956
|
+
renderSlot(_ctx.$slots, "default")
|
|
1957
|
+
]),
|
|
1958
|
+
_: 3
|
|
1959
|
+
}, 16);
|
|
1960
|
+
};
|
|
1961
|
+
}
|
|
1962
|
+
});
|
|
1963
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
1964
|
+
__name: "SelectLabel",
|
|
1965
|
+
props: {
|
|
1966
|
+
for: {},
|
|
1967
|
+
asChild: { type: Boolean },
|
|
1968
|
+
as: {},
|
|
1969
|
+
class: {}
|
|
1970
|
+
},
|
|
1971
|
+
setup(__props) {
|
|
1972
|
+
const props = __props;
|
|
1973
|
+
return (_ctx, _cache) => {
|
|
1974
|
+
return openBlock(), createBlock(unref(SelectLabel_default), {
|
|
1975
|
+
"data-slot": "select-label",
|
|
1976
|
+
class: normalizeClass(unref(cn)("text-muted-foreground px-2 py-1.5 text-xs", props.class))
|
|
1977
|
+
}, {
|
|
1978
|
+
default: withCtx(() => [
|
|
1979
|
+
renderSlot(_ctx.$slots, "default")
|
|
1980
|
+
]),
|
|
1981
|
+
_: 3
|
|
1982
|
+
}, 8, ["class"]);
|
|
1983
|
+
};
|
|
1984
|
+
}
|
|
1985
|
+
});
|
|
1986
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
1987
|
+
__name: "SelectScrollDownButton",
|
|
1988
|
+
props: {
|
|
1989
|
+
asChild: { type: Boolean },
|
|
1990
|
+
as: {},
|
|
1991
|
+
class: {}
|
|
1992
|
+
},
|
|
1993
|
+
setup(__props) {
|
|
1994
|
+
const props = __props;
|
|
1995
|
+
const delegatedProps = reactiveOmit(props, "class");
|
|
1996
|
+
const forwardedProps = useForwardProps(delegatedProps);
|
|
1997
|
+
return (_ctx, _cache) => {
|
|
1998
|
+
return openBlock(), createBlock(unref(SelectScrollDownButton_default), mergeProps({ "data-slot": "select-scroll-down-button" }, unref(forwardedProps), {
|
|
1999
|
+
class: unref(cn)("flex cursor-default items-center justify-center py-1", props.class)
|
|
2000
|
+
}), {
|
|
2001
|
+
default: withCtx(() => [
|
|
2002
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
2003
|
+
createVNode(unref(ChevronDown), { class: "size-4" })
|
|
2004
|
+
])
|
|
2005
|
+
]),
|
|
2006
|
+
_: 3
|
|
2007
|
+
}, 16, ["class"]);
|
|
2008
|
+
};
|
|
2009
|
+
}
|
|
2010
|
+
});
|
|
2011
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
2012
|
+
__name: "SelectScrollUpButton",
|
|
2013
|
+
props: {
|
|
2014
|
+
asChild: { type: Boolean },
|
|
2015
|
+
as: {},
|
|
2016
|
+
class: {}
|
|
2017
|
+
},
|
|
2018
|
+
setup(__props) {
|
|
2019
|
+
const props = __props;
|
|
2020
|
+
const delegatedProps = reactiveOmit(props, "class");
|
|
2021
|
+
const forwardedProps = useForwardProps(delegatedProps);
|
|
2022
|
+
return (_ctx, _cache) => {
|
|
2023
|
+
return openBlock(), createBlock(unref(SelectScrollUpButton_default), mergeProps({ "data-slot": "select-scroll-up-button" }, unref(forwardedProps), {
|
|
2024
|
+
class: unref(cn)("flex cursor-default items-center justify-center py-1", props.class)
|
|
2025
|
+
}), {
|
|
2026
|
+
default: withCtx(() => [
|
|
2027
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
2028
|
+
createVNode(unref(ChevronUp), { class: "size-4" })
|
|
2029
|
+
])
|
|
2030
|
+
]),
|
|
2031
|
+
_: 3
|
|
2032
|
+
}, 16, ["class"]);
|
|
2033
|
+
};
|
|
2034
|
+
}
|
|
2035
|
+
});
|
|
2036
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
2037
|
+
__name: "SelectSeparator",
|
|
2038
|
+
props: {
|
|
2039
|
+
asChild: { type: Boolean },
|
|
2040
|
+
as: {},
|
|
2041
|
+
class: {}
|
|
2042
|
+
},
|
|
2043
|
+
setup(__props) {
|
|
2044
|
+
const props = __props;
|
|
2045
|
+
const delegatedProps = reactiveOmit(props, "class");
|
|
2046
|
+
return (_ctx, _cache) => {
|
|
2047
|
+
return openBlock(), createBlock(unref(SelectSeparator_default), mergeProps({ "data-slot": "select-separator" }, unref(delegatedProps), {
|
|
2048
|
+
class: unref(cn)("bg-border pointer-events-none -mx-1 my-1 h-px", props.class)
|
|
2049
|
+
}), null, 16, ["class"]);
|
|
2050
|
+
};
|
|
2051
|
+
}
|
|
2052
|
+
});
|
|
2053
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
2054
|
+
__name: "SelectTrigger",
|
|
2055
|
+
props: {
|
|
2056
|
+
disabled: { type: Boolean },
|
|
2057
|
+
reference: {},
|
|
2058
|
+
asChild: { type: Boolean },
|
|
2059
|
+
as: {},
|
|
2060
|
+
class: {},
|
|
2061
|
+
size: { default: "default" }
|
|
2062
|
+
},
|
|
2063
|
+
setup(__props) {
|
|
2064
|
+
const props = __props;
|
|
2065
|
+
const delegatedProps = reactiveOmit(props, "class", "size");
|
|
2066
|
+
const forwardedProps = useForwardProps(delegatedProps);
|
|
2067
|
+
return (_ctx, _cache) => {
|
|
2068
|
+
return openBlock(), createBlock(unref(SelectTrigger_default), mergeProps({
|
|
2069
|
+
"data-slot": "select-trigger",
|
|
2070
|
+
"data-size": _ctx.size
|
|
2071
|
+
}, unref(forwardedProps), {
|
|
2072
|
+
class: unref(cn)(
|
|
2073
|
+
"data-[placeholder]:text-(--text-secondary-light) [&_svg:not([class*='text-'])]:text-(--text-secondary-light) flex w-fit cursor-pointer items-center justify-between gap-2 rounded border border-(--border-light) bg-(--button-secondary-light) px-4 py-3 text-xs font-medium whitespace-nowrap text-(--text-primary-light) transition-all duration-300 ease-in-out outline-none disabled:cursor-not-allowed disabled:opacity-60 data-[size=default]:h-[52px] data-[size=sm]:h-10 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 dark:border-(--border-dark) dark:bg-(--button-secondary-dark) dark:text-(--text-primary-dark) dark:data-[placeholder]:text-(--text-secondary-dark) dark:[&_svg:not([class*='text-'])]:text-(--text-secondary-dark) sm:text-sm",
|
|
2074
|
+
"focus-visible:border-(--border-hover-light) focus-visible:ring-0 dark:focus-visible:border-(--border-hover-dark)",
|
|
2075
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
2076
|
+
props.class
|
|
2077
|
+
)
|
|
2078
|
+
}), {
|
|
2079
|
+
default: withCtx(() => [
|
|
2080
|
+
renderSlot(_ctx.$slots, "default"),
|
|
2081
|
+
createVNode(unref(SelectIcon_default), { "as-child": "" }, {
|
|
2082
|
+
default: withCtx(() => [
|
|
2083
|
+
createVNode(unref(ChevronDown), { class: "size-4 opacity-50" })
|
|
2084
|
+
]),
|
|
2085
|
+
_: 1
|
|
2086
|
+
})
|
|
2087
|
+
]),
|
|
2088
|
+
_: 3
|
|
2089
|
+
}, 16, ["data-size", "class"]);
|
|
2090
|
+
};
|
|
2091
|
+
}
|
|
2092
|
+
});
|
|
2093
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
2094
|
+
__name: "SelectValue",
|
|
2095
|
+
props: {
|
|
2096
|
+
placeholder: {},
|
|
2097
|
+
asChild: { type: Boolean },
|
|
2098
|
+
as: {}
|
|
2099
|
+
},
|
|
2100
|
+
setup(__props) {
|
|
2101
|
+
const props = __props;
|
|
2102
|
+
return (_ctx, _cache) => {
|
|
2103
|
+
return openBlock(), createBlock(unref(SelectValue_default), mergeProps({ "data-slot": "select-value" }, props), {
|
|
2104
|
+
default: withCtx(() => [
|
|
2105
|
+
renderSlot(_ctx.$slots, "default")
|
|
2106
|
+
]),
|
|
2107
|
+
_: 3
|
|
2108
|
+
}, 16);
|
|
2109
|
+
};
|
|
2110
|
+
}
|
|
2111
|
+
});
|
|
2
2112
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2113
|
+
_sfc_main$a as Select,
|
|
2114
|
+
_sfc_main$9 as SelectContent,
|
|
2115
|
+
_sfc_main$8 as SelectGroup,
|
|
2116
|
+
_sfc_main$7 as SelectItem,
|
|
2117
|
+
_sfc_main$6 as SelectItemText,
|
|
2118
|
+
_sfc_main$5 as SelectLabel,
|
|
2119
|
+
_sfc_main$4 as SelectScrollDownButton,
|
|
2120
|
+
_sfc_main$3 as SelectScrollUpButton,
|
|
2121
|
+
_sfc_main$2 as SelectSeparator,
|
|
2122
|
+
_sfc_main$1 as SelectTrigger,
|
|
2123
|
+
_sfc_main as SelectValue
|
|
14
2124
|
};
|