@getlupa/vue 0.16.0 → 0.16.2

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.
@@ -17791,6 +17791,7 @@ const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({
17791
17791
  }
17792
17792
  });
17793
17793
  const _hoisted_1$F = {
17794
+ key: 0,
17794
17795
  id: "lupa-search-result-filters",
17795
17796
  class: "lupa-search-result-filters"
17796
17797
  };
@@ -17815,6 +17816,10 @@ const _sfc_main$L = /* @__PURE__ */ vue.defineComponent({
17815
17816
  const showCurrentFilters = vue.computed(() => {
17816
17817
  return currentFiltersVisible.value ? Boolean(props.options.facets) : false;
17817
17818
  });
17819
+ const visible = vue.computed(() => {
17820
+ var _a;
17821
+ return (_a = props.options.visible) != null ? _a : true;
17822
+ });
17818
17823
  const filter2 = () => {
17819
17824
  emit("filter");
17820
17825
  };
@@ -17827,7 +17832,7 @@ const _sfc_main$L = /* @__PURE__ */ vue.defineComponent({
17827
17832
  __expose({ fetch: fetch2 });
17828
17833
  return (_ctx, _cache) => {
17829
17834
  var _a;
17830
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$F, [
17835
+ return visible.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$F, [
17831
17836
  showCurrentFilters.value ? (vue.openBlock(), vue.createBlock(_sfc_main$W, {
17832
17837
  key: 0,
17833
17838
  options: _ctx.options.currentFilters,
@@ -17844,7 +17849,7 @@ const _sfc_main$L = /* @__PURE__ */ vue.defineComponent({
17844
17849
  options: _ctx.options.facets,
17845
17850
  onFilter: filter2
17846
17851
  }, null, 8, ["options"])) : vue.createCommentVNode("", true)
17847
- ]);
17852
+ ])) : vue.createCommentVNode("", true);
17848
17853
  };
17849
17854
  }
17850
17855
  });
@@ -17954,6 +17959,7 @@ const _sfc_main$J = /* @__PURE__ */ vue.defineComponent({
17954
17959
  return (_ctx, _cache) => {
17955
17960
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$D, [
17956
17961
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(breadcrumbsValue.value, (breadcrumb, index) => {
17962
+ var _a;
17957
17963
  return vue.openBlock(), vue.createElementBlock("span", {
17958
17964
  class: "lupa-search-results-breadcrumb",
17959
17965
  key: index
@@ -17963,11 +17969,11 @@ const _sfc_main$J = /* @__PURE__ */ vue.defineComponent({
17963
17969
  class: "lupa-search-results-breadcrumb-link",
17964
17970
  href: breadcrumb.link,
17965
17971
  onClick: (e2) => {
17966
- var _a;
17967
- return handleNavigation(e2, (_a = breadcrumb == null ? void 0 : breadcrumb.link) != null ? _a : "");
17972
+ var _a2;
17973
+ return handleNavigation(e2, (_a2 = breadcrumb == null ? void 0 : breadcrumb.link) != null ? _a2 : "");
17968
17974
  }
17969
17975
  }, vue.toDisplayString(getLabel(breadcrumb.label)), 9, _hoisted_2$t)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$m, vue.toDisplayString(getLabel(breadcrumb.label)), 1)),
17970
- index < breadcrumbsValue.value.length - 1 ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4$f, " / ")) : vue.createCommentVNode("", true)
17976
+ index < breadcrumbsValue.value.length - 1 ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4$f, vue.toDisplayString((_a = breadcrumb.separator) != null ? _a : "/"), 1)) : vue.createCommentVNode("", true)
17971
17977
  ]);
17972
17978
  }), 128))
17973
17979
  ]);
@@ -17975,6 +17981,7 @@ const _sfc_main$J = /* @__PURE__ */ vue.defineComponent({
17975
17981
  }
17976
17982
  });
17977
17983
  const _hoisted_1$C = {
17984
+ key: 0,
17978
17985
  id: "lupa-search-result-filters",
17979
17986
  class: "lupa-search-result-filters lupa-search-result-top-filters"
17980
17987
  };
@@ -17985,12 +17992,17 @@ const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
17985
17992
  },
17986
17993
  emits: ["filter"],
17987
17994
  setup(__props, { emit }) {
17995
+ const props = __props;
17988
17996
  const filter2 = () => {
17989
17997
  emit("filter");
17990
17998
  };
17999
+ const visible = vue.computed(() => {
18000
+ var _a;
18001
+ return (_a = props.options.visible) != null ? _a : true;
18002
+ });
17991
18003
  return (_ctx, _cache) => {
17992
18004
  var _a;
17993
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$C, [
18005
+ return visible.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$C, [
17994
18006
  _ctx.options.facets ? (vue.openBlock(), vue.createBlock(_sfc_main$M, {
17995
18007
  key: 0,
17996
18008
  options: _ctx.options.facets,
@@ -17998,7 +18010,7 @@ const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
17998
18010
  clearable: true,
17999
18011
  onFilter: filter2
18000
18012
  }, null, 8, ["options", "facet-style"])) : vue.createCommentVNode("", true)
18001
- ]);
18013
+ ])) : vue.createCommentVNode("", true);
18002
18014
  };
18003
18015
  }
18004
18016
  });
@@ -18043,13 +18055,14 @@ const _hoisted_1$A = {
18043
18055
  const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
18044
18056
  __name: "SearchResultsMobileToggle",
18045
18057
  props: {
18046
- label: {},
18058
+ labels: {},
18047
18059
  showFilterCount: { type: Boolean }
18048
18060
  },
18049
18061
  setup(__props) {
18062
+ const props = __props;
18050
18063
  const searchResultStore = useSearchResultStore();
18051
18064
  const optionsStore = useOptionsStore();
18052
- const { currentFilterCount } = storeToRefs(searchResultStore);
18065
+ const { currentFilterCount, isMobileSidebarVisible } = storeToRefs(searchResultStore);
18053
18066
  const { searchResultOptions } = storeToRefs(optionsStore);
18054
18067
  const disableMobileBodyScrollLock = vue.computed(
18055
18068
  () => {
@@ -18057,9 +18070,22 @@ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
18057
18070
  return (_c = (_b = (_a = searchResultOptions.value.filters) == null ? void 0 : _a.facets) == null ? void 0 : _b.disableMobileBodyScrollLock) != null ? _c : false;
18058
18071
  }
18059
18072
  );
18073
+ const isSidebarVisible = vue.computed(() => isMobileSidebarVisible.value);
18074
+ const defaultLabel = vue.computed(() => props.labels.mobileFilterButton);
18075
+ const activeLabel = vue.computed(() => props.labels.mobileFilterButtonActive);
18076
+ const openLabel = vue.computed(() => props.labels.mobileFilterButtonOpen);
18077
+ const label = vue.computed(() => {
18078
+ if (isSidebarVisible.value) {
18079
+ return openLabel.value;
18080
+ }
18081
+ if (hasActiveFilters.value) {
18082
+ return activeLabel.value;
18083
+ }
18084
+ return defaultLabel.value;
18085
+ });
18060
18086
  const handleMobileToggle = () => {
18061
18087
  searchResultStore.setSidebarState({
18062
- visible: true,
18088
+ visible: !isSidebarVisible.value,
18063
18089
  disableBodyScrolling: !disableMobileBodyScrollLock.value
18064
18090
  });
18065
18091
  };
@@ -18068,11 +18094,12 @@ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
18068
18094
  return vue.openBlock(), vue.createElementBlock("div", {
18069
18095
  class: vue.normalizeClass(["lupa-mobile-toggle", {
18070
18096
  "lupa-mobile-toggle-filters-empty": vue.unref(currentFilterCount) < 1,
18071
- "lupa-mobile-toggle-has-filters": hasActiveFilters.value
18097
+ "lupa-mobile-toggle-has-filters": hasActiveFilters.value,
18098
+ "lupa-sidebar-open": isSidebarVisible.value
18072
18099
  }]),
18073
18100
  onClick: handleMobileToggle
18074
18101
  }, [
18075
- vue.createTextVNode(vue.toDisplayString(_ctx.label) + " ", 1),
18102
+ vue.createTextVNode(vue.toDisplayString(label.value) + " ", 1),
18076
18103
  _ctx.showFilterCount && vue.unref(currentFilterCount) > 0 ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$A, vue.toDisplayString(vue.unref(currentFilterCount)), 1)) : vue.createCommentVNode("", true)
18077
18104
  ], 2);
18078
18105
  };
@@ -18519,9 +18546,9 @@ const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
18519
18546
  vue.createElementVNode("div", _hoisted_6$5, [
18520
18547
  toolbarRightLabel.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$3, vue.toDisplayString(toolbarRightLabel.value), 1)) : vue.createCommentVNode("", true),
18521
18548
  vue.createVNode(_sfc_main$G, {
18522
- label: optionsValue.value.labels.mobileFilterButton,
18549
+ labels: optionsValue.value.labels,
18523
18550
  "show-filter-count": showMobileFilterCount.value
18524
- }, null, 8, ["label", "show-filter-count"]),
18551
+ }, null, 8, ["labels", "show-filter-count"]),
18525
18552
  paginationDisplay.value.pageSize ? (vue.openBlock(), vue.createBlock(_sfc_main$D, {
18526
18553
  key: 1,
18527
18554
  options: paginationOptions.value.pageSize,
@@ -17789,6 +17789,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
17789
17789
  }
17790
17790
  });
17791
17791
  const _hoisted_1$F = {
17792
+ key: 0,
17792
17793
  id: "lupa-search-result-filters",
17793
17794
  class: "lupa-search-result-filters"
17794
17795
  };
@@ -17813,6 +17814,10 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
17813
17814
  const showCurrentFilters = computed(() => {
17814
17815
  return currentFiltersVisible.value ? Boolean(props.options.facets) : false;
17815
17816
  });
17817
+ const visible = computed(() => {
17818
+ var _a;
17819
+ return (_a = props.options.visible) != null ? _a : true;
17820
+ });
17816
17821
  const filter2 = () => {
17817
17822
  emit("filter");
17818
17823
  };
@@ -17825,7 +17830,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
17825
17830
  __expose({ fetch: fetch2 });
17826
17831
  return (_ctx, _cache) => {
17827
17832
  var _a;
17828
- return openBlock(), createElementBlock("div", _hoisted_1$F, [
17833
+ return visible.value ? (openBlock(), createElementBlock("div", _hoisted_1$F, [
17829
17834
  showCurrentFilters.value ? (openBlock(), createBlock(_sfc_main$W, {
17830
17835
  key: 0,
17831
17836
  options: _ctx.options.currentFilters,
@@ -17842,7 +17847,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
17842
17847
  options: _ctx.options.facets,
17843
17848
  onFilter: filter2
17844
17849
  }, null, 8, ["options"])) : createCommentVNode("", true)
17845
- ]);
17850
+ ])) : createCommentVNode("", true);
17846
17851
  };
17847
17852
  }
17848
17853
  });
@@ -17952,6 +17957,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
17952
17957
  return (_ctx, _cache) => {
17953
17958
  return openBlock(), createElementBlock("div", _hoisted_1$D, [
17954
17959
  (openBlock(true), createElementBlock(Fragment, null, renderList(breadcrumbsValue.value, (breadcrumb, index) => {
17960
+ var _a;
17955
17961
  return openBlock(), createElementBlock("span", {
17956
17962
  class: "lupa-search-results-breadcrumb",
17957
17963
  key: index
@@ -17961,11 +17967,11 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
17961
17967
  class: "lupa-search-results-breadcrumb-link",
17962
17968
  href: breadcrumb.link,
17963
17969
  onClick: (e2) => {
17964
- var _a;
17965
- return handleNavigation(e2, (_a = breadcrumb == null ? void 0 : breadcrumb.link) != null ? _a : "");
17970
+ var _a2;
17971
+ return handleNavigation(e2, (_a2 = breadcrumb == null ? void 0 : breadcrumb.link) != null ? _a2 : "");
17966
17972
  }
17967
17973
  }, toDisplayString(getLabel(breadcrumb.label)), 9, _hoisted_2$t)) : (openBlock(), createElementBlock("span", _hoisted_3$m, toDisplayString(getLabel(breadcrumb.label)), 1)),
17968
- index < breadcrumbsValue.value.length - 1 ? (openBlock(), createElementBlock("span", _hoisted_4$f, " / ")) : createCommentVNode("", true)
17974
+ index < breadcrumbsValue.value.length - 1 ? (openBlock(), createElementBlock("span", _hoisted_4$f, toDisplayString((_a = breadcrumb.separator) != null ? _a : "/"), 1)) : createCommentVNode("", true)
17969
17975
  ]);
17970
17976
  }), 128))
17971
17977
  ]);
@@ -17973,6 +17979,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
17973
17979
  }
17974
17980
  });
17975
17981
  const _hoisted_1$C = {
17982
+ key: 0,
17976
17983
  id: "lupa-search-result-filters",
17977
17984
  class: "lupa-search-result-filters lupa-search-result-top-filters"
17978
17985
  };
@@ -17983,12 +17990,17 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
17983
17990
  },
17984
17991
  emits: ["filter"],
17985
17992
  setup(__props, { emit }) {
17993
+ const props = __props;
17986
17994
  const filter2 = () => {
17987
17995
  emit("filter");
17988
17996
  };
17997
+ const visible = computed(() => {
17998
+ var _a;
17999
+ return (_a = props.options.visible) != null ? _a : true;
18000
+ });
17989
18001
  return (_ctx, _cache) => {
17990
18002
  var _a;
17991
- return openBlock(), createElementBlock("div", _hoisted_1$C, [
18003
+ return visible.value ? (openBlock(), createElementBlock("div", _hoisted_1$C, [
17992
18004
  _ctx.options.facets ? (openBlock(), createBlock(_sfc_main$M, {
17993
18005
  key: 0,
17994
18006
  options: _ctx.options.facets,
@@ -17996,7 +18008,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
17996
18008
  clearable: true,
17997
18009
  onFilter: filter2
17998
18010
  }, null, 8, ["options", "facet-style"])) : createCommentVNode("", true)
17999
- ]);
18011
+ ])) : createCommentVNode("", true);
18000
18012
  };
18001
18013
  }
18002
18014
  });
@@ -18041,13 +18053,14 @@ const _hoisted_1$A = {
18041
18053
  const _sfc_main$G = /* @__PURE__ */ defineComponent({
18042
18054
  __name: "SearchResultsMobileToggle",
18043
18055
  props: {
18044
- label: {},
18056
+ labels: {},
18045
18057
  showFilterCount: { type: Boolean }
18046
18058
  },
18047
18059
  setup(__props) {
18060
+ const props = __props;
18048
18061
  const searchResultStore = useSearchResultStore();
18049
18062
  const optionsStore = useOptionsStore();
18050
- const { currentFilterCount } = storeToRefs(searchResultStore);
18063
+ const { currentFilterCount, isMobileSidebarVisible } = storeToRefs(searchResultStore);
18051
18064
  const { searchResultOptions } = storeToRefs(optionsStore);
18052
18065
  const disableMobileBodyScrollLock = computed(
18053
18066
  () => {
@@ -18055,9 +18068,22 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
18055
18068
  return (_c = (_b = (_a = searchResultOptions.value.filters) == null ? void 0 : _a.facets) == null ? void 0 : _b.disableMobileBodyScrollLock) != null ? _c : false;
18056
18069
  }
18057
18070
  );
18071
+ const isSidebarVisible = computed(() => isMobileSidebarVisible.value);
18072
+ const defaultLabel = computed(() => props.labels.mobileFilterButton);
18073
+ const activeLabel = computed(() => props.labels.mobileFilterButtonActive);
18074
+ const openLabel = computed(() => props.labels.mobileFilterButtonOpen);
18075
+ const label = computed(() => {
18076
+ if (isSidebarVisible.value) {
18077
+ return openLabel.value;
18078
+ }
18079
+ if (hasActiveFilters.value) {
18080
+ return activeLabel.value;
18081
+ }
18082
+ return defaultLabel.value;
18083
+ });
18058
18084
  const handleMobileToggle = () => {
18059
18085
  searchResultStore.setSidebarState({
18060
- visible: true,
18086
+ visible: !isSidebarVisible.value,
18061
18087
  disableBodyScrolling: !disableMobileBodyScrollLock.value
18062
18088
  });
18063
18089
  };
@@ -18066,11 +18092,12 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
18066
18092
  return openBlock(), createElementBlock("div", {
18067
18093
  class: normalizeClass(["lupa-mobile-toggle", {
18068
18094
  "lupa-mobile-toggle-filters-empty": unref(currentFilterCount) < 1,
18069
- "lupa-mobile-toggle-has-filters": hasActiveFilters.value
18095
+ "lupa-mobile-toggle-has-filters": hasActiveFilters.value,
18096
+ "lupa-sidebar-open": isSidebarVisible.value
18070
18097
  }]),
18071
18098
  onClick: handleMobileToggle
18072
18099
  }, [
18073
- createTextVNode(toDisplayString(_ctx.label) + " ", 1),
18100
+ createTextVNode(toDisplayString(label.value) + " ", 1),
18074
18101
  _ctx.showFilterCount && unref(currentFilterCount) > 0 ? (openBlock(), createElementBlock("span", _hoisted_1$A, toDisplayString(unref(currentFilterCount)), 1)) : createCommentVNode("", true)
18075
18102
  ], 2);
18076
18103
  };
@@ -18517,9 +18544,9 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
18517
18544
  createElementVNode("div", _hoisted_6$5, [
18518
18545
  toolbarRightLabel.value ? (openBlock(), createElementBlock("div", _hoisted_7$3, toDisplayString(toolbarRightLabel.value), 1)) : createCommentVNode("", true),
18519
18546
  createVNode(_sfc_main$G, {
18520
- label: optionsValue.value.labels.mobileFilterButton,
18547
+ labels: optionsValue.value.labels,
18521
18548
  "show-filter-count": showMobileFilterCount.value
18522
- }, null, 8, ["label", "show-filter-count"]),
18549
+ }, null, 8, ["labels", "show-filter-count"]),
18523
18550
  paginationDisplay.value.pageSize ? (openBlock(), createBlock(_sfc_main$D, {
18524
18551
  key: 1,
18525
18552
  options: paginationOptions.value.pageSize,
@@ -1,7 +1,8 @@
1
1
  import type { PropType as __PropType } from 'vue';
2
+ import { SearchResultsOptionLabels } from '../../../types/search-results/SearchResultsOptions';
2
3
  declare const _sfc_main: import("vue").DefineComponent<{
3
- label: {
4
- type: __PropType<string>;
4
+ labels: {
5
+ type: __PropType<SearchResultsOptionLabels>;
5
6
  required: true;
6
7
  };
7
8
  showFilterCount: {
@@ -9,8 +10,8 @@ declare const _sfc_main: import("vue").DefineComponent<{
9
10
  required: true;
10
11
  };
11
12
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
12
- label: {
13
- type: __PropType<string>;
13
+ labels: {
14
+ type: __PropType<SearchResultsOptionLabels>;
14
15
  required: true;
15
16
  };
16
17
  showFilterCount: {
@@ -74,6 +74,8 @@ export type SearchResultsOptionLabels = SearchResultsPaginationLabels & SearchRe
74
74
  itemCount: string;
75
75
  emptyResults: string;
76
76
  mobileFilterButton: string;
77
+ mobileFilterButtonActive: string;
78
+ mobileFilterButtonOpen: string;
77
79
  mobileFilterCloseButton: string;
78
80
  htmlTitleTemplate: string;
79
81
  outOfStock?: string;
@@ -222,6 +224,7 @@ export type ResultFacetOptions = {
222
224
  facetFilterQueries?: Record<string, FacetFilterQuery>;
223
225
  };
224
226
  export type SearchResultsFilterOptions = {
227
+ visible?: boolean;
225
228
  currentFilters?: ResultCurrentFilterOptions;
226
229
  facets?: ResultFacetOptions;
227
230
  categories?: CategoryFilterOptions;
@@ -229,6 +232,7 @@ export type SearchResultsFilterOptions = {
229
232
  export type SearchResultsBreadcrumb = {
230
233
  label: string;
231
234
  link?: string;
235
+ separator?: string;
232
236
  };
233
237
  export type DynamicData = {
234
238
  enabled?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/vue",
3
- "version": "0.16.0",
3
+ "version": "0.16.2",
4
4
  "main": "dist/lupaSearch.mjs",
5
5
  "module": "dist/lupaSearch.mjs",
6
6
  "types": "dist/src/index.d.ts",