@depict-ai/ui 3.0.12 → 3.0.14

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.
package/latest/index.cjs CHANGED
@@ -77,7 +77,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
77
77
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
78
78
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
79
79
  /*! Depict.ai search and product listing SDK */
80
- const $b757f75811f3261f$export$83d89fbfd8236492 = "3.0.12";
80
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "3.0.14";
81
81
  const $0f313083912e447a$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0"fill=#0f0f0f>`);
82
82
  function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
83
83
  return (() => {
@@ -773,8 +773,8 @@ const $0b23bfd073d9a4e8$export$b91cec6bdc6b32a1 = /*@__PURE__*/(() => {
773
773
  const $a3280f0aad997933$export$c3834fa86c616831 = [[4], [3, 1024], [2, 901]];
774
774
  const $a3280f0aad997933$export$864d304a0bc46829 = "2%";
775
775
  const $a3280f0aad997933$export$7bf543b9d9be2c22 = (0, $0b23bfd073d9a4e8$export$b91cec6bdc6b32a1);
776
- function $fc23d7668ae0011d$export$a2cc176055f8f08() {
777
- const text = "Please try setting `columnsAtSize`/`gridSpacing` on the `SearchPage`/`CategoryPage` components to change the grid before setting it with CSS. If you do with CSS, set `columnsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
776
+ function $fc23d7668ae0011d$export$a2cc176055f8f08(what = "grid") {
777
+ const text = "Please try setting `columnsAtSize`/`gridSpacing` on the `SearchPage`/`CategoryPage` components to change the " + what + " before setting it with CSS. If you do with CSS, set `columnsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
778
778
  return (0, $gVhhF$solidjsweb.isServer) ? {
779
779
  t: `<!-- ${text} -->`
780
780
  } : document.createComment(text);
@@ -5881,25 +5881,28 @@ function $0f400c3f7248d5f1$export$92f2da32c6e7e7ee({
5881
5881
  price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
5882
5882
  });
5883
5883
  }
5884
- function $76b6ac05693f5c71$export$205efb947c7ffd78(handler, passive = true) {
5884
+ function $76b6ac05693f5c71$export$205efb947c7ffd78(handler, passive = true, override_element) {
5885
5885
  const catchified_handler = $gVhhF$depictaiutilishared.catchify(handler);
5886
5886
  const owner = $gVhhF$solidjs.getOwner();
5887
5887
  // Some customers (e.g. equestrian) have `height: 100%` and/or `overflow-x: hidden` on the body, which means that scroll events won't get dispatched on `window`. The pages who get it on <body> won't get it on `window` and vice-versa, so there shouldn't be a worry about duplicate calling of the handler.
5888
5888
  // Use observer in case that this gets called before body exists
5889
- const disconnect = (0, $gVhhF$depictaiutilishared.observer).onexists("body", ({
5890
- element: element
5891
- }) => {
5892
- element.addEventListener("scroll", catchified_handler, {
5893
- passive: passive
5889
+ if (!override_element) {
5890
+ const disconnect = (0, $gVhhF$depictaiutilishared.observer).onexists("body", ({
5891
+ element: element
5892
+ }) => {
5893
+ element.addEventListener("scroll", catchified_handler, {
5894
+ passive: passive
5895
+ });
5896
+ $gVhhF$solidjs.runWithOwner(owner, () => $gVhhF$solidjs.onCleanup(() => element.removeEventListener("scroll", catchified_handler)));
5894
5897
  });
5895
- $gVhhF$solidjs.runWithOwner(owner, () => $gVhhF$solidjs.onCleanup(() => element.removeEventListener("scroll", catchified_handler)));
5896
- });
5897
- $gVhhF$solidjs.onCleanup(disconnect);
5898
+ $gVhhF$solidjs.onCleanup(disconnect);
5899
+ }
5898
5900
  for (const event of ["resize", "orientationchange", "scroll"]) {
5899
- addEventListener(event, catchified_handler, {
5901
+ const listen_on = override_element ?? window;
5902
+ listen_on.addEventListener(event, catchified_handler, {
5900
5903
  passive: passive
5901
5904
  });
5902
- $gVhhF$solidjs.onCleanup(() => removeEventListener(event, catchified_handler));
5905
+ $gVhhF$solidjs.onCleanup(() => listen_on.removeEventListener(event, catchified_handler));
5903
5906
  }
5904
5907
  }
5905
5908
  const $401aee5f33dca9e2$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=scroll-status style=display:none><span class=text><b></b> \u{2013} <b></b> <!$><!/> <b>`);
@@ -5911,7 +5914,9 @@ function $401aee5f33dca9e2$export$83fd5de5504a7a67({
5911
5914
  i18n_: {
5912
5915
  price_formatting_: price_formatting_,
5913
5916
  of_: of_
5914
- }
5917
+ },
5918
+ get_scroll_position_ = () => scrollY,
5919
+ listen_to_scroll_on_: listen_to_scroll_on_
5915
5920
  }) {
5916
5921
  if (0, $gVhhF$solidjsweb.isServer) return; // won't show in initial render and need scroll position
5917
5922
  const [first_to_show, set_first_to_show] = $gVhhF$solidjs.createSignal(0);
@@ -5926,12 +5931,12 @@ function $401aee5f33dca9e2$export$83fd5de5504a7a67({
5926
5931
  let element;
5927
5932
  let animation;
5928
5933
  let last_pos_time = +new Date();
5929
- let last_pos = scrollY;
5934
+ let last_pos = get_scroll_position_();
5930
5935
  let unpermit_when_possible = false;
5931
5936
  let times_too_fast = 0;
5932
5937
  const handle_scrollpos_change = () => {
5933
5938
  if (animation) set_show_triggered(prev => !prev); // make sure that once we've decided to show the indicator it doesn't disappear before we stop scrolling
5934
- const distance_travelled = Math.abs(scrollY - last_pos);
5939
+ const distance_travelled = Math.abs(get_scroll_position_() - last_pos);
5935
5940
  const now = +new Date();
5936
5941
  const age_of_distance = now - last_pos_time;
5937
5942
  const velocity = distance_travelled / age_of_distance; // pixels per millisecond
@@ -5944,9 +5949,9 @@ function $401aee5f33dca9e2$export$83fd5de5504a7a67({
5944
5949
  unpermit_when_possible = false;
5945
5950
  } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
5946
5951
  last_pos_time = now;
5947
- last_pos = scrollY;
5952
+ last_pos = get_scroll_position_();
5948
5953
  };
5949
- $76b6ac05693f5c71$export$205efb947c7ffd78(handle_scrollpos_change);
5954
+ $76b6ac05693f5c71$export$205efb947c7ffd78(handle_scrollpos_change, undefined, listen_to_scroll_on_);
5950
5955
  $gVhhF$solidjs.createEffect(() => {
5951
5956
  show_triggered();
5952
5957
  const first = get_first_result_in_viewport();
@@ -6599,7 +6604,8 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
6599
6604
  product_card_template_: product_card_template_,
6600
6605
  layout_options_: layout_options_,
6601
6606
  id_currently_querying_for_: id_currently_querying_for_,
6602
- content_blocks_by_row_: content_blocks_by_row_
6607
+ content_blocks_by_row_: content_blocks_by_row_,
6608
+ ConfiguredScrollStatus: ConfiguredScrollStatus
6603
6609
  }) {
6604
6610
  // The plp_results_ resource will be delayed because we're using createBatchedMemo to not make triplicate API requests, but we need to show the placeholders before already to match Chrome and Firefox's "content has to be there, ready for scroll restoration, before all popstate tasks have been completed"-requirement
6605
6611
  const is_loading_ = $gVhhF$solidjs.createMemo(() => plp_results_.loading || query_base_.loading);
@@ -6667,6 +6673,7 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
6667
6673
  product_card_template_: product_card_template_,
6668
6674
  num_placeholders_: num_placeholders_
6669
6675
  }) : undefined);
6676
+ const layout = $gVhhF$solidjs.createMemo(() => layout_options_().layout || "grid");
6670
6677
  const [get_suspense_is_blocked, set_suspense_is_blocked] = $gVhhF$solidjs.createSignal(false);
6671
6678
  const block_suspense_if_needed = () => {
6672
6679
  if (!is_just_after_plp_results_update) return;
@@ -6738,7 +6745,7 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
6738
6745
  },
6739
6746
  children: product_cards_when_data
6740
6747
  });
6741
- return [$gVhhF$solidjsweb.memo((0, $fc23d7668ae0011d$export$a2cc176055f8f08)), $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
6748
+ return [$gVhhF$solidjsweb.memo(() => $fc23d7668ae0011d$export$a2cc176055f8f08(layout())), $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
6742
6749
  get when() {
6743
6750
  return doesnt_have_content_blocks();
6744
6751
  },
@@ -6761,22 +6768,79 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
6761
6768
  });
6762
6769
  },
6763
6770
  get children() {
6764
- return $gVhhF$solidjsweb.createComponent((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), {
6765
- get cols_at_size() {
6766
- return modified_cols_at_size();
6767
- },
6768
- get override_vertical_spacing() {
6769
- return layout_options_().override_vertical_spacing;
6770
- },
6771
- get grid_spacing() {
6772
- return layout_options_().grid_spacing;
6771
+ return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
6772
+ get when() {
6773
+ return layout() === "grid";
6773
6774
  },
6774
- rows: "all",
6775
- layout: "grid",
6776
- element_attributes: {
6777
- class: "cards"
6775
+ get fallback() {
6776
+ return $gVhhF$solidjsweb.createComponent((0, $a0e53f99354809d9$export$6649caad96ef8870), {
6777
+ arrow_height_: 25,
6778
+ arrow_width_: 12.5,
6779
+ disable_fading_: true,
6780
+ slider_ref_: slider => {
6781
+ const {
6782
+ insert_here: insert_here,
6783
+ container: container
6784
+ } = slider;
6785
+ const Layout = props => $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, insert_here, true);
6786
+ // Do like this, so we don't have to call mergeProps ourselves
6787
+ $gVhhF$solidjsweb.createComponent(Layout, $gVhhF$solidjsweb.mergeProps({
6788
+ rows: "all"
6789
+ }, layout_options_, {
6790
+ get cols_at_size() {
6791
+ return modified_cols_at_size();
6792
+ },
6793
+ get layout() {
6794
+ return layout();
6795
+ }
6796
+ }));
6797
+ insert_here.classList.add("generated-spacing");
6798
+ $gVhhF$solidjs.createEffect(
6799
+ // @ts-ignore
6800
+ $gVhhF$solidjs.on(query_base_, () => insert_here.scrollTo({
6801
+ left: 0,
6802
+ behavior: "instant"
6803
+ }), {
6804
+ defer: true
6805
+ })); // Scroll to the beginning if a filter or the query changes
6806
+ $gVhhF$depictaiutilishared.slider_fractional_factory(0, 0.75).constructor_plugin.call(slider, {}); // enable fractional scrolling
6807
+ if (ConfiguredScrollStatus) {
6808
+ // Put scroll status into slider container, so it's centered relatively to the products
6809
+ const rendered_scroll_status = ConfiguredScrollStatus({
6810
+ get_scroll_position_: () => insert_here.scrollLeft,
6811
+ listen_to_scroll_on_: insert_here
6812
+ });
6813
+ const {
6814
+ childNodes: childNodes
6815
+ } = container;
6816
+ // We have to use `insert` over Element.append, because ConfiguredScrollStatus is in an ErrorBoundary and therefore returns a function. `insert` will wipe all children, therefore save them first and then tell insert that the element should contain these elements + whatever ScrollStatus returns
6817
+ $gVhhF$solidjsweb.insert(container, $gVhhF$solidjs.createMemo(() => [...childNodes, rendered_scroll_status]));
6818
+ }
6819
+ },
6820
+ children: listing_contents
6821
+ });
6778
6822
  },
6779
- children: listing_contents
6823
+ get children() {
6824
+ return $gVhhF$solidjsweb.createComponent((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), {
6825
+ get cols_at_size() {
6826
+ return modified_cols_at_size();
6827
+ },
6828
+ get override_vertical_spacing() {
6829
+ return layout_options_().override_vertical_spacing;
6830
+ },
6831
+ get grid_spacing() {
6832
+ return layout_options_().grid_spacing;
6833
+ },
6834
+ rows: "all",
6835
+ get layout() {
6836
+ return layout();
6837
+ },
6838
+ element_attributes: {
6839
+ class: "cards"
6840
+ },
6841
+ children: listing_contents
6842
+ });
6843
+ }
6780
6844
  });
6781
6845
  }
6782
6846
  })];
@@ -8387,6 +8451,20 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
8387
8451
  // @ts-ignore - there's no type error here when writing the code, but parcel can't generate types that include the symbol, so we need to suppress the error that creates in our pipelines
8388
8452
  const category_title_type = category_title_[(0, $6b502b1b2155a0bc$export$5c28802497c8a83c)];
8389
8453
  const extra_sort_and_filter_args_ = {};
8454
+ const ConfiguredScrollStatus = (extraProps = {}) => $gVhhF$solidjsweb.createComponent((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
8455
+ severity_: "error",
8456
+ message_: "Scroll status failed",
8457
+ get children() {
8458
+ return $401aee5f33dca9e2$export$83fd5de5504a7a67({
8459
+ first_result_in_viewport_: first_result_in_viewport_,
8460
+ last_result_in_viewport_: last_result_in_viewport_,
8461
+ formatted_number_of_results_: formatted_number_of_results_,
8462
+ i18n_: i18n_,
8463
+ number_of_results_: $gVhhF$solidjs.createMemo(() => plp_products_()?.n_hits),
8464
+ ...extraProps
8465
+ });
8466
+ }
8467
+ });
8390
8468
  const make_product_count_ = () => (() => {
8391
8469
  const _el$ = $gVhhF$solidjsweb.getNextElement($840d88a04b2d22a7$var$_tmpl$),
8392
8470
  _el$3 = _el$.firstChild,
@@ -8605,6 +8683,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
8605
8683
  sort_or_filter_open_: sort_or_filter_open_,
8606
8684
  desktop_filter_elements_: desktop_filter_elements_,
8607
8685
  content_blocks_by_row_: content_blocks_by_row_,
8686
+ ConfiguredScrollStatus: ConfiguredScrollStatus,
8608
8687
  id_currently_querying_for_: id_to_query_for_,
8609
8688
  no_results_options_: {
8610
8689
  selected_filters_: selected_filters_,
@@ -8617,17 +8696,12 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
8617
8696
  });
8618
8697
  }
8619
8698
  }), _el$26, _co$10);
8620
- $gVhhF$solidjsweb.insert(_el$13, $gVhhF$solidjsweb.createComponent((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
8621
- severity_: "error",
8622
- message_: "Scroll status failed",
8699
+ $gVhhF$solidjsweb.insert(_el$13, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
8700
+ get when() {
8701
+ return layout_options_().layout === "grid";
8702
+ },
8623
8703
  get children() {
8624
- return $401aee5f33dca9e2$export$83fd5de5504a7a67({
8625
- first_result_in_viewport_: first_result_in_viewport_,
8626
- last_result_in_viewport_: last_result_in_viewport_,
8627
- formatted_number_of_results_: formatted_number_of_results_,
8628
- i18n_: i18n_,
8629
- number_of_results_: $gVhhF$solidjs.createMemo(() => plp_products_()?.n_hits)
8630
- });
8704
+ return $gVhhF$solidjsweb.createComponent(ConfiguredScrollStatus, {});
8631
8705
  }
8632
8706
  }), _el$28, _co$11);
8633
8707
  $gVhhF$solidjsweb.insert(_el$13, $gVhhF$solidjsweb.createComponent((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
@@ -9019,7 +9093,8 @@ function $48567ac5b39bac56$export$e2bf8ce7779e827e(props) {
9019
9093
  scroll_restoration_data_: scroll_restoration_data_,
9020
9094
  layout_options_: $gVhhF$solidjs.createMemo(() => ({
9021
9095
  cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77(props.cols_at_size),
9022
- ...grid_spacing_override()
9096
+ ...grid_spacing_override(),
9097
+ layout: props.layout || "grid"
9023
9098
  })),
9024
9099
  product_card_template_: product_card_template,
9025
9100
  sorting_query_param_: sorting_query_param_,
package/latest/index.d.ts CHANGED
@@ -10,7 +10,7 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
10
10
  import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
13
- export const version = "3.0.12";
13
+ export const version = "3.0.14";
14
14
  export type SDKColsAtSize = [number, number?][];
15
15
  /**
16
16
  * Transform SDK ColsAtSize into valid Layout ColsAtSize
@@ -182,6 +182,11 @@ export interface BaseCategoryPageConfig extends BaseProductListingConfig {
182
182
  * @default true
183
183
  */
184
184
  showQuicklinks?: boolean;
185
+ /**
186
+ * Whether to show the listing in a grid or a slider.
187
+ * @default "grid"
188
+ */
189
+ layout?: "grid" | "slider";
185
190
  }
186
191
  /**
187
192
  * The listing to query Depict for. `type` can be `"listingId"` or `"externalId"` and `id` is the actual id.
@@ -965,7 +970,8 @@ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay exte
965
970
  category_title: typeof CategoryTitle | typeof embedded_num_products;
966
971
  on_listing_query_change?: (new_listing_query?: ListingQuery | undefined, old_listing_query?: ListingQuery | undefined) => void;
967
972
  content_blocks_by_row?: ContentBlocksByRow;
968
- }): import("@depict-ai/utilishared").Node_Array;
973
+ layout?: "slider" | "grid";
974
+ }): import("@depict-ai/utilishared/latest").Node_Array;
969
975
  export function BreadCrumbs<T extends Display>({
970
976
  depict_category
971
977
  }: {
@@ -1117,7 +1123,7 @@ type OpenModalParams<OriginalDisplay extends Display, OutputDisplay extends Mode
1117
1123
  * Open the modal with support for alignment.
1118
1124
  * @returns {void}
1119
1125
  */
1120
- export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends unknown>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
1126
+ export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends ModernDisplay>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
1121
1127
  export function open_search_with_shift_slash(open_search: VoidFunction): () => void;
1122
1128
  export interface PageReplacer {
1123
1129
  readonly render_: () => Node_Array;
package/latest/index.js CHANGED
@@ -7,7 +7,7 @@ import { createStore as $9HbP8$createStore, reconcile as $9HbP8$reconcile } from
7
7
  /*! Depict.ai search and product listing SDK */
8
8
  import { register_es_version } from "../multi_import_deduplicator.mjs";
9
9
  register_es_version("ui", "latest");
10
- const $ec291e0010116877$export$83d89fbfd8236492 = "3.0.12";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "3.0.14";
11
11
  const $fbbadcb080ad1d4a$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0"fill=#0f0f0f>`);
12
12
  function $fbbadcb080ad1d4a$export$8be2714ec7f169ee(props = {}) {
13
13
  return (() => {
@@ -703,8 +703,8 @@ const $e4615ecd1849548f$export$b91cec6bdc6b32a1 = /*@__PURE__*/(() => {
703
703
  const $4690a06c8489dcd0$export$c3834fa86c616831 = [[4], [3, 1024], [2, 901]];
704
704
  const $4690a06c8489dcd0$export$864d304a0bc46829 = "2%";
705
705
  const $4690a06c8489dcd0$export$7bf543b9d9be2c22 = (0, $e4615ecd1849548f$export$b91cec6bdc6b32a1);
706
- function $a458486f22b22f63$export$a2cc176055f8f08() {
707
- const text = "Please try setting `columnsAtSize`/`gridSpacing` on the `SearchPage`/`CategoryPage` components to change the grid before setting it with CSS. If you do with CSS, set `columnsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
706
+ function $a458486f22b22f63$export$a2cc176055f8f08(what = "grid") {
707
+ const text = "Please try setting `columnsAtSize`/`gridSpacing` on the `SearchPage`/`CategoryPage` components to change the " + what + " before setting it with CSS. If you do with CSS, set `columnsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
708
708
  return (0, $9HbP8$isServer) ? {
709
709
  t: `<!-- ${text} -->`
710
710
  } : document.createComment(text);
@@ -5811,25 +5811,28 @@ function $511cc0abd9a64ce8$export$92f2da32c6e7e7ee({
5811
5811
  price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
5812
5812
  });
5813
5813
  }
5814
- function $8f9120a1ca151e6a$export$205efb947c7ffd78(handler, passive = true) {
5814
+ function $8f9120a1ca151e6a$export$205efb947c7ffd78(handler, passive = true, override_element) {
5815
5815
  const catchified_handler = $9HbP8$catchify1(handler);
5816
5816
  const owner = $9HbP8$getOwner();
5817
5817
  // Some customers (e.g. equestrian) have `height: 100%` and/or `overflow-x: hidden` on the body, which means that scroll events won't get dispatched on `window`. The pages who get it on <body> won't get it on `window` and vice-versa, so there shouldn't be a worry about duplicate calling of the handler.
5818
5818
  // Use observer in case that this gets called before body exists
5819
- const disconnect = (0, $9HbP8$observer).onexists("body", ({
5820
- element: element
5821
- }) => {
5822
- element.addEventListener("scroll", catchified_handler, {
5823
- passive: passive
5819
+ if (!override_element) {
5820
+ const disconnect = (0, $9HbP8$observer).onexists("body", ({
5821
+ element: element
5822
+ }) => {
5823
+ element.addEventListener("scroll", catchified_handler, {
5824
+ passive: passive
5825
+ });
5826
+ $9HbP8$runWithOwner(owner, () => $9HbP8$onCleanup(() => element.removeEventListener("scroll", catchified_handler)));
5824
5827
  });
5825
- $9HbP8$runWithOwner(owner, () => $9HbP8$onCleanup(() => element.removeEventListener("scroll", catchified_handler)));
5826
- });
5827
- $9HbP8$onCleanup(disconnect);
5828
+ $9HbP8$onCleanup(disconnect);
5829
+ }
5828
5830
  for (const event of ["resize", "orientationchange", "scroll"]) {
5829
- addEventListener(event, catchified_handler, {
5831
+ const listen_on = override_element ?? window;
5832
+ listen_on.addEventListener(event, catchified_handler, {
5830
5833
  passive: passive
5831
5834
  });
5832
- $9HbP8$onCleanup(() => removeEventListener(event, catchified_handler));
5835
+ $9HbP8$onCleanup(() => listen_on.removeEventListener(event, catchified_handler));
5833
5836
  }
5834
5837
  }
5835
5838
  const $6db49ca163afa2c3$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class=scroll-status style=display:none><span class=text><b></b> \u{2013} <b></b> <!$><!/> <b>`);
@@ -5841,7 +5844,9 @@ function $6db49ca163afa2c3$export$83fd5de5504a7a67({
5841
5844
  i18n_: {
5842
5845
  price_formatting_: price_formatting_,
5843
5846
  of_: of_
5844
- }
5847
+ },
5848
+ get_scroll_position_ = () => scrollY,
5849
+ listen_to_scroll_on_: listen_to_scroll_on_
5845
5850
  }) {
5846
5851
  if (0, $9HbP8$isServer) return; // won't show in initial render and need scroll position
5847
5852
  const [first_to_show, set_first_to_show] = $9HbP8$createSignal(0);
@@ -5856,12 +5861,12 @@ function $6db49ca163afa2c3$export$83fd5de5504a7a67({
5856
5861
  let element;
5857
5862
  let animation;
5858
5863
  let last_pos_time = +new Date();
5859
- let last_pos = scrollY;
5864
+ let last_pos = get_scroll_position_();
5860
5865
  let unpermit_when_possible = false;
5861
5866
  let times_too_fast = 0;
5862
5867
  const handle_scrollpos_change = () => {
5863
5868
  if (animation) set_show_triggered(prev => !prev); // make sure that once we've decided to show the indicator it doesn't disappear before we stop scrolling
5864
- const distance_travelled = Math.abs(scrollY - last_pos);
5869
+ const distance_travelled = Math.abs(get_scroll_position_() - last_pos);
5865
5870
  const now = +new Date();
5866
5871
  const age_of_distance = now - last_pos_time;
5867
5872
  const velocity = distance_travelled / age_of_distance; // pixels per millisecond
@@ -5874,9 +5879,9 @@ function $6db49ca163afa2c3$export$83fd5de5504a7a67({
5874
5879
  unpermit_when_possible = false;
5875
5880
  } else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
5876
5881
  last_pos_time = now;
5877
- last_pos = scrollY;
5882
+ last_pos = get_scroll_position_();
5878
5883
  };
5879
- $8f9120a1ca151e6a$export$205efb947c7ffd78(handle_scrollpos_change);
5884
+ $8f9120a1ca151e6a$export$205efb947c7ffd78(handle_scrollpos_change, undefined, listen_to_scroll_on_);
5880
5885
  $9HbP8$createEffect(() => {
5881
5886
  show_triggered();
5882
5887
  const first = get_first_result_in_viewport();
@@ -6529,7 +6534,8 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
6529
6534
  product_card_template_: product_card_template_,
6530
6535
  layout_options_: layout_options_,
6531
6536
  id_currently_querying_for_: id_currently_querying_for_,
6532
- content_blocks_by_row_: content_blocks_by_row_
6537
+ content_blocks_by_row_: content_blocks_by_row_,
6538
+ ConfiguredScrollStatus: ConfiguredScrollStatus
6533
6539
  }) {
6534
6540
  // The plp_results_ resource will be delayed because we're using createBatchedMemo to not make triplicate API requests, but we need to show the placeholders before already to match Chrome and Firefox's "content has to be there, ready for scroll restoration, before all popstate tasks have been completed"-requirement
6535
6541
  const is_loading_ = $9HbP8$createMemo(() => plp_results_.loading || query_base_.loading);
@@ -6597,6 +6603,7 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
6597
6603
  product_card_template_: product_card_template_,
6598
6604
  num_placeholders_: num_placeholders_
6599
6605
  }) : undefined);
6606
+ const layout = $9HbP8$createMemo(() => layout_options_().layout || "grid");
6600
6607
  const [get_suspense_is_blocked, set_suspense_is_blocked] = $9HbP8$createSignal(false);
6601
6608
  const block_suspense_if_needed = () => {
6602
6609
  if (!is_just_after_plp_results_update) return;
@@ -6668,7 +6675,7 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
6668
6675
  },
6669
6676
  children: product_cards_when_data
6670
6677
  });
6671
- return [$9HbP8$memo((0, $a458486f22b22f63$export$a2cc176055f8f08)), $9HbP8$createComponent((0, $9HbP8$Show), {
6678
+ return [$9HbP8$memo(() => $a458486f22b22f63$export$a2cc176055f8f08(layout())), $9HbP8$createComponent((0, $9HbP8$Show), {
6672
6679
  get when() {
6673
6680
  return doesnt_have_content_blocks();
6674
6681
  },
@@ -6691,22 +6698,79 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
6691
6698
  });
6692
6699
  },
6693
6700
  get children() {
6694
- return $9HbP8$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), {
6695
- get cols_at_size() {
6696
- return modified_cols_at_size();
6697
- },
6698
- get override_vertical_spacing() {
6699
- return layout_options_().override_vertical_spacing;
6700
- },
6701
- get grid_spacing() {
6702
- return layout_options_().grid_spacing;
6701
+ return $9HbP8$createComponent((0, $9HbP8$Show), {
6702
+ get when() {
6703
+ return layout() === "grid";
6703
6704
  },
6704
- rows: "all",
6705
- layout: "grid",
6706
- element_attributes: {
6707
- class: "cards"
6705
+ get fallback() {
6706
+ return $9HbP8$createComponent((0, $f32e14878e75af51$export$6649caad96ef8870), {
6707
+ arrow_height_: 25,
6708
+ arrow_width_: 12.5,
6709
+ disable_fading_: true,
6710
+ slider_ref_: slider => {
6711
+ const {
6712
+ insert_here: insert_here,
6713
+ container: container
6714
+ } = slider;
6715
+ const Layout = props => $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, insert_here, true);
6716
+ // Do like this, so we don't have to call mergeProps ourselves
6717
+ $9HbP8$createComponent(Layout, $9HbP8$mergeProps({
6718
+ rows: "all"
6719
+ }, layout_options_, {
6720
+ get cols_at_size() {
6721
+ return modified_cols_at_size();
6722
+ },
6723
+ get layout() {
6724
+ return layout();
6725
+ }
6726
+ }));
6727
+ insert_here.classList.add("generated-spacing");
6728
+ $9HbP8$createEffect(
6729
+ // @ts-ignore
6730
+ $9HbP8$on(query_base_, () => insert_here.scrollTo({
6731
+ left: 0,
6732
+ behavior: "instant"
6733
+ }), {
6734
+ defer: true
6735
+ })); // Scroll to the beginning if a filter or the query changes
6736
+ $9HbP8$slider_fractional_factory(0, 0.75).constructor_plugin.call(slider, {}); // enable fractional scrolling
6737
+ if (ConfiguredScrollStatus) {
6738
+ // Put scroll status into slider container, so it's centered relatively to the products
6739
+ const rendered_scroll_status = ConfiguredScrollStatus({
6740
+ get_scroll_position_: () => insert_here.scrollLeft,
6741
+ listen_to_scroll_on_: insert_here
6742
+ });
6743
+ const {
6744
+ childNodes: childNodes
6745
+ } = container;
6746
+ // We have to use `insert` over Element.append, because ConfiguredScrollStatus is in an ErrorBoundary and therefore returns a function. `insert` will wipe all children, therefore save them first and then tell insert that the element should contain these elements + whatever ScrollStatus returns
6747
+ $9HbP8$insert(container, $9HbP8$createMemo(() => [...childNodes, rendered_scroll_status]));
6748
+ }
6749
+ },
6750
+ children: listing_contents
6751
+ });
6708
6752
  },
6709
- children: listing_contents
6753
+ get children() {
6754
+ return $9HbP8$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), {
6755
+ get cols_at_size() {
6756
+ return modified_cols_at_size();
6757
+ },
6758
+ get override_vertical_spacing() {
6759
+ return layout_options_().override_vertical_spacing;
6760
+ },
6761
+ get grid_spacing() {
6762
+ return layout_options_().grid_spacing;
6763
+ },
6764
+ rows: "all",
6765
+ get layout() {
6766
+ return layout();
6767
+ },
6768
+ element_attributes: {
6769
+ class: "cards"
6770
+ },
6771
+ children: listing_contents
6772
+ });
6773
+ }
6710
6774
  });
6711
6775
  }
6712
6776
  })];
@@ -8317,6 +8381,20 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
8317
8381
  // @ts-ignore - there's no type error here when writing the code, but parcel can't generate types that include the symbol, so we need to suppress the error that creates in our pipelines
8318
8382
  const category_title_type = category_title_[(0, $4fb3a1cf207a7d5c$export$5c28802497c8a83c)];
8319
8383
  const extra_sort_and_filter_args_ = {};
8384
+ const ConfiguredScrollStatus = (extraProps = {}) => $9HbP8$createComponent((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
8385
+ severity_: "error",
8386
+ message_: "Scroll status failed",
8387
+ get children() {
8388
+ return $6db49ca163afa2c3$export$83fd5de5504a7a67({
8389
+ first_result_in_viewport_: first_result_in_viewport_,
8390
+ last_result_in_viewport_: last_result_in_viewport_,
8391
+ formatted_number_of_results_: formatted_number_of_results_,
8392
+ i18n_: i18n_,
8393
+ number_of_results_: $9HbP8$createMemo(() => plp_products_()?.n_hits),
8394
+ ...extraProps
8395
+ });
8396
+ }
8397
+ });
8320
8398
  const make_product_count_ = () => (() => {
8321
8399
  const _el$ = $9HbP8$getNextElement($df5d81d0fe61ff21$var$_tmpl$),
8322
8400
  _el$3 = _el$.firstChild,
@@ -8535,6 +8613,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
8535
8613
  sort_or_filter_open_: sort_or_filter_open_,
8536
8614
  desktop_filter_elements_: desktop_filter_elements_,
8537
8615
  content_blocks_by_row_: content_blocks_by_row_,
8616
+ ConfiguredScrollStatus: ConfiguredScrollStatus,
8538
8617
  id_currently_querying_for_: id_to_query_for_,
8539
8618
  no_results_options_: {
8540
8619
  selected_filters_: selected_filters_,
@@ -8547,17 +8626,12 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
8547
8626
  });
8548
8627
  }
8549
8628
  }), _el$26, _co$10);
8550
- $9HbP8$insert(_el$13, $9HbP8$createComponent((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
8551
- severity_: "error",
8552
- message_: "Scroll status failed",
8629
+ $9HbP8$insert(_el$13, $9HbP8$createComponent((0, $9HbP8$Show), {
8630
+ get when() {
8631
+ return layout_options_().layout === "grid";
8632
+ },
8553
8633
  get children() {
8554
- return $6db49ca163afa2c3$export$83fd5de5504a7a67({
8555
- first_result_in_viewport_: first_result_in_viewport_,
8556
- last_result_in_viewport_: last_result_in_viewport_,
8557
- formatted_number_of_results_: formatted_number_of_results_,
8558
- i18n_: i18n_,
8559
- number_of_results_: $9HbP8$createMemo(() => plp_products_()?.n_hits)
8560
- });
8634
+ return $9HbP8$createComponent(ConfiguredScrollStatus, {});
8561
8635
  }
8562
8636
  }), _el$28, _co$11);
8563
8637
  $9HbP8$insert(_el$13, $9HbP8$createComponent((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
@@ -8949,7 +9023,8 @@ function $961b5c64bef4662f$export$e2bf8ce7779e827e(props) {
8949
9023
  scroll_restoration_data_: scroll_restoration_data_,
8950
9024
  layout_options_: $9HbP8$createMemo(() => ({
8951
9025
  cols_at_size: $b5cccc8ee7d24677$export$6daf8749b65a1b77(props.cols_at_size),
8952
- ...grid_spacing_override()
9026
+ ...grid_spacing_override(),
9027
+ layout: props.layout || "grid"
8953
9028
  })),
8954
9029
  product_card_template_: product_card_template,
8955
9030
  sorting_query_param_: sorting_query_param_,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/ui",
3
- "version": "3.0.12",
3
+ "version": "3.0.14",
4
4
  "description": "Base package containing the actual UI of Depict UI along with translations, with a not-simplified API. We recommend using @depict-ai/js-ui or @depict-ai/react-ui instead.",
5
5
  "packageManager": "yarn@3.2.2",
6
6
  "sass": "styles.scss",
@@ -236,7 +236,7 @@
236
236
  "@babel/plugin-transform-typescript": "^7.22.9",
237
237
  "@babel/runtime": "latest",
238
238
  "@babel/runtime-corejs3": "^7.22.6",
239
- "@depict-ai/plp-styling": "^2.0.2",
239
+ "@depict-ai/plp-styling": "^2.0.3",
240
240
  "@depict-ai/types": "^5.0.2",
241
241
  "@depict-ai/utilishared": "^2.0.6",
242
242
  "solid-js": "^1.8.1"