@visitscotland/component-library 5.16.0 → 5.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.
@@ -33922,7 +33922,7 @@ async function eventSearch(e, n, t, a, r, s, o, i) {
33922
33922
  const l = useFederatedSearchStore();
33923
33923
  if (l.eventsApiError = !1, l.cludoError = !1, a === "events" || !a) {
33924
33924
  let c = `${e}?query=${n}`;
33925
- c = t > 1 ? `${c}&page=${t}` : c, c = s !== "" ? `${c}&startDate=${s}` : c, c = o !== "" ? `${c}&endDate=${o}` : c, c = i ? `${c}&sort=${i.key}` : c, c = a === "events" ? `${c}&pageSize=12` : `${c}&pageSize=6`, r.forEach((u) => {
33925
+ c = t > 1 ? `${c}&page=${t}` : c, c = s !== "" ? `${c}&startDate=${s}` : c, c = o !== "" ? `${c}&endDate=${o}` : c, c = i ? `${c}&sort=${i}` : c, c = a === "events" ? `${c}&pageSize=12` : `${c}&pageSize=6`, r.forEach((u) => {
33926
33926
  c += `&category=${u}`;
33927
33927
  });
33928
33928
  try {
@@ -33992,8 +33992,8 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
33992
33992
  return cludoAutocomplete(l.value, n.value);
33993
33993
  }
33994
33994
  function E(N) {
33995
- const O = new URL(window.location);
33996
- if (l.value ? O.searchParams.set("search-term", l.value) : O.searchParams.delete("search-term"), u.value ? O.searchParams.set("category", encodeURIComponent(u.value)) : O.searchParams.delete("category"), m.value.length > 0 ? O.searchParams.set("sub-category", encodeURIComponent(m.value.join(","))) : O.searchParams.delete("sub-category"), N ? (a.value = 1, O.searchParams.set("page", a.value.toString())) : a.value && a.value > 1 ? O.searchParams.set("page", a.value.toString()) : O.searchParams.delete("page"), v.value ? O.searchParams.set("start-date", v.value) : O.searchParams.delete("start-date"), b.value ? O.searchParams.set("end-date", b.value) : O.searchParams.delete("end-date"), k.value ? O.searchParams.set("sort-by", k.value.key) : O.searchParams.delete("sort-by"), !_.value)
33995
+ const O = new URL(window.location.href);
33996
+ if (l.value ? O.searchParams.set("search-term", l.value) : O.searchParams.delete("search-term"), u.value ? O.searchParams.set("category", encodeURIComponent(u.value)) : O.searchParams.delete("category"), m.value.length > 0 ? O.searchParams.set("sub-category", encodeURIComponent(m.value.join(","))) : O.searchParams.delete("sub-category"), N ? (a.value = 1, O.searchParams.set("page", a.value.toString())) : a.value && a.value > 1 ? O.searchParams.set("page", a.value.toString()) : O.searchParams.delete("page"), v.value ? O.searchParams.set("start-date", v.value) : O.searchParams.delete("start-date"), b.value ? O.searchParams.set("end-date", b.value) : O.searchParams.delete("end-date"), k.value ? O.searchParams.set("sort-by", k.value) : O.searchParams.delete("sort-by"), !_.value)
33997
33997
  window.history.pushState({}, "", O), S();
33998
33998
  else {
33999
33999
  const R = `./${C.value}/${O.search}`;
@@ -34113,12 +34113,12 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
34113
34113
  emits: ["filter-updated"],
34114
34114
  setup(e) {
34115
34115
  const n = e, t = ref(null);
34116
- function a(i) {
34117
- return typeof n.activeFilter == "string" ? n.activeFilter === i : n.activeFilter && typeof n.activeFilter == "object" ? n.activeFilter.includes(i) : !1;
34116
+ function a(l) {
34117
+ return typeof n.activeFilter == "string" ? n.activeFilter === l : n.activeFilter && typeof n.activeFilter == "object" ? n.activeFilter.includes(l) : !1;
34118
34118
  }
34119
- function r(i) {
34120
- var l, c;
34121
- i === "left" ? (l = t.value) == null || l.scrollBy(-200, 0) : i === "right" && ((c = t.value) == null || c.scrollBy(200, 0));
34119
+ function r(l) {
34120
+ var c, u;
34121
+ l === "left" ? (c = t.value) == null || c.scrollBy(-200, 0) : l === "right" && ((u = t.value) == null || u.scrollBy(200, 0));
34122
34122
  }
34123
34123
  function s() {
34124
34124
  return [
@@ -34126,18 +34126,60 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
34126
34126
  n.wrap ? "vs-fed-filter__scroll-rail--wrap" : ""
34127
34127
  ];
34128
34128
  }
34129
- const o = computed$1(() => [...n.filterCategories].sort((l, c) => {
34130
- const u = (l.Label || l.Key || "").toLowerCase(), d = (c.Label || c.Key || "").toLowerCase();
34131
- return u < d ? -1 : u > d ? 1 : 0;
34129
+ const o = computed$1(() => [...n.filterCategories].sort((c, u) => {
34130
+ const d = (c.Label || c.Key || "").toLowerCase(), m = (u.Label || u.Key || "").toLowerCase();
34131
+ return d < m ? -1 : d > m ? 1 : 0;
34132
34132
  }));
34133
- return (i, l) => (openBlock(), createElementBlock("div", _hoisted_1$3, [
34134
- i.$slots["fed-filter-header"] && i.$slots["fed-filter-header"]() ? (openBlock(), createBlock(VsBody, {
34133
+ function i(l) {
34134
+ let c;
34135
+ switch (l) {
34136
+ case "accommodation":
34137
+ c = "fa-regular fa-bed";
34138
+ break;
34139
+ case "active-adventure":
34140
+ c = "fa-kit fa-vs-landscape";
34141
+ break;
34142
+ case "city-break":
34143
+ c = "fa-regular fa-city";
34144
+ break;
34145
+ case "culture-history":
34146
+ c = "fa-regular fa-chess-rook";
34147
+ break;
34148
+ case "events":
34149
+ c = "fa-regular fa-calendar-range";
34150
+ break;
34151
+ case "family-friendly":
34152
+ c = "fa-regular fa-family";
34153
+ break;
34154
+ case "food-drink":
34155
+ c = "fa-regular fa-utensils";
34156
+ break;
34157
+ case "nature-outdoors":
34158
+ c = "fa-regular fa-leaf";
34159
+ break;
34160
+ case "tours":
34161
+ c = "fa-regular fa-binoculars";
34162
+ break;
34163
+ case "travel-information":
34164
+ c = "fa-regular fa-circle-info";
34165
+ break;
34166
+ case "wellness":
34167
+ c = "fa-regular fa-spa";
34168
+ break;
34169
+ default:
34170
+ c = null;
34171
+ break;
34172
+ }
34173
+ return c;
34174
+ }
34175
+ return (l, c) => (openBlock(), createElementBlock("div", _hoisted_1$3, [
34176
+ l.$slots["fed-filter-header"] && l.$slots["fed-filter-header"]() ? (openBlock(), createBlock(VsBody, {
34135
34177
  key: 0,
34136
34178
  class: "vs-fed-filter__header mb-025 ms-025",
34137
34179
  "data-test": "vs-fed-filter__header"
34138
34180
  }, {
34139
34181
  default: withCtx(() => [
34140
- renderSlot(i.$slots, "fed-filter-header")
34182
+ renderSlot(l.$slots, "fed-filter-header")
34141
34183
  ]),
34142
34184
  _: 3
34143
34185
  })) : createCommentVNode("", !0),
@@ -34149,7 +34191,7 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
34149
34191
  "icon-only": "",
34150
34192
  class: "vs-fed-filter__scroll-button me-050",
34151
34193
  "data-test": "vs-fed-filter__scroll-button--left",
34152
- onClick: l[0] || (l[0] = (c) => r("left")),
34194
+ onClick: c[0] || (c[0] = (u) => r("left")),
34153
34195
  "aria-label": n.scrollLeftText
34154
34196
  }, {
34155
34197
  default: withCtx(() => [
@@ -34163,17 +34205,17 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
34163
34205
  ref_key: "scrollRail",
34164
34206
  ref: t
34165
34207
  }, [
34166
- (openBlock(!0), createElementBlock(Fragment, null, renderList(o.value, (c, u) => (openBlock(), createBlock(VsButton, {
34167
- key: u,
34208
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(o.value, (u, d) => (openBlock(), createBlock(VsButton, {
34209
+ key: d,
34168
34210
  class: "vs-fed-filter__category-button",
34169
- "data-test": `vs-fed-filter__category-button--${c.id}`,
34170
- icon: n.variant === "primary" ? c.icon : null,
34171
- variant: a(c.Key) ? "primary" : "secondary",
34211
+ "data-test": `vs-fed-filter__category-button--${u.Key}`,
34212
+ icon: n.variant === "primary" ? i(u.Key) : null,
34213
+ variant: a(u.Key) ? "primary" : "secondary",
34172
34214
  size: n.variant === "secondary" ? "sm" : "md",
34173
- onClick: (d) => i.$emit("filter-updated", c)
34215
+ onClick: (m) => l.$emit("filter-updated", u)
34174
34216
  }, {
34175
34217
  default: withCtx(() => [
34176
- createTextVNode(toDisplayString(c.Label || c.Key), 1)
34218
+ createTextVNode(toDisplayString(u.Label || u.Key), 1)
34177
34219
  ]),
34178
34220
  _: 2
34179
34221
  }, 1032, ["data-test", "icon", "variant", "size", "onClick"]))), 128))
@@ -34185,7 +34227,7 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
34185
34227
  "icon-only": "",
34186
34228
  class: "vs-fed-filter__scroll-button ms-050",
34187
34229
  "data-test": "vs-fed-filter__scroll-button--right",
34188
- onClick: l[1] || (l[1] = (c) => r("right")),
34230
+ onClick: c[1] || (c[1] = (u) => r("right")),
34189
34231
  "aria-label": n.scrollRightText
34190
34232
  }, {
34191
34233
  default: withCtx(() => [
@@ -34300,7 +34342,7 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
34300
34342
  engineId: n.cludoEngineId
34301
34343
  }, t.isHomePage = n.isHomePage;
34302
34344
  const f = window.location.search, p = new URLSearchParams(f);
34303
- p.has("search-term") && (t.searchTerm = p.get("search-term")), p.has("category") && (t.selectedCategoryKey = decodeURIComponent(p.get("category"))), p.has("sub-category") && decodeURIComponent(p.get("sub-category")).split(",").forEach((_) => t.selectedSubCategoryKey.push(_)), (p.has("search-term") || p.has("category")) && t.getSearchResults();
34345
+ p.has("search-term") && (t.searchTerm = p.get("search-term")), p.has("category") && (t.selectedCategoryKey = decodeURIComponent(p.get("category"))), p.has("sub-category") && decodeURIComponent(p.get("sub-category")).split(",").forEach((_) => t.selectedSubCategoryKey.push(_)), p.has("category") && p.get("category") === "events" && p.has("sort-by") && (t.sortBy = p.get("sort-by")), p.has("start-date") && (t.startDate = p.get("start-date")), p.has("end-date") && (t.endDate = p.get("end-date")), (p.has("search-term") || p.has("category")) && t.getSearchResults();
34304
34346
  }), (f, p) => (openBlock(), createElementBlock("div", _hoisted_1$2, [
34305
34347
  createElementVNode("div", _hoisted_2$2, [
34306
34348
  createElementVNode("div", _hoisted_3$1, [
@@ -34383,7 +34425,7 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
34383
34425
  for: "vs-fed-search-sort__to-date",
34384
34426
  class: "vs-fed-search-sort__label",
34385
34427
  "data-test": "vs-fed-search-sort__to-date-label"
34386
- }, _sfc_main$1 = /* @__PURE__ */ defineComponent({
34428
+ }, _sfc_main$1 = {
34387
34429
  __name: "FedSearchSort",
34388
34430
  props: {
34389
34431
  /**
@@ -34425,44 +34467,42 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
34425
34467
  "end-date-updated",
34426
34468
  "sort-order-updated"
34427
34469
  ],
34428
- setup(e, { emit: n }) {
34429
- const t = ref(null), a = e, r = n;
34430
- function s(o) {
34431
- t.value = o, r("sort-order-updated", o);
34432
- }
34433
- return (o, i) => (openBlock(), createBlock(VsRow, { class: "vs-fed-search-sort" }, {
34470
+ setup(e) {
34471
+ const n = useFederatedSearchStore(), t = e, a = computed$1(() => t.sortOptions.find((r) => r.key === n.sortBy));
34472
+ return (r, s) => (openBlock(), createBlock(VsRow, { class: "vs-fed-search-sort" }, {
34434
34473
  default: withCtx(() => [
34435
- a.dateFilterVisible ? (openBlock(), createBlock(VsCol, {
34474
+ t.dateFilterVisible ? (openBlock(), createBlock(VsCol, {
34436
34475
  key: 0,
34437
34476
  cols: "6",
34438
34477
  md: "4"
34439
34478
  }, {
34440
34479
  default: withCtx(() => [
34441
- a.fromDateLabel ? (openBlock(), createElementBlock("label", _hoisted_1$1, toDisplayString(a.fromDateLabel), 1)) : createCommentVNode("", !0),
34480
+ t.fromDateLabel ? (openBlock(), createElementBlock("label", _hoisted_1$1, toDisplayString(t.fromDateLabel), 1)) : createCommentVNode("", !0),
34442
34481
  createVNode(VsInput, {
34443
34482
  "field-name": "vs-fed-search-sort__from-date",
34444
- value: (/* @__PURE__ */ new Date()).toJSON().slice(0, 10),
34483
+ value: unref(n).startDate || (/* @__PURE__ */ new Date()).toJSON().slice(0, 10),
34445
34484
  type: "date",
34446
34485
  "auto-complete": !1,
34447
- onInput: i[0] || (i[0] = (l) => o.$emit("from-date-updated", l.target.value)),
34486
+ onInput: s[0] || (s[0] = (o) => r.$emit("from-date-updated", o.target.value)),
34448
34487
  "data-chromatic": "ignore"
34449
34488
  }, null, 8, ["value"])
34450
34489
  ]),
34451
34490
  _: 1
34452
34491
  })) : createCommentVNode("", !0),
34453
- a.dateFilterVisible ? (openBlock(), createBlock(VsCol, {
34492
+ t.dateFilterVisible ? (openBlock(), createBlock(VsCol, {
34454
34493
  key: 1,
34455
34494
  cols: "6",
34456
34495
  md: "4"
34457
34496
  }, {
34458
34497
  default: withCtx(() => [
34459
- a.toDateLabel ? (openBlock(), createElementBlock("label", _hoisted_2$1, toDisplayString(a.toDateLabel), 1)) : createCommentVNode("", !0),
34498
+ t.toDateLabel ? (openBlock(), createElementBlock("label", _hoisted_2$1, toDisplayString(t.toDateLabel), 1)) : createCommentVNode("", !0),
34460
34499
  createVNode(VsInput, {
34461
34500
  "field-name": "vs-fed-search-sort__to-date",
34462
34501
  type: "date",
34463
34502
  "auto-complete": !1,
34464
- onInput: i[1] || (i[1] = (l) => o.$emit("end-date-updated", l.target.value))
34465
- })
34503
+ onInput: s[1] || (s[1] = (o) => r.$emit("end-date-updated", o.target.value)),
34504
+ value: unref(n).endDate || ""
34505
+ }, null, 8, ["value"])
34466
34506
  ]),
34467
34507
  _: 1
34468
34508
  })) : createCommentVNode("", !0),
@@ -34476,17 +34516,19 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
34476
34516
  variant: "secondary",
34477
34517
  id: "vs-fed-search-sort__dropdown",
34478
34518
  name: "vs-fed-search-sort__dropdown",
34479
- text: t.value === null ? a.sortLabel : `${a.sortLabel}: ${t.value.label}`
34519
+ text: unref(n).sortBy ? `${t.sortLabel}: ${a.value.label}` : t.sortLabel
34480
34520
  }, {
34481
34521
  default: withCtx(() => [
34482
- (openBlock(!0), createElementBlock(Fragment, null, renderList(e.sortOptions, (l, c) => (openBlock(), createBlock(VsDropdownItem, {
34483
- key: c,
34484
- onClick: (u) => s(l),
34485
- active: t.value === l,
34486
- "data-test": `vs-fed-search-sort__dropdown-item--${l.id}`
34522
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(e.sortOptions, (o, i) => (openBlock(), createBlock(VsDropdownItem, {
34523
+ key: i,
34524
+ onClick: (l) => {
34525
+ r.$emit("sort-order-updated", o.key);
34526
+ },
34527
+ active: unref(n).sortBy === o.key,
34528
+ "data-test": `vs-fed-search-sort__dropdown-item--${o.key}`
34487
34529
  }, {
34488
34530
  default: withCtx(() => [
34489
- createTextVNode(toDisplayString(l.label), 1)
34531
+ createTextVNode(toDisplayString(o.label), 1)
34490
34532
  ]),
34491
34533
  _: 2
34492
34534
  }, 1032, ["onClick", "active", "data-test"]))), 128))
@@ -34500,7 +34542,7 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
34500
34542
  _: 1
34501
34543
  }));
34502
34544
  }
34503
- }), _hoisted_1 = {
34545
+ }, _hoisted_1 = {
34504
34546
  class: "vs-federated-search",
34505
34547
  "data-test": "vs-federated-search"
34506
34548
  }, _hoisted_2 = { class: "vs-federated-search__container" }, _hoisted_3 = {
@@ -34713,7 +34755,10 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
34713
34755
  ])) : createCommentVNode("", !0),
34714
34756
  unref(n).isLoading ? (openBlock(), createBlock(unref(VsLoading), { key: 1 })) : createCommentVNode("", !0),
34715
34757
  !unref(n).isLoading && unref(n).results && !unref(n).eventsApiError ? (openBlock(), createElementBlock("div", _hoisted_4, [
34716
- createVNode(unref(VsCardGroup), { "cards-per-row": 3 }, {
34758
+ createVNode(unref(VsCardGroup), {
34759
+ "cards-per-row": 3,
34760
+ class: normalizeClass(unref(n).results && r.value <= 1 ? "mb-300" : null)
34761
+ }, {
34717
34762
  default: withCtx(() => [
34718
34763
  (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n).results, (g) => (openBlock(), createBlock(unref(VsCard), {
34719
34764
  key: g.id
@@ -34819,7 +34864,7 @@ const useFederatedSearchStore = defineStore("federatedSearch", () => {
34819
34864
  }, 1024))), 128))
34820
34865
  ]),
34821
34866
  _: 1
34822
- }),
34867
+ }, 8, ["class"]),
34823
34868
  unref(n).results && r.value > 1 ? (openBlock(), createBlock(unref(_sfc_main$E), {
34824
34869
  key: 0,
34825
34870
  class: "vs-federated-search__pagination",