@getlupa/vue 0.7.6 → 0.7.7

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.
@@ -2993,6 +2993,7 @@ const useSearchBoxStore = defineStore("searchBox", () => {
2993
2993
  const suggestionResults = vue.ref({});
2994
2994
  const highlightedIndex = vue.ref(-1);
2995
2995
  const inputValue = vue.ref("");
2996
+ const resultInputValue = vue.ref("");
2996
2997
  const historyStore = useHistoryStore();
2997
2998
  const resultsVisible = vue.computed(() => {
2998
2999
  var _a;
@@ -3005,13 +3006,15 @@ const useSearchBoxStore = defineStore("searchBox", () => {
3005
3006
  return {
3006
3007
  queryKey: p2.queryKey,
3007
3008
  count: (_b = (_a = suggestionResults.value[p2.queryKey]) == null ? void 0 : _a.length) != null ? _b : 0,
3008
- panel: p2
3009
+ panel: p2,
3010
+ input: resultInputValue.value
3009
3011
  };
3010
3012
  }
3011
3013
  return {
3012
3014
  queryKey: p2.queryKey,
3013
3015
  count: (_e = (_d = (_c = docResults.value[p2.queryKey]) == null ? void 0 : _c.items) == null ? void 0 : _d.length) != null ? _e : 0,
3014
- panel: p2
3016
+ panel: p2,
3017
+ input: resultInputValue.value
3015
3018
  };
3016
3019
  })
3017
3020
  );
@@ -3071,6 +3074,7 @@ const useSearchBoxStore = defineStore("searchBox", () => {
3071
3074
  [queryKey]: flattenSuggestions(result.items, (_a = publicQuery.searchText) != null ? _a : "")
3072
3075
  });
3073
3076
  inputValue.value = publicQuery.searchText;
3077
+ resultInputValue.value = publicQuery.searchText;
3074
3078
  emitSearchResultsCallback();
3075
3079
  return {
3076
3080
  suggestions: result.items
@@ -4697,6 +4701,10 @@ const _sfc_main$$ = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
4697
4701
  const expandOnSinglePanel = vue.computed(() => {
4698
4702
  return numberOfVisiblePanels.value === 1 && props.options.expandOnSinglePanel;
4699
4703
  });
4704
+ const showTopResultsPanelTitle = (queryKey) => {
4705
+ const panel = panelItemCounts.value.find((v) => v.queryKey === queryKey);
4706
+ return (panel == null ? void 0 : panel.count) > 0 && (panel == null ? void 0 : panel.input.length) < 1;
4707
+ };
4700
4708
  return (_ctx, _cache) => {
4701
4709
  var _a;
4702
4710
  return vue.openBlock(), vue.createElementBlock("div", {
@@ -4719,7 +4727,7 @@ const _sfc_main$$ = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
4719
4727
  ]),
4720
4728
  "data-cy": "lupa-panel-" + panel.type + "-index"
4721
4729
  }, [
4722
- _ctx.inputValue.length < 1 && ((_a2 = panel.labels) == null ? void 0 : _a2.topResultsTitle) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$w, vue.toDisplayString((_b = panel.labels) == null ? void 0 : _b.topResultsTitle), 1)) : vue.createCommentVNode("", true),
4730
+ ((_a2 = panel.labels) == null ? void 0 : _a2.topResultsTitle) && showTopResultsPanelTitle(panel.queryKey) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$w, vue.toDisplayString((_b = panel.labels) == null ? void 0 : _b.topResultsTitle), 1)) : vue.createCommentVNode("", true),
4723
4731
  panel.queryKey ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(getComponent(panel.type)), {
4724
4732
  key: 1,
4725
4733
  panel,
@@ -2991,6 +2991,7 @@ const useSearchBoxStore = defineStore("searchBox", () => {
2991
2991
  const suggestionResults = ref({});
2992
2992
  const highlightedIndex = ref(-1);
2993
2993
  const inputValue = ref("");
2994
+ const resultInputValue = ref("");
2994
2995
  const historyStore = useHistoryStore();
2995
2996
  const resultsVisible = computed(() => {
2996
2997
  var _a;
@@ -3003,13 +3004,15 @@ const useSearchBoxStore = defineStore("searchBox", () => {
3003
3004
  return {
3004
3005
  queryKey: p2.queryKey,
3005
3006
  count: (_b = (_a = suggestionResults.value[p2.queryKey]) == null ? void 0 : _a.length) != null ? _b : 0,
3006
- panel: p2
3007
+ panel: p2,
3008
+ input: resultInputValue.value
3007
3009
  };
3008
3010
  }
3009
3011
  return {
3010
3012
  queryKey: p2.queryKey,
3011
3013
  count: (_e = (_d = (_c = docResults.value[p2.queryKey]) == null ? void 0 : _c.items) == null ? void 0 : _d.length) != null ? _e : 0,
3012
- panel: p2
3014
+ panel: p2,
3015
+ input: resultInputValue.value
3013
3016
  };
3014
3017
  })
3015
3018
  );
@@ -3069,6 +3072,7 @@ const useSearchBoxStore = defineStore("searchBox", () => {
3069
3072
  [queryKey]: flattenSuggestions(result.items, (_a = publicQuery.searchText) != null ? _a : "")
3070
3073
  });
3071
3074
  inputValue.value = publicQuery.searchText;
3075
+ resultInputValue.value = publicQuery.searchText;
3072
3076
  emitSearchResultsCallback();
3073
3077
  return {
3074
3078
  suggestions: result.items
@@ -4695,6 +4699,10 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
4695
4699
  const expandOnSinglePanel = computed(() => {
4696
4700
  return numberOfVisiblePanels.value === 1 && props.options.expandOnSinglePanel;
4697
4701
  });
4702
+ const showTopResultsPanelTitle = (queryKey) => {
4703
+ const panel = panelItemCounts.value.find((v) => v.queryKey === queryKey);
4704
+ return (panel == null ? void 0 : panel.count) > 0 && (panel == null ? void 0 : panel.input.length) < 1;
4705
+ };
4698
4706
  return (_ctx, _cache) => {
4699
4707
  var _a;
4700
4708
  return openBlock(), createElementBlock("div", {
@@ -4717,7 +4725,7 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
4717
4725
  ]),
4718
4726
  "data-cy": "lupa-panel-" + panel.type + "-index"
4719
4727
  }, [
4720
- _ctx.inputValue.length < 1 && ((_a2 = panel.labels) == null ? void 0 : _a2.topResultsTitle) ? (openBlock(), createElementBlock("div", _hoisted_3$w, toDisplayString((_b = panel.labels) == null ? void 0 : _b.topResultsTitle), 1)) : createCommentVNode("", true),
4728
+ ((_a2 = panel.labels) == null ? void 0 : _a2.topResultsTitle) && showTopResultsPanelTitle(panel.queryKey) ? (openBlock(), createElementBlock("div", _hoisted_3$w, toDisplayString((_b = panel.labels) == null ? void 0 : _b.topResultsTitle), 1)) : createCommentVNode("", true),
4721
4729
  panel.queryKey ? (openBlock(), createBlock(resolveDynamicComponent(getComponent(panel.type)), {
4722
4730
  key: 1,
4723
4731
  panel,
@@ -14,10 +14,12 @@ export declare const useSearchBoxStore: import("pinia").StoreDefinition<"searchB
14
14
  queryKey: string;
15
15
  count: number;
16
16
  panel: import('../types/search-box/SearchBoxPanel').SuggestionSearchBoxPanel;
17
+ input: string;
17
18
  } | {
18
19
  queryKey: string;
19
20
  count: number;
20
21
  panel: import('../types/search-box/SearchBoxPanel').DocumentSearchBoxPanel;
22
+ input: string;
21
23
  })[]>;
22
24
  totalCount: import("vue").ComputedRef<number>;
23
25
  highlightedItem: import("vue").ComputedRef<{
@@ -82,10 +84,12 @@ export declare const useSearchBoxStore: import("pinia").StoreDefinition<"searchB
82
84
  queryKey: string;
83
85
  count: number;
84
86
  panel: import('../types/search-box/SearchBoxPanel').SuggestionSearchBoxPanel;
87
+ input: string;
85
88
  } | {
86
89
  queryKey: string;
87
90
  count: number;
88
91
  panel: import('../types/search-box/SearchBoxPanel').DocumentSearchBoxPanel;
92
+ input: string;
89
93
  })[]>;
90
94
  totalCount: import("vue").ComputedRef<number>;
91
95
  highlightedItem: import("vue").ComputedRef<{
@@ -150,10 +154,12 @@ export declare const useSearchBoxStore: import("pinia").StoreDefinition<"searchB
150
154
  queryKey: string;
151
155
  count: number;
152
156
  panel: import('../types/search-box/SearchBoxPanel').SuggestionSearchBoxPanel;
157
+ input: string;
153
158
  } | {
154
159
  queryKey: string;
155
160
  count: number;
156
161
  panel: import('../types/search-box/SearchBoxPanel').DocumentSearchBoxPanel;
162
+ input: string;
157
163
  })[]>;
158
164
  totalCount: import("vue").ComputedRef<number>;
159
165
  highlightedItem: import("vue").ComputedRef<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/vue",
3
- "version": "0.7.6",
3
+ "version": "0.7.7",
4
4
  "main": "dist/lupaSearch.mjs",
5
5
  "module": "dist/lupaSearch.mjs",
6
6
  "types": "dist/src/index.d.ts",