@getlupa/vue 0.20.2 → 0.20.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.
@@ -12963,7 +12963,7 @@ const useParamsStore = /* @__PURE__ */ defineStore("params", () => {
12963
12963
  const routing = (_b25 = optionsStore.boxRoutingBehavior) != null ? _b25 : "direct-link";
12964
12964
  redirectToResultsPage(
12965
12965
  searchResultsLink.value,
12966
- searchText,
12966
+ encodeParam(searchText),
12967
12967
  optionsStore.getQueryParamName,
12968
12968
  facet,
12969
12969
  routing
@@ -14134,12 +14134,18 @@ const _sfc_main$1r = /* @__PURE__ */ vue.defineComponent({
14134
14134
  var _a25, _b25;
14135
14135
  return `${suggestion.display}${(_a25 = suggestion.facet) == null ? void 0 : _a25.key}${(_b25 = suggestion.facet) == null ? void 0 : _b25.title}`;
14136
14136
  };
14137
+ const doesSuggestionHaveFacet = (suggestion) => {
14138
+ return suggestion.facet !== void 0 && suggestion.facet.key !== void 0;
14139
+ };
14137
14140
  vue.watch(highlightedItem, () => {
14138
14141
  var _a25;
14139
14142
  if (highlightedIndex.value < 0) {
14140
14143
  return;
14141
14144
  }
14142
- const selected = (_a25 = props.items[highlightedIndex.value]) != null ? _a25 : { suggestion: { suggestion: "" }, facet: void 0 };
14145
+ const selected = (_a25 = props.items[highlightedIndex.value]) != null ? _a25 : {
14146
+ suggestion: { suggestion: "" },
14147
+ facet: void 0
14148
+ };
14143
14149
  handleSelect({
14144
14150
  suggestion: selected.suggestion,
14145
14151
  facet: selected.facet,
@@ -14151,7 +14157,11 @@ const _sfc_main$1r = /* @__PURE__ */ vue.defineComponent({
14151
14157
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(items.value, (item, index) => {
14152
14158
  return vue.openBlock(), vue.createBlock(_sfc_main$1s, {
14153
14159
  key: getSuggestionKey(item),
14154
- class: vue.normalizeClass(["lupa-suggestion", index === highlightedIndex.value ? "lupa-suggestion-highlighted" : ""]),
14160
+ class: vue.normalizeClass([
14161
+ "lupa-suggestion",
14162
+ index === highlightedIndex.value ? "lupa-suggestion-highlighted" : "",
14163
+ doesSuggestionHaveFacet(item) ? "lupa-faceted-suggestion" : "lupa-plain-suggestion"
14164
+ ]),
14155
14165
  suggestion: item,
14156
14166
  highlight: highlight2.value,
14157
14167
  labels: _ctx.labels,
@@ -12961,7 +12961,7 @@ const useParamsStore = /* @__PURE__ */ defineStore("params", () => {
12961
12961
  const routing = (_b25 = optionsStore.boxRoutingBehavior) != null ? _b25 : "direct-link";
12962
12962
  redirectToResultsPage(
12963
12963
  searchResultsLink.value,
12964
- searchText,
12964
+ encodeParam(searchText),
12965
12965
  optionsStore.getQueryParamName,
12966
12966
  facet,
12967
12967
  routing
@@ -14132,12 +14132,18 @@ const _sfc_main$1r = /* @__PURE__ */ defineComponent({
14132
14132
  var _a25, _b25;
14133
14133
  return `${suggestion.display}${(_a25 = suggestion.facet) == null ? void 0 : _a25.key}${(_b25 = suggestion.facet) == null ? void 0 : _b25.title}`;
14134
14134
  };
14135
+ const doesSuggestionHaveFacet = (suggestion) => {
14136
+ return suggestion.facet !== void 0 && suggestion.facet.key !== void 0;
14137
+ };
14135
14138
  watch(highlightedItem, () => {
14136
14139
  var _a25;
14137
14140
  if (highlightedIndex.value < 0) {
14138
14141
  return;
14139
14142
  }
14140
- const selected = (_a25 = props.items[highlightedIndex.value]) != null ? _a25 : { suggestion: { suggestion: "" }, facet: void 0 };
14143
+ const selected = (_a25 = props.items[highlightedIndex.value]) != null ? _a25 : {
14144
+ suggestion: { suggestion: "" },
14145
+ facet: void 0
14146
+ };
14141
14147
  handleSelect({
14142
14148
  suggestion: selected.suggestion,
14143
14149
  facet: selected.facet,
@@ -14149,7 +14155,11 @@ const _sfc_main$1r = /* @__PURE__ */ defineComponent({
14149
14155
  (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
14150
14156
  return openBlock(), createBlock(_sfc_main$1s, {
14151
14157
  key: getSuggestionKey(item),
14152
- class: normalizeClass(["lupa-suggestion", index === highlightedIndex.value ? "lupa-suggestion-highlighted" : ""]),
14158
+ class: normalizeClass([
14159
+ "lupa-suggestion",
14160
+ index === highlightedIndex.value ? "lupa-suggestion-highlighted" : "",
14161
+ doesSuggestionHaveFacet(item) ? "lupa-faceted-suggestion" : "lupa-plain-suggestion"
14162
+ ]),
14153
14163
  suggestion: item,
14154
14164
  highlight: highlight2.value,
14155
14165
  labels: _ctx.labels,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/vue",
3
- "version": "0.20.2",
3
+ "version": "0.20.4",
4
4
  "main": "dist/lupaSearch.mjs",
5
5
  "module": "dist/lupaSearch.mjs",
6
6
  "types": "dist/src/index.d.ts",