@getlupa/client 1.14.3 → 1.14.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lupaSearch.iife.js +116 -22
- package/dist/lupaSearch.js +116 -22
- package/dist/lupaSearch.mjs +116 -22
- package/dist/lupaSearch.umd.js +116 -22
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/lupaSearch.iife.js
CHANGED
|
@@ -8561,7 +8561,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
8561
8561
|
const _hoisted_1$1d = { id: "lupa-search-box-input-container" };
|
|
8562
8562
|
const _hoisted_2$S = { class: "lupa-input-clear" };
|
|
8563
8563
|
const _hoisted_3$B = { id: "lupa-search-box-input" };
|
|
8564
|
-
const _hoisted_4$
|
|
8564
|
+
const _hoisted_4$s = ["value"];
|
|
8565
8565
|
const _hoisted_5$k = ["aria-label", "placeholder"];
|
|
8566
8566
|
const _hoisted_6$a = /* @__PURE__ */ createBaseVNode("span", { class: "lupa-search-submit-icon" }, null, -1);
|
|
8567
8567
|
const _hoisted_7$7 = [
|
|
@@ -8668,7 +8668,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
8668
8668
|
"aria-hidden": "true",
|
|
8669
8669
|
value: showHint.value ? suggestedValue.value.item.suggestion : "",
|
|
8670
8670
|
disabled: ""
|
|
8671
|
-
}, null, 8, _hoisted_4$
|
|
8671
|
+
}, null, 8, _hoisted_4$s),
|
|
8672
8672
|
withDirectives(createBaseVNode("input", mergeProps({
|
|
8673
8673
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
|
|
8674
8674
|
}, inputAttributes.value, {
|
|
@@ -8841,6 +8841,34 @@ var __async = (__this, __arguments, generator) => {
|
|
|
8841
8841
|
};
|
|
8842
8842
|
}
|
|
8843
8843
|
});
|
|
8844
|
+
const generateGridTemplate = (elements) => {
|
|
8845
|
+
const indexedElements = elements.map((el, index) => __spreadProps2(__spreadValues2({}, el), { index }));
|
|
8846
|
+
if (!indexedElements.length || !indexedElements.every((el) => el.gridArea === "left" || el.gridArea === "right")) {
|
|
8847
|
+
return void 0;
|
|
8848
|
+
}
|
|
8849
|
+
let leftElements = indexedElements.filter((el) => el.gridArea === "left");
|
|
8850
|
+
let rightElements = indexedElements.filter((el) => el.gridArea === "right");
|
|
8851
|
+
if (!leftElements.length && !rightElements.length) {
|
|
8852
|
+
return "";
|
|
8853
|
+
} else if (!leftElements.length) {
|
|
8854
|
+
leftElements = rightElements;
|
|
8855
|
+
} else if (!rightElements.length) {
|
|
8856
|
+
rightElements = leftElements;
|
|
8857
|
+
}
|
|
8858
|
+
const totalRows = Math.max(leftElements.length, rightElements.length);
|
|
8859
|
+
const gridTemplate = [];
|
|
8860
|
+
for (let row = 0; row < totalRows; row++) {
|
|
8861
|
+
const leftIndex = row < leftElements.length ? row : leftElements.length - 1;
|
|
8862
|
+
const rightIndex = row < rightElements.length ? row : rightElements.length - 1;
|
|
8863
|
+
const leftElement = leftElements[leftIndex];
|
|
8864
|
+
const rightElement = rightElements[rightIndex];
|
|
8865
|
+
const leftColumn = `${leftElement.gridArea}${leftElement.index}`;
|
|
8866
|
+
const rightColumn = `${rightElement.gridArea}${rightElement.index}`;
|
|
8867
|
+
const gridRow = `${leftColumn} ${rightColumn}`;
|
|
8868
|
+
gridTemplate.push(`"${gridRow}"`);
|
|
8869
|
+
}
|
|
8870
|
+
return gridTemplate.join(" ");
|
|
8871
|
+
};
|
|
8844
8872
|
const _hoisted_1$19 = ["innerHTML"];
|
|
8845
8873
|
const _hoisted_2$Q = {
|
|
8846
8874
|
key: 1,
|
|
@@ -8852,7 +8880,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
8852
8880
|
class: "lupa-suggestion-facet",
|
|
8853
8881
|
"data-cy": "lupa-suggestion-facet"
|
|
8854
8882
|
};
|
|
8855
|
-
const _hoisted_4$
|
|
8883
|
+
const _hoisted_4$r = {
|
|
8856
8884
|
class: "lupa-suggestion-facet-label",
|
|
8857
8885
|
"data-cy": "lupa-suggestion-facet-label"
|
|
8858
8886
|
};
|
|
@@ -8898,7 +8926,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
8898
8926
|
innerHTML: _ctx.suggestion.displayHighlight
|
|
8899
8927
|
}, null, 8, _hoisted_1$19)) : (openBlock(), createElementBlock("div", _hoisted_2$Q, toDisplayString(_ctx.suggestion.display), 1)),
|
|
8900
8928
|
_ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$A, [
|
|
8901
|
-
createBaseVNode("span", _hoisted_4$
|
|
8929
|
+
createBaseVNode("span", _hoisted_4$r, toDisplayString(facetLabel.value), 1),
|
|
8902
8930
|
createBaseVNode("span", _hoisted_5$j, toDisplayString(_ctx.suggestion.facet.title), 1)
|
|
8903
8931
|
])) : createCommentVNode("", true)
|
|
8904
8932
|
]);
|
|
@@ -9039,6 +9067,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
9039
9067
|
});
|
|
9040
9068
|
};
|
|
9041
9069
|
const getSuggestionsDebounced = debounce$1(getSuggestions, props.debounce);
|
|
9070
|
+
watch(() => props.panel.limit, getSuggestionsDebounced);
|
|
9042
9071
|
return (_ctx, _cache) => {
|
|
9043
9072
|
return openBlock(), createBlock(_sfc_main$1h, {
|
|
9044
9073
|
items: searchResult.value,
|
|
@@ -18159,6 +18188,25 @@ and ensure you are accounting for this risk.
|
|
|
18159
18188
|
var _a;
|
|
18160
18189
|
return Boolean((_a = hoverImages.value) == null ? void 0 : _a.length);
|
|
18161
18190
|
});
|
|
18191
|
+
const widthOverride = computed(() => {
|
|
18192
|
+
var _a, _b;
|
|
18193
|
+
return (_b = (_a = props.options.dimensions) == null ? void 0 : _a.width) != null ? _b : void 0;
|
|
18194
|
+
});
|
|
18195
|
+
const heightOverride = computed(() => {
|
|
18196
|
+
var _a, _b;
|
|
18197
|
+
return (_b = (_a = props.options.dimensions) == null ? void 0 : _a.height) != null ? _b : void 0;
|
|
18198
|
+
});
|
|
18199
|
+
const objectFitOverride = computed(() => {
|
|
18200
|
+
var _a, _b;
|
|
18201
|
+
return (_b = (_a = props.options.dimensions) == null ? void 0 : _a.objectFit) != null ? _b : void 0;
|
|
18202
|
+
});
|
|
18203
|
+
const styleOverride = computed(() => {
|
|
18204
|
+
return {
|
|
18205
|
+
width: widthOverride.value ? `${widthOverride.value}px` : void 0,
|
|
18206
|
+
height: heightOverride.value ? `${heightOverride.value}px` : void 0,
|
|
18207
|
+
objectFit: objectFitOverride.value ? objectFitOverride.value : void 0
|
|
18208
|
+
};
|
|
18209
|
+
});
|
|
18162
18210
|
const replaceWithPlaceholder = (e2) => {
|
|
18163
18211
|
replaceImageWithPlaceholder(e2, placeholder.value);
|
|
18164
18212
|
};
|
|
@@ -18223,6 +18271,7 @@ and ensure you are accounting for this risk.
|
|
|
18223
18271
|
return (_ctx, _cache) => {
|
|
18224
18272
|
return openBlock(), createElementBlock("div", {
|
|
18225
18273
|
class: normalizeClass({ [_ctx.wrapperClass]: Boolean(_ctx.wrapperClass), "lupa-images-hover": isHover.value }),
|
|
18274
|
+
style: normalizeStyle(styleOverride.value),
|
|
18226
18275
|
onMouseenter: handleMouseEnter,
|
|
18227
18276
|
onMouseleave: handleMouseLeave
|
|
18228
18277
|
}, [
|
|
@@ -18233,6 +18282,7 @@ and ensure you are accounting for this risk.
|
|
|
18233
18282
|
default: withCtx(() => [
|
|
18234
18283
|
(openBlock(), createElementBlock("img", mergeProps({
|
|
18235
18284
|
class: ["lupa-images-hover-image", { [_ctx.imageClass]: true, "lupa-images-hover-image": isHover.value }],
|
|
18285
|
+
style: styleOverride.value,
|
|
18236
18286
|
src: finalUrl.value
|
|
18237
18287
|
}, { alt: imageAlt.value ? imageAlt.value : void 0 }, {
|
|
18238
18288
|
onError: replaceWithPlaceholder,
|
|
@@ -18243,9 +18293,10 @@ and ensure you are accounting for this risk.
|
|
|
18243
18293
|
})) : (openBlock(), createElementBlock("img", mergeProps({
|
|
18244
18294
|
key: 1,
|
|
18245
18295
|
class: ["lupa-images-main-image", { [_ctx.imageClass]: true }],
|
|
18296
|
+
style: styleOverride.value,
|
|
18246
18297
|
src: finalMainImageUrl.value
|
|
18247
18298
|
}, { alt: imageAlt.value ? imageAlt.value : void 0 }, { onError: replaceWithPlaceholder }), null, 16, _hoisted_2$P))
|
|
18248
|
-
],
|
|
18299
|
+
], 38);
|
|
18249
18300
|
};
|
|
18250
18301
|
}
|
|
18251
18302
|
});
|
|
@@ -18387,7 +18438,7 @@ and ensure you are accounting for this risk.
|
|
|
18387
18438
|
const _hoisted_1$13 = ["innerHTML"];
|
|
18388
18439
|
const _hoisted_2$M = { key: 0 };
|
|
18389
18440
|
const _hoisted_3$z = { key: 1 };
|
|
18390
|
-
const _hoisted_4$
|
|
18441
|
+
const _hoisted_4$q = { class: "lupa-search-box-custom-label" };
|
|
18391
18442
|
const _hoisted_5$i = { class: "lupa-search-box-custom-text" };
|
|
18392
18443
|
const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
18393
18444
|
__name: "SearchBoxProductCustom",
|
|
@@ -18420,7 +18471,7 @@ and ensure you are accounting for this risk.
|
|
|
18420
18471
|
class: [className.value, "lupa-search-box-product-custom"]
|
|
18421
18472
|
}, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
|
|
18422
18473
|
!label.value ? (openBlock(), createElementBlock("div", _hoisted_2$M, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$z, [
|
|
18423
|
-
createBaseVNode("div", _hoisted_4$
|
|
18474
|
+
createBaseVNode("div", _hoisted_4$q, toDisplayString(label.value), 1),
|
|
18424
18475
|
createBaseVNode("div", _hoisted_5$i, toDisplayString(text.value), 1)
|
|
18425
18476
|
]))
|
|
18426
18477
|
], 16));
|
|
@@ -18827,7 +18878,7 @@ and ensure you are accounting for this risk.
|
|
|
18827
18878
|
const _hoisted_1$$ = { class: "lupa-badge-title" };
|
|
18828
18879
|
const _hoisted_2$K = ["src"];
|
|
18829
18880
|
const _hoisted_3$x = { key: 1 };
|
|
18830
|
-
const _hoisted_4$
|
|
18881
|
+
const _hoisted_4$p = {
|
|
18831
18882
|
key: 0,
|
|
18832
18883
|
class: "lupa-badge-full-text"
|
|
18833
18884
|
};
|
|
@@ -18871,7 +18922,7 @@ and ensure you are accounting for this risk.
|
|
|
18871
18922
|
}, null, 8, _hoisted_2$K)) : createCommentVNode("", true),
|
|
18872
18923
|
hasTitleText.value && showTitle.value ? (openBlock(), createElementBlock("span", _hoisted_3$x, toDisplayString(_ctx.badge.titleText), 1)) : createCommentVNode("", true)
|
|
18873
18924
|
]),
|
|
18874
|
-
hasAdditionalText.value ? (openBlock(), createElementBlock("span", _hoisted_4$
|
|
18925
|
+
hasAdditionalText.value ? (openBlock(), createElementBlock("span", _hoisted_4$p, toDisplayString(_ctx.badge.additionalText), 1)) : createCommentVNode("", true)
|
|
18875
18926
|
], 6);
|
|
18876
18927
|
};
|
|
18877
18928
|
}
|
|
@@ -19095,9 +19146,8 @@ and ensure you are accounting for this risk.
|
|
|
19095
19146
|
}
|
|
19096
19147
|
}));
|
|
19097
19148
|
const _hoisted_1$V = ["href"];
|
|
19098
|
-
const _hoisted_2$I = { class: "lupa-search-box-product-
|
|
19099
|
-
const _hoisted_3$w = {
|
|
19100
|
-
const _hoisted_4$p = {
|
|
19149
|
+
const _hoisted_2$I = { class: "lupa-search-box-product-details-section" };
|
|
19150
|
+
const _hoisted_3$w = {
|
|
19101
19151
|
key: 0,
|
|
19102
19152
|
class: "lupa-search-box-product-add-to-cart-section"
|
|
19103
19153
|
};
|
|
@@ -19125,6 +19175,25 @@ and ensure you are accounting for this risk.
|
|
|
19125
19175
|
var _a, _b;
|
|
19126
19176
|
return (_b = (_a = props.panelOptions.elements) == null ? void 0 : _a.filter((e2) => e2.type === DocumentElementType.IMAGE)) != null ? _b : [];
|
|
19127
19177
|
});
|
|
19178
|
+
const mainImageElement = computed(() => {
|
|
19179
|
+
return imageElements.value[0];
|
|
19180
|
+
});
|
|
19181
|
+
const widthOverride = computed(() => {
|
|
19182
|
+
var _a, _b, _c;
|
|
19183
|
+
return (_c = (_b = (_a = mainImageElement.value) == null ? void 0 : _a.dimensions) == null ? void 0 : _b.width) != null ? _c : void 0;
|
|
19184
|
+
});
|
|
19185
|
+
const heightOverride = computed(() => {
|
|
19186
|
+
var _a, _b, _c;
|
|
19187
|
+
return (_c = (_b = (_a = mainImageElement.value) == null ? void 0 : _a.dimensions) == null ? void 0 : _b.height) != null ? _c : void 0;
|
|
19188
|
+
});
|
|
19189
|
+
const imageStyleOverride = computed(() => {
|
|
19190
|
+
var _a;
|
|
19191
|
+
return ((_a = mainImageElement.value) == null ? void 0 : _a.dimensions) ? {
|
|
19192
|
+
width: widthOverride.value ? `${widthOverride.value}px` : void 0,
|
|
19193
|
+
height: heightOverride.value ? `${heightOverride.value}px` : void 0,
|
|
19194
|
+
minWidth: widthOverride.value ? `${widthOverride.value + 10}px` : void 0
|
|
19195
|
+
} : {};
|
|
19196
|
+
});
|
|
19128
19197
|
const detailElements = computed(() => {
|
|
19129
19198
|
var _a, _b;
|
|
19130
19199
|
return (_b = (_a = props.panelOptions.elements) == null ? void 0 : _a.filter(
|
|
@@ -19163,7 +19232,10 @@ and ensure you are accounting for this risk.
|
|
|
19163
19232
|
"data-cy": "lupa-search-box-product",
|
|
19164
19233
|
onClick: handleClick
|
|
19165
19234
|
}), [
|
|
19166
|
-
createBaseVNode("div",
|
|
19235
|
+
createBaseVNode("div", {
|
|
19236
|
+
class: "lupa-search-box-product-image-section",
|
|
19237
|
+
style: normalizeStyle(imageStyleOverride.value)
|
|
19238
|
+
}, [
|
|
19167
19239
|
(openBlock(true), createElementBlock(Fragment, null, renderList(imageElements.value, (element) => {
|
|
19168
19240
|
return openBlock(), createBlock(_sfc_main$16, {
|
|
19169
19241
|
class: "lupa-search-box-product-element",
|
|
@@ -19174,8 +19246,8 @@ and ensure you are accounting for this risk.
|
|
|
19174
19246
|
link: link.value
|
|
19175
19247
|
}, null, 8, ["item", "element", "labels", "link"]);
|
|
19176
19248
|
}), 128))
|
|
19177
|
-
]),
|
|
19178
|
-
createBaseVNode("div",
|
|
19249
|
+
], 4),
|
|
19250
|
+
createBaseVNode("div", _hoisted_2$I, [
|
|
19179
19251
|
(openBlock(true), createElementBlock(Fragment, null, renderList(detailElements.value, (element) => {
|
|
19180
19252
|
var _a;
|
|
19181
19253
|
return openBlock(), createBlock(_sfc_main$16, {
|
|
@@ -19199,7 +19271,7 @@ and ensure you are accounting for this risk.
|
|
|
19199
19271
|
]), 1032, ["item", "element", "labels", "link"]);
|
|
19200
19272
|
}), 128))
|
|
19201
19273
|
]),
|
|
19202
|
-
addToCartElement.value ? (openBlock(), createElementBlock("div",
|
|
19274
|
+
addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_3$w, [
|
|
19203
19275
|
createVNode(_sfc_main$16, {
|
|
19204
19276
|
class: "lupa-search-box-product-element",
|
|
19205
19277
|
item: _ctx.item,
|
|
@@ -19457,6 +19529,7 @@ and ensure you are accounting for this risk.
|
|
|
19457
19529
|
});
|
|
19458
19530
|
};
|
|
19459
19531
|
const getItemsDebounced = debounce$1(getItems, props.debounce);
|
|
19532
|
+
watch(() => props.panel.limit, getItemsDebounced);
|
|
19460
19533
|
return (_ctx, _cache) => {
|
|
19461
19534
|
var _a, _b;
|
|
19462
19535
|
return openBlock(), createBlock(_sfc_main$_, {
|
|
@@ -19645,6 +19718,13 @@ and ensure you are accounting for this risk.
|
|
|
19645
19718
|
const displayPanels = computed(
|
|
19646
19719
|
() => props.isSearchContainer ? panels.value.filter((p2) => p2.type === SearchBoxPanelType.SUGGESTION) : panels.value
|
|
19647
19720
|
);
|
|
19721
|
+
const gridTemplate = computed(() => generateGridTemplate(panels.value));
|
|
19722
|
+
const styleOverrides = computed(() => {
|
|
19723
|
+
return {
|
|
19724
|
+
display: expandOnSinglePanel.value ? "block" : "grid",
|
|
19725
|
+
gridTemplateAreas: gridTemplate.value ? gridTemplate.value : "left right"
|
|
19726
|
+
};
|
|
19727
|
+
});
|
|
19648
19728
|
const getInput = (panel) => {
|
|
19649
19729
|
var _a, _b;
|
|
19650
19730
|
if (panel.type === SearchBoxPanelType.SUGGESTION || !panel.searchBySuggestion) {
|
|
@@ -19671,6 +19751,9 @@ and ensure you are accounting for this risk.
|
|
|
19671
19751
|
searchBoxStore.resetHighlightIndex();
|
|
19672
19752
|
});
|
|
19673
19753
|
const handleNavigation = (e2) => {
|
|
19754
|
+
if (!props.focused) {
|
|
19755
|
+
return;
|
|
19756
|
+
}
|
|
19674
19757
|
switch (e2.key) {
|
|
19675
19758
|
case "ArrowDown":
|
|
19676
19759
|
e2.preventDefault();
|
|
@@ -19758,7 +19841,7 @@ and ensure you are accounting for this risk.
|
|
|
19758
19841
|
}, toDisplayString(labels.value.closePanel), 1)) : createCommentVNode("", true),
|
|
19759
19842
|
createBaseVNode("div", {
|
|
19760
19843
|
class: "lupa-main-panel",
|
|
19761
|
-
style: normalizeStyle(
|
|
19844
|
+
style: normalizeStyle(styleOverrides.value),
|
|
19762
19845
|
"data-cy": "lupa-main-panel"
|
|
19763
19846
|
}, [
|
|
19764
19847
|
(openBlock(true), createElementBlock(Fragment, null, renderList(displayPanels.value, (panel, index) => {
|
|
@@ -19769,6 +19852,7 @@ and ensure you are accounting for this risk.
|
|
|
19769
19852
|
"lupa-panel-" + panel.type + "-index",
|
|
19770
19853
|
panel.customClassName ? panel.customClassName : ""
|
|
19771
19854
|
]),
|
|
19855
|
+
style: normalizeStyle(panel.gridArea ? { gridArea: `${panel.gridArea}${index}` } : {}),
|
|
19772
19856
|
"data-cy": "lupa-panel-" + panel.type + "-index"
|
|
19773
19857
|
}, [
|
|
19774
19858
|
((_a2 = panel.labels) == null ? void 0 : _a2.topResultsTitle) && showTopResultsPanelTitle(panel.queryKey) ? (openBlock(), createElementBlock("div", _hoisted_3$v, toDisplayString((_b = panel.labels) == null ? void 0 : _b.topResultsTitle), 1)) : createCommentVNode("", true),
|
|
@@ -19794,7 +19878,7 @@ and ensure you are accounting for this risk.
|
|
|
19794
19878
|
key: "0"
|
|
19795
19879
|
} : void 0
|
|
19796
19880
|
]), 1064, ["panel", "search-box-options", "options", "debounce", "inputValue", "labels"])) : createCommentVNode("", true)
|
|
19797
|
-
],
|
|
19881
|
+
], 14, _hoisted_2$G);
|
|
19798
19882
|
}), 128))
|
|
19799
19883
|
], 4),
|
|
19800
19884
|
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1j, {
|
|
@@ -19858,6 +19942,7 @@ and ensure you are accounting for this risk.
|
|
|
19858
19942
|
const inputValue = ref("");
|
|
19859
19943
|
const suggestedValue = ref(defaultSuggestedValue);
|
|
19860
19944
|
const opened = ref(props.isSearchContainer);
|
|
19945
|
+
const focused = ref(false);
|
|
19861
19946
|
const searchBoxInput = ref(null);
|
|
19862
19947
|
const { highlightedDocument } = storeToRefs(searchBoxStore);
|
|
19863
19948
|
const searchValue = computed(() => {
|
|
@@ -19916,6 +20001,9 @@ and ensure you are accounting for this risk.
|
|
|
19916
20001
|
const elementClass = (_b = (_a2 = e2.target) == null ? void 0 : _a2.className) != null ? _b : "";
|
|
19917
20002
|
const hasLupaClass = typeof elementClass.includes == "function" && elementClass.includes("lupa-search-box");
|
|
19918
20003
|
const isOutsideElement = el && !el.contains(e2.target) && !hasLupaClass;
|
|
20004
|
+
if (isOutsideElement && props.options.keepOpen) {
|
|
20005
|
+
focused.value = false;
|
|
20006
|
+
}
|
|
19919
20007
|
if (!isOutsideElement || props.options.keepOpen) {
|
|
19920
20008
|
return;
|
|
19921
20009
|
}
|
|
@@ -19924,11 +20012,12 @@ and ensure you are accounting for this risk.
|
|
|
19924
20012
|
};
|
|
19925
20013
|
const close = () => {
|
|
19926
20014
|
opened.value = false;
|
|
20015
|
+
focused.value = false;
|
|
19927
20016
|
suggestedValue.value = defaultSuggestedValue;
|
|
19928
20017
|
};
|
|
19929
20018
|
const handleKeyDown = (e2) => {
|
|
19930
20019
|
var _a2, _b;
|
|
19931
|
-
if (!
|
|
20020
|
+
if (!focused.value) {
|
|
19932
20021
|
return;
|
|
19933
20022
|
}
|
|
19934
20023
|
switch (e2.key) {
|
|
@@ -19948,6 +20037,7 @@ and ensure you are accounting for this risk.
|
|
|
19948
20037
|
const handleInput = (value) => {
|
|
19949
20038
|
var _a2;
|
|
19950
20039
|
opened.value = true;
|
|
20040
|
+
focused.value = true;
|
|
19951
20041
|
inputValue.value = (_a2 = value == null ? void 0 : value.replace(/\s+$/, "")) != null ? _a2 : "";
|
|
19952
20042
|
suggestedValue.value = defaultSuggestedValue;
|
|
19953
20043
|
searchBoxStore.resetHighlightIndex();
|
|
@@ -20075,12 +20165,14 @@ and ensure you are accounting for this risk.
|
|
|
20075
20165
|
}
|
|
20076
20166
|
});
|
|
20077
20167
|
};
|
|
20168
|
+
watch(() => props.options.debounce, handleCurrentValueSearch);
|
|
20078
20169
|
const resetValues = () => {
|
|
20079
20170
|
inputValue.value = "";
|
|
20080
20171
|
suggestedValue.value = defaultSuggestedValue;
|
|
20081
20172
|
};
|
|
20082
20173
|
const handleProductClick = () => {
|
|
20083
20174
|
opened.value = false;
|
|
20175
|
+
focused.value = false;
|
|
20084
20176
|
};
|
|
20085
20177
|
const slotProps = (props2) => {
|
|
20086
20178
|
return __spreadValues2({}, props2);
|
|
@@ -20097,15 +20189,17 @@ and ensure you are accounting for this risk.
|
|
|
20097
20189
|
ref_key: "searchBoxInput",
|
|
20098
20190
|
ref: searchBoxInput,
|
|
20099
20191
|
onInput: handleInput,
|
|
20100
|
-
|
|
20192
|
+
onBlur: _cache[0] || (_cache[0] = ($event) => focused.value = false),
|
|
20193
|
+
onFocus: _cache[1] || (_cache[1] = ($event) => opened.value = true),
|
|
20101
20194
|
onSearch: handleSearch,
|
|
20102
|
-
onClose: _cache[
|
|
20195
|
+
onClose: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("close"))
|
|
20103
20196
|
}, null, 8, ["options", "suggestedValue", "can-close", "emit-input-on-focus"]),
|
|
20104
20197
|
opened.value || _ctx.isSearchContainer ? (openBlock(), createBlock(_sfc_main$W, {
|
|
20105
20198
|
key: 0,
|
|
20106
20199
|
options: panelOptions.value,
|
|
20107
20200
|
inputValue: inputValue.value,
|
|
20108
20201
|
isSearchContainer: _ctx.isSearchContainer,
|
|
20202
|
+
focused: focused.value,
|
|
20109
20203
|
onFetched: handleItemsFetch,
|
|
20110
20204
|
onItemSelect: handleItemSelect,
|
|
20111
20205
|
onGoToResults: handleSearch,
|
|
@@ -20119,7 +20213,7 @@ and ensure you are accounting for this risk.
|
|
|
20119
20213
|
]),
|
|
20120
20214
|
key: "0"
|
|
20121
20215
|
} : void 0
|
|
20122
|
-
]), 1032, ["options", "inputValue", "isSearchContainer"])) : createCommentVNode("", true)
|
|
20216
|
+
]), 1032, ["options", "inputValue", "isSearchContainer", "focused"])) : createCommentVNode("", true)
|
|
20123
20217
|
])
|
|
20124
20218
|
]);
|
|
20125
20219
|
};
|