@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.mjs
CHANGED
|
@@ -8559,7 +8559,7 @@ const useSearchBoxStore = defineStore("searchBox", () => {
|
|
|
8559
8559
|
const _hoisted_1$1d = { id: "lupa-search-box-input-container" };
|
|
8560
8560
|
const _hoisted_2$S = { class: "lupa-input-clear" };
|
|
8561
8561
|
const _hoisted_3$B = { id: "lupa-search-box-input" };
|
|
8562
|
-
const _hoisted_4$
|
|
8562
|
+
const _hoisted_4$s = ["value"];
|
|
8563
8563
|
const _hoisted_5$k = ["aria-label", "placeholder"];
|
|
8564
8564
|
const _hoisted_6$a = /* @__PURE__ */ createBaseVNode("span", { class: "lupa-search-submit-icon" }, null, -1);
|
|
8565
8565
|
const _hoisted_7$7 = [
|
|
@@ -8666,7 +8666,7 @@ const _sfc_main$1n = /* @__PURE__ */ defineComponent({
|
|
|
8666
8666
|
"aria-hidden": "true",
|
|
8667
8667
|
value: showHint.value ? suggestedValue.value.item.suggestion : "",
|
|
8668
8668
|
disabled: ""
|
|
8669
|
-
}, null, 8, _hoisted_4$
|
|
8669
|
+
}, null, 8, _hoisted_4$s),
|
|
8670
8670
|
withDirectives(createBaseVNode("input", mergeProps({
|
|
8671
8671
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
|
|
8672
8672
|
}, inputAttributes.value, {
|
|
@@ -8839,6 +8839,34 @@ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
|
|
|
8839
8839
|
};
|
|
8840
8840
|
}
|
|
8841
8841
|
});
|
|
8842
|
+
const generateGridTemplate = (elements) => {
|
|
8843
|
+
const indexedElements = elements.map((el, index) => __spreadProps2(__spreadValues2({}, el), { index }));
|
|
8844
|
+
if (!indexedElements.length || !indexedElements.every((el) => el.gridArea === "left" || el.gridArea === "right")) {
|
|
8845
|
+
return void 0;
|
|
8846
|
+
}
|
|
8847
|
+
let leftElements = indexedElements.filter((el) => el.gridArea === "left");
|
|
8848
|
+
let rightElements = indexedElements.filter((el) => el.gridArea === "right");
|
|
8849
|
+
if (!leftElements.length && !rightElements.length) {
|
|
8850
|
+
return "";
|
|
8851
|
+
} else if (!leftElements.length) {
|
|
8852
|
+
leftElements = rightElements;
|
|
8853
|
+
} else if (!rightElements.length) {
|
|
8854
|
+
rightElements = leftElements;
|
|
8855
|
+
}
|
|
8856
|
+
const totalRows = Math.max(leftElements.length, rightElements.length);
|
|
8857
|
+
const gridTemplate = [];
|
|
8858
|
+
for (let row = 0; row < totalRows; row++) {
|
|
8859
|
+
const leftIndex = row < leftElements.length ? row : leftElements.length - 1;
|
|
8860
|
+
const rightIndex = row < rightElements.length ? row : rightElements.length - 1;
|
|
8861
|
+
const leftElement = leftElements[leftIndex];
|
|
8862
|
+
const rightElement = rightElements[rightIndex];
|
|
8863
|
+
const leftColumn = `${leftElement.gridArea}${leftElement.index}`;
|
|
8864
|
+
const rightColumn = `${rightElement.gridArea}${rightElement.index}`;
|
|
8865
|
+
const gridRow = `${leftColumn} ${rightColumn}`;
|
|
8866
|
+
gridTemplate.push(`"${gridRow}"`);
|
|
8867
|
+
}
|
|
8868
|
+
return gridTemplate.join(" ");
|
|
8869
|
+
};
|
|
8842
8870
|
const _hoisted_1$19 = ["innerHTML"];
|
|
8843
8871
|
const _hoisted_2$Q = {
|
|
8844
8872
|
key: 1,
|
|
@@ -8850,7 +8878,7 @@ const _hoisted_3$A = {
|
|
|
8850
8878
|
class: "lupa-suggestion-facet",
|
|
8851
8879
|
"data-cy": "lupa-suggestion-facet"
|
|
8852
8880
|
};
|
|
8853
|
-
const _hoisted_4$
|
|
8881
|
+
const _hoisted_4$r = {
|
|
8854
8882
|
class: "lupa-suggestion-facet-label",
|
|
8855
8883
|
"data-cy": "lupa-suggestion-facet-label"
|
|
8856
8884
|
};
|
|
@@ -8896,7 +8924,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
8896
8924
|
innerHTML: _ctx.suggestion.displayHighlight
|
|
8897
8925
|
}, null, 8, _hoisted_1$19)) : (openBlock(), createElementBlock("div", _hoisted_2$Q, toDisplayString(_ctx.suggestion.display), 1)),
|
|
8898
8926
|
_ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$A, [
|
|
8899
|
-
createBaseVNode("span", _hoisted_4$
|
|
8927
|
+
createBaseVNode("span", _hoisted_4$r, toDisplayString(facetLabel.value), 1),
|
|
8900
8928
|
createBaseVNode("span", _hoisted_5$j, toDisplayString(_ctx.suggestion.facet.title), 1)
|
|
8901
8929
|
])) : createCommentVNode("", true)
|
|
8902
8930
|
]);
|
|
@@ -9037,6 +9065,7 @@ const _sfc_main$1g = /* @__PURE__ */ defineComponent({
|
|
|
9037
9065
|
});
|
|
9038
9066
|
};
|
|
9039
9067
|
const getSuggestionsDebounced = debounce$1(getSuggestions, props.debounce);
|
|
9068
|
+
watch(() => props.panel.limit, getSuggestionsDebounced);
|
|
9040
9069
|
return (_ctx, _cache) => {
|
|
9041
9070
|
return openBlock(), createBlock(_sfc_main$1h, {
|
|
9042
9071
|
items: searchResult.value,
|
|
@@ -18157,6 +18186,25 @@ const _sfc_main$1f = /* @__PURE__ */ defineComponent({
|
|
|
18157
18186
|
var _a;
|
|
18158
18187
|
return Boolean((_a = hoverImages.value) == null ? void 0 : _a.length);
|
|
18159
18188
|
});
|
|
18189
|
+
const widthOverride = computed(() => {
|
|
18190
|
+
var _a, _b;
|
|
18191
|
+
return (_b = (_a = props.options.dimensions) == null ? void 0 : _a.width) != null ? _b : void 0;
|
|
18192
|
+
});
|
|
18193
|
+
const heightOverride = computed(() => {
|
|
18194
|
+
var _a, _b;
|
|
18195
|
+
return (_b = (_a = props.options.dimensions) == null ? void 0 : _a.height) != null ? _b : void 0;
|
|
18196
|
+
});
|
|
18197
|
+
const objectFitOverride = computed(() => {
|
|
18198
|
+
var _a, _b;
|
|
18199
|
+
return (_b = (_a = props.options.dimensions) == null ? void 0 : _a.objectFit) != null ? _b : void 0;
|
|
18200
|
+
});
|
|
18201
|
+
const styleOverride = computed(() => {
|
|
18202
|
+
return {
|
|
18203
|
+
width: widthOverride.value ? `${widthOverride.value}px` : void 0,
|
|
18204
|
+
height: heightOverride.value ? `${heightOverride.value}px` : void 0,
|
|
18205
|
+
objectFit: objectFitOverride.value ? objectFitOverride.value : void 0
|
|
18206
|
+
};
|
|
18207
|
+
});
|
|
18160
18208
|
const replaceWithPlaceholder = (e2) => {
|
|
18161
18209
|
replaceImageWithPlaceholder(e2, placeholder.value);
|
|
18162
18210
|
};
|
|
@@ -18221,6 +18269,7 @@ const _sfc_main$1f = /* @__PURE__ */ defineComponent({
|
|
|
18221
18269
|
return (_ctx, _cache) => {
|
|
18222
18270
|
return openBlock(), createElementBlock("div", {
|
|
18223
18271
|
class: normalizeClass({ [_ctx.wrapperClass]: Boolean(_ctx.wrapperClass), "lupa-images-hover": isHover.value }),
|
|
18272
|
+
style: normalizeStyle(styleOverride.value),
|
|
18224
18273
|
onMouseenter: handleMouseEnter,
|
|
18225
18274
|
onMouseleave: handleMouseLeave
|
|
18226
18275
|
}, [
|
|
@@ -18231,6 +18280,7 @@ const _sfc_main$1f = /* @__PURE__ */ defineComponent({
|
|
|
18231
18280
|
default: withCtx(() => [
|
|
18232
18281
|
(openBlock(), createElementBlock("img", mergeProps({
|
|
18233
18282
|
class: ["lupa-images-hover-image", { [_ctx.imageClass]: true, "lupa-images-hover-image": isHover.value }],
|
|
18283
|
+
style: styleOverride.value,
|
|
18234
18284
|
src: finalUrl.value
|
|
18235
18285
|
}, { alt: imageAlt.value ? imageAlt.value : void 0 }, {
|
|
18236
18286
|
onError: replaceWithPlaceholder,
|
|
@@ -18241,9 +18291,10 @@ const _sfc_main$1f = /* @__PURE__ */ defineComponent({
|
|
|
18241
18291
|
})) : (openBlock(), createElementBlock("img", mergeProps({
|
|
18242
18292
|
key: 1,
|
|
18243
18293
|
class: ["lupa-images-main-image", { [_ctx.imageClass]: true }],
|
|
18294
|
+
style: styleOverride.value,
|
|
18244
18295
|
src: finalMainImageUrl.value
|
|
18245
18296
|
}, { alt: imageAlt.value ? imageAlt.value : void 0 }, { onError: replaceWithPlaceholder }), null, 16, _hoisted_2$P))
|
|
18246
|
-
],
|
|
18297
|
+
], 38);
|
|
18247
18298
|
};
|
|
18248
18299
|
}
|
|
18249
18300
|
});
|
|
@@ -18385,7 +18436,7 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
|
18385
18436
|
const _hoisted_1$13 = ["innerHTML"];
|
|
18386
18437
|
const _hoisted_2$M = { key: 0 };
|
|
18387
18438
|
const _hoisted_3$z = { key: 1 };
|
|
18388
|
-
const _hoisted_4$
|
|
18439
|
+
const _hoisted_4$q = { class: "lupa-search-box-custom-label" };
|
|
18389
18440
|
const _hoisted_5$i = { class: "lupa-search-box-custom-text" };
|
|
18390
18441
|
const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
18391
18442
|
__name: "SearchBoxProductCustom",
|
|
@@ -18418,7 +18469,7 @@ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
|
18418
18469
|
class: [className.value, "lupa-search-box-product-custom"]
|
|
18419
18470
|
}, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
|
|
18420
18471
|
!label.value ? (openBlock(), createElementBlock("div", _hoisted_2$M, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$z, [
|
|
18421
|
-
createBaseVNode("div", _hoisted_4$
|
|
18472
|
+
createBaseVNode("div", _hoisted_4$q, toDisplayString(label.value), 1),
|
|
18422
18473
|
createBaseVNode("div", _hoisted_5$i, toDisplayString(text.value), 1)
|
|
18423
18474
|
]))
|
|
18424
18475
|
], 16));
|
|
@@ -18825,7 +18876,7 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
|
|
|
18825
18876
|
const _hoisted_1$$ = { class: "lupa-badge-title" };
|
|
18826
18877
|
const _hoisted_2$K = ["src"];
|
|
18827
18878
|
const _hoisted_3$x = { key: 1 };
|
|
18828
|
-
const _hoisted_4$
|
|
18879
|
+
const _hoisted_4$p = {
|
|
18829
18880
|
key: 0,
|
|
18830
18881
|
class: "lupa-badge-full-text"
|
|
18831
18882
|
};
|
|
@@ -18869,7 +18920,7 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
|
|
|
18869
18920
|
}, null, 8, _hoisted_2$K)) : createCommentVNode("", true),
|
|
18870
18921
|
hasTitleText.value && showTitle.value ? (openBlock(), createElementBlock("span", _hoisted_3$x, toDisplayString(_ctx.badge.titleText), 1)) : createCommentVNode("", true)
|
|
18871
18922
|
]),
|
|
18872
|
-
hasAdditionalText.value ? (openBlock(), createElementBlock("span", _hoisted_4$
|
|
18923
|
+
hasAdditionalText.value ? (openBlock(), createElementBlock("span", _hoisted_4$p, toDisplayString(_ctx.badge.additionalText), 1)) : createCommentVNode("", true)
|
|
18873
18924
|
], 6);
|
|
18874
18925
|
};
|
|
18875
18926
|
}
|
|
@@ -19093,9 +19144,8 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
|
|
|
19093
19144
|
}
|
|
19094
19145
|
}));
|
|
19095
19146
|
const _hoisted_1$V = ["href"];
|
|
19096
|
-
const _hoisted_2$I = { class: "lupa-search-box-product-
|
|
19097
|
-
const _hoisted_3$w = {
|
|
19098
|
-
const _hoisted_4$p = {
|
|
19147
|
+
const _hoisted_2$I = { class: "lupa-search-box-product-details-section" };
|
|
19148
|
+
const _hoisted_3$w = {
|
|
19099
19149
|
key: 0,
|
|
19100
19150
|
class: "lupa-search-box-product-add-to-cart-section"
|
|
19101
19151
|
};
|
|
@@ -19123,6 +19173,25 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
|
|
|
19123
19173
|
var _a, _b;
|
|
19124
19174
|
return (_b = (_a = props.panelOptions.elements) == null ? void 0 : _a.filter((e2) => e2.type === DocumentElementType.IMAGE)) != null ? _b : [];
|
|
19125
19175
|
});
|
|
19176
|
+
const mainImageElement = computed(() => {
|
|
19177
|
+
return imageElements.value[0];
|
|
19178
|
+
});
|
|
19179
|
+
const widthOverride = computed(() => {
|
|
19180
|
+
var _a, _b, _c;
|
|
19181
|
+
return (_c = (_b = (_a = mainImageElement.value) == null ? void 0 : _a.dimensions) == null ? void 0 : _b.width) != null ? _c : void 0;
|
|
19182
|
+
});
|
|
19183
|
+
const heightOverride = computed(() => {
|
|
19184
|
+
var _a, _b, _c;
|
|
19185
|
+
return (_c = (_b = (_a = mainImageElement.value) == null ? void 0 : _a.dimensions) == null ? void 0 : _b.height) != null ? _c : void 0;
|
|
19186
|
+
});
|
|
19187
|
+
const imageStyleOverride = computed(() => {
|
|
19188
|
+
var _a;
|
|
19189
|
+
return ((_a = mainImageElement.value) == null ? void 0 : _a.dimensions) ? {
|
|
19190
|
+
width: widthOverride.value ? `${widthOverride.value}px` : void 0,
|
|
19191
|
+
height: heightOverride.value ? `${heightOverride.value}px` : void 0,
|
|
19192
|
+
minWidth: widthOverride.value ? `${widthOverride.value + 10}px` : void 0
|
|
19193
|
+
} : {};
|
|
19194
|
+
});
|
|
19126
19195
|
const detailElements = computed(() => {
|
|
19127
19196
|
var _a, _b;
|
|
19128
19197
|
return (_b = (_a = props.panelOptions.elements) == null ? void 0 : _a.filter(
|
|
@@ -19161,7 +19230,10 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
|
|
|
19161
19230
|
"data-cy": "lupa-search-box-product",
|
|
19162
19231
|
onClick: handleClick
|
|
19163
19232
|
}), [
|
|
19164
|
-
createBaseVNode("div",
|
|
19233
|
+
createBaseVNode("div", {
|
|
19234
|
+
class: "lupa-search-box-product-image-section",
|
|
19235
|
+
style: normalizeStyle(imageStyleOverride.value)
|
|
19236
|
+
}, [
|
|
19165
19237
|
(openBlock(true), createElementBlock(Fragment, null, renderList(imageElements.value, (element) => {
|
|
19166
19238
|
return openBlock(), createBlock(_sfc_main$16, {
|
|
19167
19239
|
class: "lupa-search-box-product-element",
|
|
@@ -19172,8 +19244,8 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
|
|
|
19172
19244
|
link: link.value
|
|
19173
19245
|
}, null, 8, ["item", "element", "labels", "link"]);
|
|
19174
19246
|
}), 128))
|
|
19175
|
-
]),
|
|
19176
|
-
createBaseVNode("div",
|
|
19247
|
+
], 4),
|
|
19248
|
+
createBaseVNode("div", _hoisted_2$I, [
|
|
19177
19249
|
(openBlock(true), createElementBlock(Fragment, null, renderList(detailElements.value, (element) => {
|
|
19178
19250
|
var _a;
|
|
19179
19251
|
return openBlock(), createBlock(_sfc_main$16, {
|
|
@@ -19197,7 +19269,7 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
|
|
|
19197
19269
|
]), 1032, ["item", "element", "labels", "link"]);
|
|
19198
19270
|
}), 128))
|
|
19199
19271
|
]),
|
|
19200
|
-
addToCartElement.value ? (openBlock(), createElementBlock("div",
|
|
19272
|
+
addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_3$w, [
|
|
19201
19273
|
createVNode(_sfc_main$16, {
|
|
19202
19274
|
class: "lupa-search-box-product-element",
|
|
19203
19275
|
item: _ctx.item,
|
|
@@ -19455,6 +19527,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
|
|
|
19455
19527
|
});
|
|
19456
19528
|
};
|
|
19457
19529
|
const getItemsDebounced = debounce$1(getItems, props.debounce);
|
|
19530
|
+
watch(() => props.panel.limit, getItemsDebounced);
|
|
19458
19531
|
return (_ctx, _cache) => {
|
|
19459
19532
|
var _a, _b;
|
|
19460
19533
|
return openBlock(), createBlock(_sfc_main$_, {
|
|
@@ -19643,6 +19716,13 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
19643
19716
|
const displayPanels = computed(
|
|
19644
19717
|
() => props.isSearchContainer ? panels.value.filter((p2) => p2.type === SearchBoxPanelType.SUGGESTION) : panels.value
|
|
19645
19718
|
);
|
|
19719
|
+
const gridTemplate = computed(() => generateGridTemplate(panels.value));
|
|
19720
|
+
const styleOverrides = computed(() => {
|
|
19721
|
+
return {
|
|
19722
|
+
display: expandOnSinglePanel.value ? "block" : "grid",
|
|
19723
|
+
gridTemplateAreas: gridTemplate.value ? gridTemplate.value : "left right"
|
|
19724
|
+
};
|
|
19725
|
+
});
|
|
19646
19726
|
const getInput = (panel) => {
|
|
19647
19727
|
var _a, _b;
|
|
19648
19728
|
if (panel.type === SearchBoxPanelType.SUGGESTION || !panel.searchBySuggestion) {
|
|
@@ -19669,6 +19749,9 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
19669
19749
|
searchBoxStore.resetHighlightIndex();
|
|
19670
19750
|
});
|
|
19671
19751
|
const handleNavigation = (e2) => {
|
|
19752
|
+
if (!props.focused) {
|
|
19753
|
+
return;
|
|
19754
|
+
}
|
|
19672
19755
|
switch (e2.key) {
|
|
19673
19756
|
case "ArrowDown":
|
|
19674
19757
|
e2.preventDefault();
|
|
@@ -19756,7 +19839,7 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
19756
19839
|
}, toDisplayString(labels.value.closePanel), 1)) : createCommentVNode("", true),
|
|
19757
19840
|
createBaseVNode("div", {
|
|
19758
19841
|
class: "lupa-main-panel",
|
|
19759
|
-
style: normalizeStyle(
|
|
19842
|
+
style: normalizeStyle(styleOverrides.value),
|
|
19760
19843
|
"data-cy": "lupa-main-panel"
|
|
19761
19844
|
}, [
|
|
19762
19845
|
(openBlock(true), createElementBlock(Fragment, null, renderList(displayPanels.value, (panel, index) => {
|
|
@@ -19767,6 +19850,7 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
19767
19850
|
"lupa-panel-" + panel.type + "-index",
|
|
19768
19851
|
panel.customClassName ? panel.customClassName : ""
|
|
19769
19852
|
]),
|
|
19853
|
+
style: normalizeStyle(panel.gridArea ? { gridArea: `${panel.gridArea}${index}` } : {}),
|
|
19770
19854
|
"data-cy": "lupa-panel-" + panel.type + "-index"
|
|
19771
19855
|
}, [
|
|
19772
19856
|
((_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),
|
|
@@ -19792,7 +19876,7 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
19792
19876
|
key: "0"
|
|
19793
19877
|
} : void 0
|
|
19794
19878
|
]), 1064, ["panel", "search-box-options", "options", "debounce", "inputValue", "labels"])) : createCommentVNode("", true)
|
|
19795
|
-
],
|
|
19879
|
+
], 14, _hoisted_2$G);
|
|
19796
19880
|
}), 128))
|
|
19797
19881
|
], 4),
|
|
19798
19882
|
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1j, {
|
|
@@ -19856,6 +19940,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
19856
19940
|
const inputValue = ref("");
|
|
19857
19941
|
const suggestedValue = ref(defaultSuggestedValue);
|
|
19858
19942
|
const opened = ref(props.isSearchContainer);
|
|
19943
|
+
const focused = ref(false);
|
|
19859
19944
|
const searchBoxInput = ref(null);
|
|
19860
19945
|
const { highlightedDocument } = storeToRefs(searchBoxStore);
|
|
19861
19946
|
const searchValue = computed(() => {
|
|
@@ -19914,6 +19999,9 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
19914
19999
|
const elementClass = (_b = (_a2 = e2.target) == null ? void 0 : _a2.className) != null ? _b : "";
|
|
19915
20000
|
const hasLupaClass = typeof elementClass.includes == "function" && elementClass.includes("lupa-search-box");
|
|
19916
20001
|
const isOutsideElement = el && !el.contains(e2.target) && !hasLupaClass;
|
|
20002
|
+
if (isOutsideElement && props.options.keepOpen) {
|
|
20003
|
+
focused.value = false;
|
|
20004
|
+
}
|
|
19917
20005
|
if (!isOutsideElement || props.options.keepOpen) {
|
|
19918
20006
|
return;
|
|
19919
20007
|
}
|
|
@@ -19922,11 +20010,12 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
19922
20010
|
};
|
|
19923
20011
|
const close = () => {
|
|
19924
20012
|
opened.value = false;
|
|
20013
|
+
focused.value = false;
|
|
19925
20014
|
suggestedValue.value = defaultSuggestedValue;
|
|
19926
20015
|
};
|
|
19927
20016
|
const handleKeyDown = (e2) => {
|
|
19928
20017
|
var _a2, _b;
|
|
19929
|
-
if (!
|
|
20018
|
+
if (!focused.value) {
|
|
19930
20019
|
return;
|
|
19931
20020
|
}
|
|
19932
20021
|
switch (e2.key) {
|
|
@@ -19946,6 +20035,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
19946
20035
|
const handleInput = (value) => {
|
|
19947
20036
|
var _a2;
|
|
19948
20037
|
opened.value = true;
|
|
20038
|
+
focused.value = true;
|
|
19949
20039
|
inputValue.value = (_a2 = value == null ? void 0 : value.replace(/\s+$/, "")) != null ? _a2 : "";
|
|
19950
20040
|
suggestedValue.value = defaultSuggestedValue;
|
|
19951
20041
|
searchBoxStore.resetHighlightIndex();
|
|
@@ -20073,12 +20163,14 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
20073
20163
|
}
|
|
20074
20164
|
});
|
|
20075
20165
|
};
|
|
20166
|
+
watch(() => props.options.debounce, handleCurrentValueSearch);
|
|
20076
20167
|
const resetValues = () => {
|
|
20077
20168
|
inputValue.value = "";
|
|
20078
20169
|
suggestedValue.value = defaultSuggestedValue;
|
|
20079
20170
|
};
|
|
20080
20171
|
const handleProductClick = () => {
|
|
20081
20172
|
opened.value = false;
|
|
20173
|
+
focused.value = false;
|
|
20082
20174
|
};
|
|
20083
20175
|
const slotProps = (props2) => {
|
|
20084
20176
|
return __spreadValues2({}, props2);
|
|
@@ -20095,15 +20187,17 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
20095
20187
|
ref_key: "searchBoxInput",
|
|
20096
20188
|
ref: searchBoxInput,
|
|
20097
20189
|
onInput: handleInput,
|
|
20098
|
-
|
|
20190
|
+
onBlur: _cache[0] || (_cache[0] = ($event) => focused.value = false),
|
|
20191
|
+
onFocus: _cache[1] || (_cache[1] = ($event) => opened.value = true),
|
|
20099
20192
|
onSearch: handleSearch,
|
|
20100
|
-
onClose: _cache[
|
|
20193
|
+
onClose: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("close"))
|
|
20101
20194
|
}, null, 8, ["options", "suggestedValue", "can-close", "emit-input-on-focus"]),
|
|
20102
20195
|
opened.value || _ctx.isSearchContainer ? (openBlock(), createBlock(_sfc_main$W, {
|
|
20103
20196
|
key: 0,
|
|
20104
20197
|
options: panelOptions.value,
|
|
20105
20198
|
inputValue: inputValue.value,
|
|
20106
20199
|
isSearchContainer: _ctx.isSearchContainer,
|
|
20200
|
+
focused: focused.value,
|
|
20107
20201
|
onFetched: handleItemsFetch,
|
|
20108
20202
|
onItemSelect: handleItemSelect,
|
|
20109
20203
|
onGoToResults: handleSearch,
|
|
@@ -20117,7 +20211,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
20117
20211
|
]),
|
|
20118
20212
|
key: "0"
|
|
20119
20213
|
} : void 0
|
|
20120
|
-
]), 1032, ["options", "inputValue", "isSearchContainer"])) : createCommentVNode("", true)
|
|
20214
|
+
]), 1032, ["options", "inputValue", "isSearchContainer", "focused"])) : createCommentVNode("", true)
|
|
20121
20215
|
])
|
|
20122
20216
|
]);
|
|
20123
20217
|
};
|