@enos5/enos-vue-default 1.8.9 → 1.8.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/CustomSelect.vue.d.ts +18 -0
- package/dist/components/InputGroup.vue.d.ts +18 -0
- package/dist/components/SelectInput.vue.d.ts +18 -0
- package/dist/index.js +1 -1
- package/dist/index.node.js +1 -1
- package/dist/{plugin-3CiafDXC.js → plugin-Bl7pzq-e.js} +297 -46
- package/dist/plugin-Bl7pzq-e.js.map +1 -0
- package/dist/styles.css +27 -9
- package/package.json +36 -36
- package/dist/plugin-3CiafDXC.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ref, computed, watch, openBlock, createElementBlock, createElementVNode, Fragment, renderList, normalizeClass, normalizeStyle, toDisplayString, createBlock, createCommentVNode, renderSlot, createVNode, Transition, withCtx, mergeProps, useSlots, unref, withDirectives, vShow, useAttrs, vModelCheckbox, onMounted, nextTick, onBeforeUnmount,
|
|
2
|
-
import { LockClosedIcon, ChevronDownIcon, PhotoIcon, EyeDropperIcon, ExclamationCircleIcon, ExclamationTriangleIcon, ChevronUpIcon, MagnifyingGlassIcon, CheckIcon, PencilSquareIcon } from "@heroicons/vue/24/outline";
|
|
1
|
+
import { ref, computed, watch, openBlock, createElementBlock, createElementVNode, Fragment, renderList, normalizeClass, normalizeStyle, toDisplayString, createBlock, createCommentVNode, renderSlot, createVNode, Transition, withCtx, mergeProps, useSlots, unref, withDirectives, vShow, useAttrs, vModelCheckbox, onMounted, nextTick, onBeforeUnmount, withModifiers, Teleport, vModelText, onUnmounted, inject, provide, defineComponent, isVNode, cloneVNode, resolveDynamicComponent, createTextVNode, h, createSlots } from "vue";
|
|
2
|
+
import { LockClosedIcon, XMarkIcon, ChevronDownIcon, PhotoIcon, EyeDropperIcon, ExclamationCircleIcon, ExclamationTriangleIcon, ChevronUpIcon, MagnifyingGlassIcon, CheckIcon, PencilSquareIcon } from "@heroicons/vue/24/outline";
|
|
3
3
|
import Editor from "@tinymce/tinymce-vue";
|
|
4
4
|
import { useI18n } from "vue-i18n";
|
|
5
5
|
import { Link } from "@inertiajs/vue3";
|
|
@@ -307,7 +307,7 @@ const _hoisted_1$B = { class: "md:col-span-1 flex justify-between" };
|
|
|
307
307
|
const _hoisted_2$m = { class: "px-4 sm:px-0" };
|
|
308
308
|
const _hoisted_3$g = { class: "text-xl font-semibold tracking-tight text-neutral-950 dark:text-neutral-50" };
|
|
309
309
|
const _hoisted_4$c = { class: "mt-1 max-w-2xl text-sm text-neutral-600 dark:text-neutral-200" };
|
|
310
|
-
const _hoisted_5$
|
|
310
|
+
const _hoisted_5$a = { class: "px-4 sm:px-0" };
|
|
311
311
|
function _sfc_render(_ctx, _cache) {
|
|
312
312
|
return openBlock(), createElementBlock("div", _hoisted_1$B, [
|
|
313
313
|
createElementVNode("div", _hoisted_2$m, [
|
|
@@ -318,7 +318,7 @@ function _sfc_render(_ctx, _cache) {
|
|
|
318
318
|
renderSlot(_ctx.$slots, "description")
|
|
319
319
|
])
|
|
320
320
|
]),
|
|
321
|
-
createElementVNode("div", _hoisted_5$
|
|
321
|
+
createElementVNode("div", _hoisted_5$a, [
|
|
322
322
|
renderSlot(_ctx.$slots, "aside")
|
|
323
323
|
])
|
|
324
324
|
]);
|
|
@@ -622,7 +622,7 @@ const _hoisted_2$k = {
|
|
|
622
622
|
};
|
|
623
623
|
const _hoisted_3$e = ["type", "value", "disabled"];
|
|
624
624
|
const _hoisted_4$b = ["aria-label"];
|
|
625
|
-
const _hoisted_5$
|
|
625
|
+
const _hoisted_5$9 = {
|
|
626
626
|
key: 0,
|
|
627
627
|
class: "h-5 w-5",
|
|
628
628
|
fill: "none",
|
|
@@ -719,7 +719,7 @@ const _sfc_main$I = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
719
719
|
"aria-label": revealed.value ? "Hide password" : "Show password",
|
|
720
720
|
onClick: toggleVisibility
|
|
721
721
|
}, [
|
|
722
|
-
revealed.value ? (openBlock(), createElementBlock("svg", _hoisted_5$
|
|
722
|
+
revealed.value ? (openBlock(), createElementBlock("svg", _hoisted_5$9, [..._cache[2] || (_cache[2] = [
|
|
723
723
|
createElementVNode("path", {
|
|
724
724
|
"stroke-linecap": "round",
|
|
725
725
|
"stroke-linejoin": "round",
|
|
@@ -822,13 +822,14 @@ const _sfc_main$H = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
822
822
|
};
|
|
823
823
|
}
|
|
824
824
|
});
|
|
825
|
-
const _hoisted_1$t =
|
|
826
|
-
const _hoisted_2$j = ["
|
|
827
|
-
const _hoisted_3$d =
|
|
825
|
+
const _hoisted_1$t = { class: "flex h-5 items-center gap-1" };
|
|
826
|
+
const _hoisted_2$j = ["placeholder"];
|
|
827
|
+
const _hoisted_3$d = ["data-option-value", "onClick", "onFocus", "onKeydown"];
|
|
828
|
+
const _hoisted_4$a = {
|
|
828
829
|
key: 0,
|
|
829
830
|
class: "flex items-center gap-3"
|
|
830
831
|
};
|
|
831
|
-
const
|
|
832
|
+
const _hoisted_5$8 = ["checked", "disabled", "onChange"];
|
|
832
833
|
const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
833
834
|
__name: "CustomSelect",
|
|
834
835
|
props: {
|
|
@@ -916,6 +917,10 @@ const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
916
917
|
type: [String, Array, Object],
|
|
917
918
|
default: "bg-neutral-100 font-medium text-neutral-950 dark:bg-neutral-900 dark:text-neutral-50"
|
|
918
919
|
},
|
|
920
|
+
dropdownHighlightedClass: {
|
|
921
|
+
type: [String, Array, Object],
|
|
922
|
+
default: "bg-slate-50 text-slate-900 dark:bg-neutral-800 dark:text-neutral-50"
|
|
923
|
+
},
|
|
919
924
|
searchable: {
|
|
920
925
|
type: Boolean,
|
|
921
926
|
default: false
|
|
@@ -927,6 +932,10 @@ const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
927
932
|
searchInputClass: {
|
|
928
933
|
type: [String, Array, Object],
|
|
929
934
|
default: "w-full border-b border-neutral-200 px-4 py-3 text-sm outline-none focus:border-neutral-900 dark:border-neutral-800 dark:bg-neutral-950 dark:focus:border-neutral-100"
|
|
935
|
+
},
|
|
936
|
+
noOptionsText: {
|
|
937
|
+
type: String,
|
|
938
|
+
default: "No options available"
|
|
930
939
|
}
|
|
931
940
|
},
|
|
932
941
|
emits: ["update:modelValue"],
|
|
@@ -939,9 +948,14 @@ const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
939
948
|
const triggerRef = ref(null);
|
|
940
949
|
const dropdownMenuRef = ref(null);
|
|
941
950
|
const dropdownStyle = ref({});
|
|
951
|
+
const teleportTarget = ref("body");
|
|
942
952
|
const isDarkMode = ref(false);
|
|
943
953
|
const isMounted = ref(false);
|
|
944
954
|
const searchQuery = ref("");
|
|
955
|
+
const searchInputRef = ref(null);
|
|
956
|
+
const highlightedOptionValue = ref(null);
|
|
957
|
+
const typeaheadQuery = ref("");
|
|
958
|
+
let typeaheadResetTimeout = null;
|
|
945
959
|
const isObjectOption = (option) => typeof option === "object" && option !== null;
|
|
946
960
|
const optionValue = (option) => {
|
|
947
961
|
if (isObjectOption(option)) {
|
|
@@ -1016,6 +1030,9 @@ const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
1016
1030
|
}
|
|
1017
1031
|
return multipleOptions.value.filter((option) => modelValueSet.value.has(String(optionValue(option) ?? "")));
|
|
1018
1032
|
});
|
|
1033
|
+
const hasVisibleOptions = computed(() => filteredOptions.value.length > 0);
|
|
1034
|
+
const visibleOptions = computed(() => filteredOptions.value);
|
|
1035
|
+
const canClearSelection = computed(() => !props.multiple && !props.placeholderDisabled && !props.disabled && props.modelValue !== null && props.modelValue !== void 0 && props.modelValue !== "");
|
|
1019
1036
|
const displayText = computed(() => {
|
|
1020
1037
|
if (props.multiple) {
|
|
1021
1038
|
if (selectedMultipleOptions.value.length === 0) {
|
|
@@ -1043,19 +1060,24 @@ const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
1043
1060
|
};
|
|
1044
1061
|
const normalizeEmittedValues = (values) => values.map((value) => normalizeEmittedValue(value));
|
|
1045
1062
|
const optionIsSelected = (option) => modelValueSet.value.has(String(optionValue(option) ?? ""));
|
|
1063
|
+
const optionIsHighlighted = (option) => highlightedOptionValue.value === String(optionValue(option) ?? "");
|
|
1046
1064
|
const toggleDropdown = () => {
|
|
1047
1065
|
if (!props.disabled) {
|
|
1048
1066
|
isOpen.value = !isOpen.value;
|
|
1049
1067
|
}
|
|
1050
1068
|
};
|
|
1069
|
+
const syncTeleportTarget = () => {
|
|
1070
|
+
const dialog = rootRef.value?.closest("dialog");
|
|
1071
|
+
teleportTarget.value = dialog ?? document.body;
|
|
1072
|
+
};
|
|
1051
1073
|
const selectOption = (option) => {
|
|
1052
1074
|
const value = optionValue(option);
|
|
1053
1075
|
emit("update:modelValue", normalizeEmittedValue(value));
|
|
1054
1076
|
isOpen.value = false;
|
|
1055
1077
|
};
|
|
1056
|
-
const
|
|
1057
|
-
if (
|
|
1058
|
-
emit("update:modelValue",
|
|
1078
|
+
const clearSelection = () => {
|
|
1079
|
+
if (canClearSelection.value) {
|
|
1080
|
+
emit("update:modelValue", normalizeEmittedValue(""));
|
|
1059
1081
|
isOpen.value = false;
|
|
1060
1082
|
}
|
|
1061
1083
|
};
|
|
@@ -1097,6 +1119,8 @@ const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
1097
1119
|
if (!clickedInsideTrigger && !clickedInsideMenu) {
|
|
1098
1120
|
isOpen.value = false;
|
|
1099
1121
|
searchQuery.value = "";
|
|
1122
|
+
highlightedOptionValue.value = null;
|
|
1123
|
+
typeaheadQuery.value = "";
|
|
1100
1124
|
}
|
|
1101
1125
|
};
|
|
1102
1126
|
const syncDarkMode = () => {
|
|
@@ -1107,26 +1131,218 @@ const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
1107
1131
|
isDarkMode.value = document.documentElement.classList.contains("dark") || document.body.classList.contains("dark");
|
|
1108
1132
|
};
|
|
1109
1133
|
const darkTextStyle = computed(() => isDarkMode.value ? { color: "#ffffff" } : null);
|
|
1134
|
+
const clearTypeaheadQuery = () => {
|
|
1135
|
+
typeaheadQuery.value = "";
|
|
1136
|
+
if (typeaheadResetTimeout) {
|
|
1137
|
+
window.clearTimeout(typeaheadResetTimeout);
|
|
1138
|
+
typeaheadResetTimeout = null;
|
|
1139
|
+
}
|
|
1140
|
+
};
|
|
1141
|
+
const scheduleTypeaheadReset = () => {
|
|
1142
|
+
if (typeaheadResetTimeout) {
|
|
1143
|
+
window.clearTimeout(typeaheadResetTimeout);
|
|
1144
|
+
}
|
|
1145
|
+
typeaheadResetTimeout = window.setTimeout(() => {
|
|
1146
|
+
typeaheadQuery.value = "";
|
|
1147
|
+
typeaheadResetTimeout = null;
|
|
1148
|
+
}, 700);
|
|
1149
|
+
};
|
|
1150
|
+
const escapeSelectorValue = (value) => {
|
|
1151
|
+
if (typeof CSS !== "undefined" && typeof CSS.escape === "function") {
|
|
1152
|
+
return CSS.escape(value);
|
|
1153
|
+
}
|
|
1154
|
+
return value.replace(/["\\]/g, "\\$&");
|
|
1155
|
+
};
|
|
1156
|
+
const scrollOptionByValue = async (value) => {
|
|
1157
|
+
await nextTick();
|
|
1158
|
+
if (!dropdownMenuRef.value) {
|
|
1159
|
+
return null;
|
|
1160
|
+
}
|
|
1161
|
+
const optionElement = dropdownMenuRef.value.querySelector(
|
|
1162
|
+
`[data-option-value="${escapeSelectorValue(value)}"]`
|
|
1163
|
+
);
|
|
1164
|
+
if (!optionElement) {
|
|
1165
|
+
return null;
|
|
1166
|
+
}
|
|
1167
|
+
optionElement.scrollIntoView({ block: "nearest" });
|
|
1168
|
+
return optionElement;
|
|
1169
|
+
};
|
|
1170
|
+
const focusOptionByValue = async (value) => {
|
|
1171
|
+
const optionElement = await scrollOptionByValue(value);
|
|
1172
|
+
if (!optionElement) {
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
optionElement.focus({ preventScroll: true });
|
|
1176
|
+
};
|
|
1177
|
+
const setHighlightedOption = async (option, { focus = !props.searchable } = {}) => {
|
|
1178
|
+
const value = String(optionValue(option) ?? "");
|
|
1179
|
+
highlightedOptionValue.value = value;
|
|
1180
|
+
if (focus) {
|
|
1181
|
+
await focusOptionByValue(value);
|
|
1182
|
+
return;
|
|
1183
|
+
}
|
|
1184
|
+
await scrollOptionByValue(value);
|
|
1185
|
+
};
|
|
1186
|
+
const findMatchingOption = (query) => {
|
|
1187
|
+
const normalizedQuery = query.trimStart().toLowerCase();
|
|
1188
|
+
if (!normalizedQuery) {
|
|
1189
|
+
return null;
|
|
1190
|
+
}
|
|
1191
|
+
const options = props.multiple ? multipleOptions.value : availableOptions.value;
|
|
1192
|
+
return options.find((option) => String(optionText(option)).toLowerCase().startsWith(normalizedQuery)) ?? null;
|
|
1193
|
+
};
|
|
1194
|
+
const findHighlightedOptionIndex = () => {
|
|
1195
|
+
return visibleOptions.value.findIndex((option) => String(optionValue(option) ?? "") === highlightedOptionValue.value);
|
|
1196
|
+
};
|
|
1197
|
+
const moveHighlightedOption = async (direction) => {
|
|
1198
|
+
if (!visibleOptions.value.length) {
|
|
1199
|
+
return;
|
|
1200
|
+
}
|
|
1201
|
+
const currentIndex = findHighlightedOptionIndex();
|
|
1202
|
+
const fallbackIndex = direction > 0 ? 0 : visibleOptions.value.length - 1;
|
|
1203
|
+
const nextIndex = currentIndex === -1 ? fallbackIndex : (currentIndex + direction + visibleOptions.value.length) % visibleOptions.value.length;
|
|
1204
|
+
await setHighlightedOption(visibleOptions.value[nextIndex]);
|
|
1205
|
+
};
|
|
1206
|
+
const selectHighlightedOption = () => {
|
|
1207
|
+
const highlightedOption = visibleOptions.value.find((option) => String(optionValue(option) ?? "") === highlightedOptionValue.value);
|
|
1208
|
+
if (!highlightedOption) {
|
|
1209
|
+
return;
|
|
1210
|
+
}
|
|
1211
|
+
if (props.multiple) {
|
|
1212
|
+
toggleMultipleOption(highlightedOption);
|
|
1213
|
+
return;
|
|
1214
|
+
}
|
|
1215
|
+
selectOption(highlightedOption);
|
|
1216
|
+
};
|
|
1217
|
+
const syncHighlightedOption = async () => {
|
|
1218
|
+
if (!visibleOptions.value.length) {
|
|
1219
|
+
highlightedOptionValue.value = null;
|
|
1220
|
+
return;
|
|
1221
|
+
}
|
|
1222
|
+
const hasCurrentHighlight = visibleOptions.value.some((option) => String(optionValue(option) ?? "") === highlightedOptionValue.value);
|
|
1223
|
+
if (hasCurrentHighlight) {
|
|
1224
|
+
await setHighlightedOption(
|
|
1225
|
+
visibleOptions.value.find((option) => String(optionValue(option) ?? "") === highlightedOptionValue.value),
|
|
1226
|
+
{ focus: false }
|
|
1227
|
+
);
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1230
|
+
await setHighlightedOption(visibleOptions.value[0], { focus: false });
|
|
1231
|
+
};
|
|
1232
|
+
const handleTypeaheadKeydown = (event) => {
|
|
1233
|
+
if (!isOpen.value || props.searchable) {
|
|
1234
|
+
return;
|
|
1235
|
+
}
|
|
1236
|
+
if (event.ctrlKey || event.altKey || event.metaKey || event.key.length !== 1) {
|
|
1237
|
+
return;
|
|
1238
|
+
}
|
|
1239
|
+
const target = event.target;
|
|
1240
|
+
const targetInsideSelect = rootRef.value?.contains(target) || dropdownMenuRef.value?.contains(target);
|
|
1241
|
+
if (!targetInsideSelect) {
|
|
1242
|
+
return;
|
|
1243
|
+
}
|
|
1244
|
+
typeaheadQuery.value += event.key;
|
|
1245
|
+
scheduleTypeaheadReset();
|
|
1246
|
+
const matchingOption = findMatchingOption(typeaheadQuery.value);
|
|
1247
|
+
if (!matchingOption) {
|
|
1248
|
+
return;
|
|
1249
|
+
}
|
|
1250
|
+
setHighlightedOption(matchingOption);
|
|
1251
|
+
event.preventDefault();
|
|
1252
|
+
event.stopPropagation();
|
|
1253
|
+
};
|
|
1254
|
+
const handleDropdownKeydown = (event) => {
|
|
1255
|
+
if (!isOpen.value) {
|
|
1256
|
+
return;
|
|
1257
|
+
}
|
|
1258
|
+
const target = event.target;
|
|
1259
|
+
const targetInsideSelect = rootRef.value?.contains(target) || dropdownMenuRef.value?.contains(target);
|
|
1260
|
+
if (!targetInsideSelect) {
|
|
1261
|
+
return;
|
|
1262
|
+
}
|
|
1263
|
+
if (event.key === "Escape") {
|
|
1264
|
+
event.preventDefault();
|
|
1265
|
+
event.stopPropagation();
|
|
1266
|
+
isOpen.value = false;
|
|
1267
|
+
triggerRef.value?.focus();
|
|
1268
|
+
return;
|
|
1269
|
+
}
|
|
1270
|
+
if (event.key === "ArrowDown") {
|
|
1271
|
+
event.preventDefault();
|
|
1272
|
+
event.stopPropagation();
|
|
1273
|
+
moveHighlightedOption(1);
|
|
1274
|
+
return;
|
|
1275
|
+
}
|
|
1276
|
+
if (event.key === "ArrowUp") {
|
|
1277
|
+
event.preventDefault();
|
|
1278
|
+
event.stopPropagation();
|
|
1279
|
+
moveHighlightedOption(-1);
|
|
1280
|
+
return;
|
|
1281
|
+
}
|
|
1282
|
+
if (event.key === "Enter" && highlightedOptionValue.value !== null) {
|
|
1283
|
+
event.preventDefault();
|
|
1284
|
+
event.stopPropagation();
|
|
1285
|
+
selectHighlightedOption();
|
|
1286
|
+
}
|
|
1287
|
+
};
|
|
1288
|
+
const handleOptionKeydown = (event, option) => {
|
|
1289
|
+
if (event.key !== "Enter" && event.key !== " ") {
|
|
1290
|
+
return;
|
|
1291
|
+
}
|
|
1292
|
+
event.preventDefault();
|
|
1293
|
+
event.stopPropagation();
|
|
1294
|
+
if (props.multiple) {
|
|
1295
|
+
toggleMultipleOption(option);
|
|
1296
|
+
return;
|
|
1297
|
+
}
|
|
1298
|
+
selectOption(option);
|
|
1299
|
+
};
|
|
1110
1300
|
onMounted(() => {
|
|
1111
1301
|
isMounted.value = true;
|
|
1302
|
+
syncTeleportTarget();
|
|
1112
1303
|
syncDarkMode();
|
|
1113
1304
|
document.addEventListener("click", closeDropdown);
|
|
1305
|
+
document.addEventListener("keydown", handleDropdownKeydown, true);
|
|
1306
|
+
document.addEventListener("keydown", handleTypeaheadKeydown, true);
|
|
1114
1307
|
window.addEventListener("resize", updateDropdownPosition);
|
|
1115
1308
|
window.addEventListener("scroll", updateDropdownPosition, true);
|
|
1116
1309
|
});
|
|
1117
1310
|
onBeforeUnmount(() => {
|
|
1311
|
+
clearTypeaheadQuery();
|
|
1118
1312
|
document.removeEventListener("click", closeDropdown);
|
|
1313
|
+
document.removeEventListener("keydown", handleDropdownKeydown, true);
|
|
1314
|
+
document.removeEventListener("keydown", handleTypeaheadKeydown, true);
|
|
1119
1315
|
window.removeEventListener("resize", updateDropdownPosition);
|
|
1120
1316
|
window.removeEventListener("scroll", updateDropdownPosition, true);
|
|
1121
1317
|
});
|
|
1122
1318
|
watch(isOpen, async (open) => {
|
|
1123
1319
|
if (!open) {
|
|
1124
1320
|
searchQuery.value = "";
|
|
1321
|
+
highlightedOptionValue.value = null;
|
|
1322
|
+
clearTypeaheadQuery();
|
|
1125
1323
|
return;
|
|
1126
1324
|
}
|
|
1325
|
+
clearTypeaheadQuery();
|
|
1326
|
+
syncTeleportTarget();
|
|
1127
1327
|
syncDarkMode();
|
|
1128
1328
|
await nextTick();
|
|
1129
1329
|
updateDropdownPosition();
|
|
1330
|
+
if (props.searchable) {
|
|
1331
|
+
await nextTick();
|
|
1332
|
+
await syncHighlightedOption();
|
|
1333
|
+
searchInputRef.value?.focus();
|
|
1334
|
+
return;
|
|
1335
|
+
}
|
|
1336
|
+
const initialOption = props.multiple ? selectedMultipleOptions.value[0] ?? multipleOptions.value[0] : props.options.find((option) => optionValue(option) === props.modelValue || String(optionValue(option)) === String(props.modelValue)) ?? availableOptions.value[0];
|
|
1337
|
+
if (initialOption) {
|
|
1338
|
+
await setHighlightedOption(initialOption);
|
|
1339
|
+
}
|
|
1340
|
+
});
|
|
1341
|
+
watch(filteredOptions, async () => {
|
|
1342
|
+
if (!isOpen.value || !props.searchable) {
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1345
|
+
await syncHighlightedOption();
|
|
1130
1346
|
});
|
|
1131
1347
|
return (_ctx, _cache) => {
|
|
1132
1348
|
return openBlock(), createElementBlock("div", {
|
|
@@ -1150,13 +1366,26 @@ const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
1150
1366
|
class: normalizeClass((__props.multiple && selectedMultipleOptions.value.length === 0 || !__props.multiple && !__props.modelValue) && __props.placeholder ? __props.placeholderClass : null),
|
|
1151
1367
|
style: normalizeStyle(darkTextStyle.value)
|
|
1152
1368
|
}, toDisplayString(displayText.value), 7),
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1369
|
+
createElementVNode("div", _hoisted_1$t, [
|
|
1370
|
+
canClearSelection.value ? (openBlock(), createElementBlock("button", {
|
|
1371
|
+
key: 0,
|
|
1372
|
+
type: "button",
|
|
1373
|
+
class: "inline-flex size-5 shrink-0 items-center justify-center rounded-full text-neutral-400 transition hover:bg-neutral-100 hover:text-neutral-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-950/20 dark:hover:bg-neutral-900 dark:hover:text-neutral-200 dark:focus-visible:ring-neutral-100/20",
|
|
1374
|
+
"aria-label": "Clear selection",
|
|
1375
|
+
onClick: withModifiers(clearSelection, ["stop", "prevent"]),
|
|
1376
|
+
onPointerdown: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
1377
|
+
}, ["stop"]))
|
|
1378
|
+
}, [
|
|
1379
|
+
createVNode(unref(XMarkIcon), { class: "size-4" })
|
|
1380
|
+
], 32)) : createCommentVNode("", true),
|
|
1381
|
+
createVNode(unref(ChevronDownIcon), {
|
|
1382
|
+
class: normalizeClass(["size-5 text-neutral-400 transition-transform dark:text-neutral-200", { "rotate-180": isOpen.value }])
|
|
1383
|
+
}, null, 8, ["class"])
|
|
1384
|
+
])
|
|
1156
1385
|
], 16),
|
|
1157
1386
|
isMounted.value ? (openBlock(), createBlock(Teleport, {
|
|
1158
1387
|
key: 0,
|
|
1159
|
-
to:
|
|
1388
|
+
to: teleportTarget.value
|
|
1160
1389
|
}, [
|
|
1161
1390
|
createVNode(Transition, {
|
|
1162
1391
|
"enter-active-class": "transition-all duration-200 ease-out",
|
|
@@ -1179,64 +1408,64 @@ const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
1179
1408
|
}, [
|
|
1180
1409
|
__props.searchable ? withDirectives((openBlock(), createElementBlock("input", {
|
|
1181
1410
|
key: 0,
|
|
1182
|
-
|
|
1411
|
+
ref_key: "searchInputRef",
|
|
1412
|
+
ref: searchInputRef,
|
|
1413
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => searchQuery.value = $event),
|
|
1183
1414
|
type: "text",
|
|
1184
1415
|
placeholder: __props.searchPlaceholder,
|
|
1185
1416
|
class: normalizeClass(__props.searchInputClass),
|
|
1186
|
-
onClick: _cache[
|
|
1417
|
+
onClick: _cache[2] || (_cache[2] = withModifiers(() => {
|
|
1187
1418
|
}, ["stop"])),
|
|
1188
|
-
onKeydown: _cache[
|
|
1419
|
+
onKeydown: _cache[3] || (_cache[3] = withModifiers(() => {
|
|
1189
1420
|
}, ["stop"]))
|
|
1190
|
-
}, null, 42,
|
|
1421
|
+
}, null, 42, _hoisted_2$j)), [
|
|
1191
1422
|
[vModelText, searchQuery.value]
|
|
1192
1423
|
]) : createCommentVNode("", true),
|
|
1193
|
-
__props.placeholder && !__props.multiple ? (openBlock(), createElementBlock("div", {
|
|
1194
|
-
key: 1,
|
|
1195
|
-
class: normalizeClass([
|
|
1196
|
-
__props.dropdownOptionClass,
|
|
1197
|
-
__props.placeholderClass,
|
|
1198
|
-
{ "text-gray-400": !__props.modelValue }
|
|
1199
|
-
]),
|
|
1200
|
-
onClick: withModifiers(selectPlaceholder, ["stop"])
|
|
1201
|
-
}, [
|
|
1202
|
-
createElementVNode("span", {
|
|
1203
|
-
style: normalizeStyle(darkTextStyle.value)
|
|
1204
|
-
}, toDisplayString(__props.placeholder), 5)
|
|
1205
|
-
], 2)) : createCommentVNode("", true),
|
|
1206
1424
|
selectedDeletedOption.value ? (openBlock(), createElementBlock("div", {
|
|
1207
|
-
key:
|
|
1425
|
+
key: 1,
|
|
1208
1426
|
class: normalizeClass([
|
|
1209
1427
|
__props.dropdownOptionClass,
|
|
1210
1428
|
__props.deletedOptionClass,
|
|
1211
1429
|
__props.dropdownSelectedClass
|
|
1212
1430
|
])
|
|
1213
1431
|
}, toDisplayString(optionText(selectedDeletedOption.value)), 3)) : createCommentVNode("", true),
|
|
1432
|
+
!hasVisibleOptions.value ? (openBlock(), createElementBlock("div", {
|
|
1433
|
+
key: 2,
|
|
1434
|
+
class: normalizeClass([__props.dropdownOptionClass, __props.placeholderClass, "cursor-default"]),
|
|
1435
|
+
style: normalizeStyle(darkTextStyle.value)
|
|
1436
|
+
}, toDisplayString(__props.noOptionsText), 7)) : createCommentVNode("", true),
|
|
1214
1437
|
(openBlock(true), createElementBlock(Fragment, null, renderList(filteredOptions.value, (option) => {
|
|
1215
1438
|
return openBlock(), createElementBlock("div", {
|
|
1216
1439
|
key: String(optionValue(option)),
|
|
1440
|
+
"data-option-value": String(optionValue(option) ?? ""),
|
|
1441
|
+
"data-select-option": "true",
|
|
1442
|
+
tabindex: "-1",
|
|
1217
1443
|
class: normalizeClass([
|
|
1218
1444
|
__props.dropdownOptionClass,
|
|
1219
1445
|
optionDeleted(option) ? __props.deletedOptionClass : __props.optionClass,
|
|
1220
1446
|
{ "text-neutral-50": isDarkMode.value && !optionDeleted(option) },
|
|
1221
1447
|
{
|
|
1448
|
+
[__props.dropdownHighlightedClass]: optionIsHighlighted(option),
|
|
1222
1449
|
[__props.dropdownSelectedClass]: __props.multiple ? optionIsSelected(option) : optionValue(option) === __props.modelValue || String(optionValue(option)) === String(__props.modelValue),
|
|
1223
|
-
"rounded-b-lg": option === availableOptions.value[availableOptions.value.length - 1]
|
|
1224
|
-
"rounded-lg":
|
|
1450
|
+
"rounded-b-lg": option === availableOptions.value[availableOptions.value.length - 1],
|
|
1451
|
+
"rounded-lg": availableOptions.value.length === 1
|
|
1225
1452
|
}
|
|
1226
1453
|
]),
|
|
1227
|
-
onClick: withModifiers(($event) => __props.multiple ? toggleMultipleOption(option) : selectOption(option), ["stop"])
|
|
1454
|
+
onClick: withModifiers(($event) => __props.multiple ? toggleMultipleOption(option) : selectOption(option), ["stop"]),
|
|
1455
|
+
onFocus: ($event) => highlightedOptionValue.value = String(optionValue(option) ?? ""),
|
|
1456
|
+
onKeydown: ($event) => handleOptionKeydown($event, option)
|
|
1228
1457
|
}, [
|
|
1229
|
-
__props.multiple ? (openBlock(), createElementBlock("div",
|
|
1458
|
+
__props.multiple ? (openBlock(), createElementBlock("div", _hoisted_4$a, [
|
|
1230
1459
|
createElementVNode("input", {
|
|
1231
1460
|
type: "checkbox",
|
|
1232
1461
|
class: "h-4 w-4 rounded border-neutral-300 text-neutral-900 focus:ring-neutral-900",
|
|
1233
1462
|
checked: optionIsSelected(option),
|
|
1234
1463
|
disabled: __props.disabled,
|
|
1235
1464
|
tabindex: "-1",
|
|
1236
|
-
onClick: _cache[
|
|
1465
|
+
onClick: _cache[4] || (_cache[4] = withModifiers(() => {
|
|
1237
1466
|
}, ["stop"])),
|
|
1238
1467
|
onChange: withModifiers(($event) => toggleMultipleOption(option), ["stop"])
|
|
1239
|
-
}, null, 40,
|
|
1468
|
+
}, null, 40, _hoisted_5$8),
|
|
1240
1469
|
createElementVNode("span", {
|
|
1241
1470
|
style: normalizeStyle(darkTextStyle.value)
|
|
1242
1471
|
}, toDisplayString(optionText(option)), 5)
|
|
@@ -1244,14 +1473,14 @@ const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
1244
1473
|
key: 1,
|
|
1245
1474
|
style: normalizeStyle(darkTextStyle.value)
|
|
1246
1475
|
}, toDisplayString(optionText(option)), 5))
|
|
1247
|
-
],
|
|
1476
|
+
], 42, _hoisted_3$d);
|
|
1248
1477
|
}), 128))
|
|
1249
1478
|
], 2)
|
|
1250
1479
|
], 6)) : createCommentVNode("", true)
|
|
1251
1480
|
]),
|
|
1252
1481
|
_: 1
|
|
1253
1482
|
})
|
|
1254
|
-
])) : createCommentVNode("", true)
|
|
1483
|
+
], 8, ["to"])) : createCommentVNode("", true)
|
|
1255
1484
|
], 512);
|
|
1256
1485
|
};
|
|
1257
1486
|
}
|
|
@@ -1343,6 +1572,10 @@ const _sfc_main$F = {
|
|
|
1343
1572
|
type: [String, Array, Object],
|
|
1344
1573
|
default: "bg-blue-50 text-blue-700 font-medium dark:bg-neutral-900 dark:text-neutral-50"
|
|
1345
1574
|
},
|
|
1575
|
+
dropdownHighlightedClass: {
|
|
1576
|
+
type: [String, Array, Object],
|
|
1577
|
+
default: "bg-slate-100 text-slate-900 dark:bg-neutral-800 dark:text-neutral-50"
|
|
1578
|
+
},
|
|
1346
1579
|
searchable: {
|
|
1347
1580
|
type: Boolean,
|
|
1348
1581
|
default: false
|
|
@@ -1354,6 +1587,10 @@ const _sfc_main$F = {
|
|
|
1354
1587
|
searchInputClass: {
|
|
1355
1588
|
type: [String, Array, Object],
|
|
1356
1589
|
default: "w-full border-b border-neutral-200 px-4 py-3 text-sm outline-none focus:border-neutral-900 dark:border-neutral-800 dark:bg-neutral-950 dark:focus:border-neutral-100"
|
|
1590
|
+
},
|
|
1591
|
+
noOptionsText: {
|
|
1592
|
+
type: String,
|
|
1593
|
+
default: "No options available"
|
|
1357
1594
|
}
|
|
1358
1595
|
},
|
|
1359
1596
|
emits: ["update:modelValue"],
|
|
@@ -1382,11 +1619,13 @@ const _sfc_main$F = {
|
|
|
1382
1619
|
"dropdown-class": __props.dropdownClass,
|
|
1383
1620
|
"dropdown-option-class": __props.dropdownOptionClass,
|
|
1384
1621
|
"dropdown-selected-class": __props.dropdownSelectedClass,
|
|
1622
|
+
"dropdown-highlighted-class": __props.dropdownHighlightedClass,
|
|
1385
1623
|
searchable: __props.searchable,
|
|
1386
1624
|
"search-placeholder": __props.searchPlaceholder,
|
|
1387
1625
|
"search-input-class": __props.searchInputClass,
|
|
1626
|
+
"no-options-text": __props.noOptionsText,
|
|
1388
1627
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event))
|
|
1389
|
-
}, _ctx.$attrs), null, 16, ["model-value", "model-modifiers", "options", "placeholder", "placeholder-disabled", "multiple", "disabled", "soft-delete-aware", "label-key", "value-key", "deleted-key", "option-label", "base-class", "normal-text-class", "deleted-selected-class", "option-class", "deleted-option-class", "placeholder-class", "dropdown-class", "dropdown-option-class", "dropdown-selected-class", "searchable", "search-placeholder", "search-input-class"]);
|
|
1628
|
+
}, _ctx.$attrs), null, 16, ["model-value", "model-modifiers", "options", "placeholder", "placeholder-disabled", "multiple", "disabled", "soft-delete-aware", "label-key", "value-key", "deleted-key", "option-label", "base-class", "normal-text-class", "deleted-selected-class", "option-class", "deleted-option-class", "placeholder-class", "dropdown-class", "dropdown-option-class", "dropdown-selected-class", "dropdown-highlighted-class", "searchable", "search-placeholder", "search-input-class", "no-options-text"]);
|
|
1390
1629
|
};
|
|
1391
1630
|
}
|
|
1392
1631
|
};
|
|
@@ -1887,7 +2126,7 @@ const _sfc_main$D = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
1887
2126
|
};
|
|
1888
2127
|
}
|
|
1889
2128
|
});
|
|
1890
|
-
const DateRangeInput = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-
|
|
2129
|
+
const DateRangeInput = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-0612bf1a"]]);
|
|
1891
2130
|
const _hoisted_1$q = { class: "relative" };
|
|
1892
2131
|
const _hoisted_2$h = { class: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none" };
|
|
1893
2132
|
const _hoisted_3$b = ["accept"];
|
|
@@ -3353,6 +3592,14 @@ const _sfc_main$v = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
3353
3592
|
searchInputClass: {
|
|
3354
3593
|
type: [String, Array, Object],
|
|
3355
3594
|
default: void 0
|
|
3595
|
+
},
|
|
3596
|
+
dropdownHighlightedClass: {
|
|
3597
|
+
type: [String, Array, Object],
|
|
3598
|
+
default: void 0
|
|
3599
|
+
},
|
|
3600
|
+
noOptionsText: {
|
|
3601
|
+
type: String,
|
|
3602
|
+
default: void 0
|
|
3356
3603
|
}
|
|
3357
3604
|
},
|
|
3358
3605
|
emits: ["update:modelValue", "blur"],
|
|
@@ -3460,6 +3707,10 @@ const _sfc_main$v = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
3460
3707
|
inputProps.searchPlaceholder = props.searchPlaceholder;
|
|
3461
3708
|
if (props.searchInputClass !== void 0)
|
|
3462
3709
|
inputProps.searchInputClass = props.searchInputClass;
|
|
3710
|
+
if (props.dropdownHighlightedClass !== void 0)
|
|
3711
|
+
inputProps.dropdownHighlightedClass = props.dropdownHighlightedClass;
|
|
3712
|
+
if (props.noOptionsText !== void 0)
|
|
3713
|
+
inputProps.noOptionsText = props.noOptionsText;
|
|
3463
3714
|
return inputProps;
|
|
3464
3715
|
});
|
|
3465
3716
|
const notationBindings = computed(() => ({
|
|
@@ -6274,4 +6525,4 @@ export {
|
|
|
6274
6525
|
_sfc_main$B as y,
|
|
6275
6526
|
_sfc_main$A as z
|
|
6276
6527
|
};
|
|
6277
|
-
//# sourceMappingURL=plugin-
|
|
6528
|
+
//# sourceMappingURL=plugin-Bl7pzq-e.js.map
|