@depict-ai/ui 3.0.14 → 3.0.16

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.
@@ -7,7 +7,7 @@ import { createStore as $i7OB2$createStore, reconcile as $i7OB2$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.14";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "3.0.16";
11
11
  const $fbbadcb080ad1d4a$var$_tmpl$ = ["<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"></path></svg>'];
12
12
  function $fbbadcb080ad1d4a$export$8be2714ec7f169ee(props = {}) {
13
13
  return $i7OB2$ssr($fbbadcb080ad1d4a$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$ssrAttribute("width", $i7OB2$escape(props.width_, true) ?? 14, false) + $i7OB2$ssrAttribute("height", $i7OB2$escape(props.height_, true) ?? 26, false));
@@ -5489,7 +5489,11 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
5489
5489
  product_card_template_: product_card_template_,
5490
5490
  num_placeholders_: num_placeholders_
5491
5491
  }) : undefined);
5492
- const layout = $i7OB2$createMemo(() => layout_options_().layout || "grid");
5492
+ const layout = $i7OB2$createMemo(() => {
5493
+ const incoming_layout = layout_options_().layout;
5494
+ if (incoming_layout === "slider-without-filters") return "slider";
5495
+ return incoming_layout || "grid";
5496
+ });
5493
5497
  const [get_suspense_is_blocked, set_suspense_is_blocked] = $i7OB2$createSignal(false);
5494
5498
  const block_suspense_if_needed = () => {
5495
5499
  if (!is_just_after_plp_results_update) return;
@@ -5512,6 +5516,7 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
5512
5516
  }, {
5513
5517
  defer: true
5514
5518
  }));
5519
+ $i7OB2$createEffect(() => layout() !== "grid" && !doesnt_have_content_blocks() && $i7OB2$dwarn("Slider layout doesn't support content blocks"));
5515
5520
  /*
5516
5521
  This suspense ensures that if someone has async templates, we still show placeholders until the product cards actually have finished rendering (automagically since they're createResource's)
5517
5522
  We're creating it outside the <Show> so that we can benefit from <For>'s optimisation between changing results
@@ -5600,9 +5605,8 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
5600
5605
  } = slider;
5601
5606
  const Layout = props => $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, insert_here, true);
5602
5607
  // Do like this, so we don't have to call mergeProps ourselves
5603
- $i7OB2$createComponent(Layout, $i7OB2$mergeProps({
5604
- rows: "all"
5605
- }, layout_options_, {
5608
+ $i7OB2$createComponent(Layout, $i7OB2$mergeProps(layout_options_, {
5609
+ rows: "all",
5606
5610
  get cols_at_size() {
5607
5611
  return modified_cols_at_size();
5608
5612
  },
@@ -5888,6 +5892,7 @@ function $cdea4cf8c5c071ef$export$d7841e452f2e59a8({
5888
5892
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
5889
5893
  number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_,
5890
5894
  set_sort_and_filter_element_: set_sort_and_filter_element_,
5895
+ sort_and_filter_disabled_: sort_and_filter_disabled_,
5891
5896
  formatted_number_of_results_: formatted_number_of_results_,
5892
5897
  filter_button_width_: filter_button_width_,
5893
5898
  sort_button_width_: sort_button_width_,
@@ -6010,7 +6015,21 @@ function $cdea4cf8c5c071ef$export$d7841e452f2e59a8({
6010
6015
  })();
6011
6016
  get_extra_filters_button_?.(make_open_filters_button());
6012
6017
  get_extra_sorting_button_?.(make_open_sorting_button());
6013
- return $i7OB2$ssr($cdea4cf8c5c071ef$var$_tmpl$3, $i7OB2$ssrHydrationKey(), $i7OB2$escape(make_open_filters_button(true, true)), $i7OB2$escape(middle_elements_?.()), $i7OB2$escape(make_open_sorting_button(true, true)));
6018
+ $i7OB2$createEffect(() => {
6019
+ if (sort_and_filter_disabled_()) {
6020
+ // If someone changes the layout to slider-without-filters dynamically, close sorting and filters
6021
+ set_filters_open(false);
6022
+ set_sorting_open(false);
6023
+ }
6024
+ });
6025
+ return $i7OB2$createComponent((0, $i7OB2$Show), {
6026
+ get when() {
6027
+ return !sort_and_filter_disabled_();
6028
+ },
6029
+ get children() {
6030
+ return $i7OB2$ssr($cdea4cf8c5c071ef$var$_tmpl$3, $i7OB2$ssrHydrationKey(), $i7OB2$escape(make_open_filters_button(true, true)), $i7OB2$escape(middle_elements_?.()), $i7OB2$escape(make_open_sorting_button(true, true)));
6031
+ }
6032
+ });
6014
6033
  };
6015
6034
  return $i7OB2$createComponent((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
6016
6035
  message_: "Sorting and filters failed",
@@ -6903,7 +6922,9 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
6903
6922
  i18n_: i18n_
6904
6923
  });
6905
6924
  const [sort_and_filter_element_, set_sort_and_filter_element_] = $i7OB2$createSignal();
6925
+ // Sort and filter button
6906
6926
  const [results_filters, set_results_filters] = $i7OB2$createSignal();
6927
+ // Cloned, invisible sort and filter button used for measuring the minimum size of the buttons if using embedded_num_products
6907
6928
  const [observed_results_filters_elements, set_observed_results_filters_elements_] = $i7OB2$createSignal();
6908
6929
  const is_slim_ = $dc9262ef6f786812$export$d9f36cf74e24d595("(max-width:600px)");
6909
6930
  // @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
@@ -6972,6 +6993,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
6972
6993
  $i7OB2$report1(new Error("Unrecognised category_title_type, UI will look messed up"), "error");
6973
6994
  results_for = $i7OB2$ssr($df5d81d0fe61ff21$var$_tmpl$2, $i7OB2$ssrHydrationKey());
6974
6995
  }
6996
+ const sort_and_filter_disabled_ = $i7OB2$createMemo(() => layout_options_().layout === "slider-without-filters");
6975
6997
  const filters_opener = $cdea4cf8c5c071ef$export$d7841e452f2e59a8({
6976
6998
  set_sort_or_filter_open_: set_sort_or_filter_open_,
6977
6999
  set_extra_els_in_results_container_: set_desktop_filter_elements,
@@ -6989,6 +7011,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
6989
7011
  local_filter_cache_: local_filter_cache_,
6990
7012
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
6991
7013
  number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_,
7014
+ sort_and_filter_disabled_: sort_and_filter_disabled_,
6992
7015
  ...extra_sort_and_filter_args_
6993
7016
  });
6994
7017
  $i7OB2$catchify((0, $641bba2917fe862b$export$6e49da55e449af7c))({
@@ -7434,6 +7457,7 @@ function $961b5c64bef4662f$export$e2bf8ce7779e827e(props) {
7434
7457
  return newId;
7435
7458
  });
7436
7459
  $i7OB2$onCleanup(() => $d8dbf52fea1773e2$export$f50b88e2a00918b5(props.on_listing_query_change)());
7460
+ const is_grid = $i7OB2$createMemo(() => props.layout === "grid");
7437
7461
  const grid_spacing_override = $i7OB2$createMemo(() => {
7438
7462
  const {
7439
7463
  grid_spacing: grid_spacing
@@ -7480,9 +7504,10 @@ function $961b5c64bef4662f$export$e2bf8ce7779e827e(props) {
7480
7504
  return depict_category.listing_query.type;
7481
7505
  }),
7482
7506
  i18n_: i18n_,
7483
- show_quicklinks_: $i7OB2$createMemo(() => props.show_quicklinks ?? true),
7507
+ // default disable quicklinks and breadcrumbs for sliders
7508
+ show_quicklinks_: $i7OB2$createMemo(() => props.show_quicklinks ?? is_grid()),
7484
7509
  category_title_: category_title,
7485
- show_breadcrumbs_: $i7OB2$createMemo(() => props.show_breadcrumbs ?? true),
7510
+ show_breadcrumbs_: $i7OB2$createMemo(() => props.show_breadcrumbs ?? is_grid()),
7486
7511
  current_sorting_: current_sorting_,
7487
7512
  router_: router_,
7488
7513
  get_breadcrumb_accessor_: accessor => $i7OB2$createComputed(() => breadcrumb_signal_[1](accessor())),
@@ -7498,7 +7523,7 @@ function $961b5c64bef4662f$export$e2bf8ce7779e827e(props) {
7498
7523
  layout_options_: $i7OB2$createMemo(() => ({
7499
7524
  cols_at_size: $b5cccc8ee7d24677$export$6daf8749b65a1b77(props.cols_at_size),
7500
7525
  ...grid_spacing_override(),
7501
- layout: props.layout || "grid"
7526
+ layout: props.layout
7502
7527
  })),
7503
7528
  product_card_template_: product_card_template,
7504
7529
  sorting_query_param_: sorting_query_param_,