@getlupa/vue 0.17.6 → 0.17.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.
@@ -20683,6 +20683,10 @@ const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
20683
20683
  var _a2;
20684
20684
  return (_a2 = props.options.searchTriggers) != null ? _a2 : [];
20685
20685
  });
20686
+ const searchBoxCloseTriggers = vue.computed(() => {
20687
+ var _a2, _b;
20688
+ return (_b = (_a2 = props.options.searchBoxCloseTriggers) == null ? void 0 : _a2.map((selector) => document.querySelector(selector))) != null ? _b : [];
20689
+ });
20686
20690
  const goToResultsDebounced = debounce$1(paramsStore.goToResults, (_a = props.options.debounce) != null ? _a : 300);
20687
20691
  vue.onMounted(() => {
20688
20692
  var _a2, _b, _c;
@@ -20706,7 +20710,7 @@ const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
20706
20710
  unbindSearchTriggers(searchTriggers.value, handleCurrentValueSearch);
20707
20711
  });
20708
20712
  const handleMouseClick = (e2) => {
20709
- var _a2, _b, _c, _d;
20713
+ var _a2, _b, _c, _d, _e;
20710
20714
  const el = document.getElementById("lupa-search-box");
20711
20715
  const elementClass = (_b = (_a2 = e2.target) == null ? void 0 : _a2.className) != null ? _b : "";
20712
20716
  const hasLupaClass = typeof elementClass.includes == "function" && elementClass.includes("lupa-search-box");
@@ -20714,6 +20718,9 @@ const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
20714
20718
  if (openedAt.value && Date.now() - (openedAt == null ? void 0 : openedAt.value) < 500) {
20715
20719
  return;
20716
20720
  }
20721
+ if ((_c = searchBoxCloseTriggers.value) == null ? void 0 : _c.includes(e2.target)) {
20722
+ close();
20723
+ }
20717
20724
  if (isOutsideElement && props.options.keepOpen) {
20718
20725
  focused.value = false;
20719
20726
  }
@@ -20722,11 +20729,11 @@ const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
20722
20729
  }
20723
20730
  opened.value = false;
20724
20731
  suggestedValue.value = defaultSuggestedValue;
20725
- if ((_c = props.options.callbacks) == null ? void 0 : _c.onClosed) {
20726
- (_d = props.options.callbacks) == null ? void 0 : _d.onClosed();
20732
+ if ((_d = props.options.callbacks) == null ? void 0 : _d.onClosed) {
20733
+ (_e = props.options.callbacks) == null ? void 0 : _e.onClosed();
20727
20734
  }
20728
20735
  };
20729
- const close = () => {
20736
+ const close = (e2) => {
20730
20737
  var _a2, _b;
20731
20738
  opened.value = false;
20732
20739
  focused.value = false;
@@ -20681,6 +20681,10 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
20681
20681
  var _a2;
20682
20682
  return (_a2 = props.options.searchTriggers) != null ? _a2 : [];
20683
20683
  });
20684
+ const searchBoxCloseTriggers = computed(() => {
20685
+ var _a2, _b;
20686
+ return (_b = (_a2 = props.options.searchBoxCloseTriggers) == null ? void 0 : _a2.map((selector) => document.querySelector(selector))) != null ? _b : [];
20687
+ });
20684
20688
  const goToResultsDebounced = debounce$1(paramsStore.goToResults, (_a = props.options.debounce) != null ? _a : 300);
20685
20689
  onMounted(() => {
20686
20690
  var _a2, _b, _c;
@@ -20704,7 +20708,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
20704
20708
  unbindSearchTriggers(searchTriggers.value, handleCurrentValueSearch);
20705
20709
  });
20706
20710
  const handleMouseClick = (e2) => {
20707
- var _a2, _b, _c, _d;
20711
+ var _a2, _b, _c, _d, _e;
20708
20712
  const el = document.getElementById("lupa-search-box");
20709
20713
  const elementClass = (_b = (_a2 = e2.target) == null ? void 0 : _a2.className) != null ? _b : "";
20710
20714
  const hasLupaClass = typeof elementClass.includes == "function" && elementClass.includes("lupa-search-box");
@@ -20712,6 +20716,9 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
20712
20716
  if (openedAt.value && Date.now() - (openedAt == null ? void 0 : openedAt.value) < 500) {
20713
20717
  return;
20714
20718
  }
20719
+ if ((_c = searchBoxCloseTriggers.value) == null ? void 0 : _c.includes(e2.target)) {
20720
+ close();
20721
+ }
20715
20722
  if (isOutsideElement && props.options.keepOpen) {
20716
20723
  focused.value = false;
20717
20724
  }
@@ -20720,11 +20727,11 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
20720
20727
  }
20721
20728
  opened.value = false;
20722
20729
  suggestedValue.value = defaultSuggestedValue;
20723
- if ((_c = props.options.callbacks) == null ? void 0 : _c.onClosed) {
20724
- (_d = props.options.callbacks) == null ? void 0 : _d.onClosed();
20730
+ if ((_d = props.options.callbacks) == null ? void 0 : _d.onClosed) {
20731
+ (_e = props.options.callbacks) == null ? void 0 : _e.onClosed();
20725
20732
  }
20726
20733
  };
20727
- const close = () => {
20734
+ const close = (e2) => {
20728
20735
  var _a2, _b;
20729
20736
  opened.value = false;
20730
20737
  focused.value = false;
@@ -11,6 +11,7 @@ import { DataExtraction } from '../DataExtraction';
11
11
  export type SearchBoxOptions = SearchBoxPanelOptions & {
12
12
  inputSelector: string;
13
13
  searchTriggers?: string[];
14
+ searchBoxCloseTriggers?: string[];
14
15
  routingBehavior?: RoutingBehavior;
15
16
  dynamicData?: DynamicData;
16
17
  callbacks?: SearchBoxEventCallbacks;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/vue",
3
- "version": "0.17.6",
3
+ "version": "0.17.7",
4
4
  "main": "dist/lupaSearch.mjs",
5
5
  "module": "dist/lupaSearch.mjs",
6
6
  "types": "dist/src/index.d.ts",