@depict-ai/ui 4.10.18 → 4.10.20

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.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 = "4.10.18";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "4.10.20";
11
11
  function $dc9262ef6f786812$export$d9f36cf74e24d595(media_query) {
12
12
  const signal = $9HbP8$createSignal(false);
13
13
  $9HbP8$onCleanup($9HbP8$javascript_media_query(media_query, ({
@@ -2491,6 +2491,7 @@ async function $194bd6b8e4c59830$export$79b1565500412d9b(search_modal, modal_fn_
2491
2491
  const modal_els = $9HbP8$createRoot(dispose => {
2492
2492
  let closing_animation;
2493
2493
  let animation_started;
2494
+ let focus_target_after_close;
2494
2495
  dispose_and_remove = () => {
2495
2496
  const actually_close = () => {
2496
2497
  dispose();
@@ -2509,11 +2510,19 @@ async function $194bd6b8e4c59830$export$79b1565500412d9b(search_modal, modal_fn_
2509
2510
  activeElement?.blur?.();
2510
2511
  el.remove();
2511
2512
  });
2512
- if (should_restore_focus && element_focused_before_open?.isConnected) {
2513
+ const requested_focus_target = focus_target_after_close?.();
2514
+ if (should_restore_focus && (requested_focus_target?.isConnected || element_focused_before_open?.isConnected)) {
2513
2515
  restoring_focus = true;
2514
2516
  try {
2515
2517
  // preventScroll so this can't re-introduce the safari page-jump the blur() above works around
2516
- element_focused_before_open.focus({
2518
+ let focused = false;
2519
+ if (requested_focus_target?.isConnected) {
2520
+ requested_focus_target.focus({
2521
+ preventScroll: true
2522
+ });
2523
+ focused = requested_focus_target.getRootNode().activeElement === requested_focus_target;
2524
+ }
2525
+ if (!focused && element_focused_before_open?.isConnected) element_focused_before_open.focus({
2517
2526
  preventScroll: true
2518
2527
  });
2519
2528
  } finally {
@@ -2534,7 +2543,8 @@ async function $194bd6b8e4c59830$export$79b1565500412d9b(search_modal, modal_fn_
2534
2543
  ...extra_options_for_modal,
2535
2544
  close_modal_: close_modal_,
2536
2545
  open_modal_: open_modal_,
2537
- register_closing_animation_: animation => closing_animation = animation
2546
+ register_closing_animation_: animation => closing_animation = animation,
2547
+ set_focus_target_after_close_: get_target => focus_target_after_close = get_target
2538
2548
  });
2539
2549
  });
2540
2550
  body.append(...modal_els);
@@ -7714,7 +7724,8 @@ async function $e422ea9eccb7892b$export$5d2f6cd705125cd3() {
7714
7724
  return hlsModule;
7715
7725
  }
7716
7726
  var $f916989c4b1be9f7$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<video class=d-standard-content>`),
7717
- $f916989c4b1be9f7$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<span class=d-standard-content-text>`);
7727
+ $f916989c4b1be9f7$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<div class=d-standard-content-text-group><span class=d-standard-content-text></span><span class=d-standard-content-cta>`),
7728
+ $f916989c4b1be9f7$var$_tmpl$3 = /*#__PURE__*/$9HbP8$template(`<span class=d-standard-content-text>`);
7718
7729
  function $f916989c4b1be9f7$export$780a853d15174484({
7719
7730
  link_: link_,
7720
7731
  type_: type_,
@@ -7724,7 +7735,8 @@ function $f916989c4b1be9f7$export$780a853d15174484({
7724
7735
  aspectRatioWhenAloneInRow_: aspectRatioWhenAloneInRow_,
7725
7736
  imageResizer_: imageResizer_,
7726
7737
  text_: text_,
7727
- textPosition_: textPosition_
7738
+ textPosition_: textPosition_,
7739
+ cta_: cta_
7728
7740
  }) {
7729
7741
  let wroteAspectRatioToContainer = false; // Only write this once so we don't get into a aspect ratio changed -> size changed -> image source changed -> aspect ratio slightly changed infinite loop
7730
7742
  const [wrapperSize, setWrapperSize] = $9HbP8$createSignal();
@@ -7825,15 +7837,44 @@ function $f916989c4b1be9f7$export$780a853d15174484({
7825
7837
  }), $9HbP8$createComponent((0, $9HbP8$Show), {
7826
7838
  when: text_,
7827
7839
  get children() {
7828
- var _el$2 = $9HbP8$getNextElement($f916989c4b1be9f7$var$_tmpl$2);
7829
- $9HbP8$setAttribute(_el$2, "data-position", textPosition_ || "bottom-center");
7830
- $9HbP8$insert(_el$2, text_);
7831
- return _el$2;
7840
+ return $9HbP8$createComponent((0, $9HbP8$Show), {
7841
+ when: cta_,
7842
+ get fallback() {
7843
+ return (() => {
7844
+ var _el$5 = $9HbP8$getNextElement($f916989c4b1be9f7$var$_tmpl$3);
7845
+ $9HbP8$setAttribute(_el$5, "data-position", textPosition_ || "bottom-center");
7846
+ $9HbP8$insert(_el$5, text_);
7847
+ return _el$5;
7848
+ })();
7849
+ },
7850
+ get children() {
7851
+ var _el$2 = $9HbP8$getNextElement($f916989c4b1be9f7$var$_tmpl$2),
7852
+ _el$3 = _el$2.firstChild,
7853
+ _el$4 = _el$3.nextSibling;
7854
+ $9HbP8$setAttribute(_el$2, "data-position", textPosition_ || "bottom-center");
7855
+ $9HbP8$setAttribute(_el$3, "data-position", textPosition_ || "bottom-center");
7856
+ $9HbP8$insert(_el$3, text_);
7857
+ $9HbP8$setAttribute(_el$4, "data-position", textPosition_ || "bottom-center");
7858
+ $9HbP8$insert(_el$4, cta_);
7859
+ return _el$2;
7860
+ }
7861
+ });
7832
7862
  }
7833
7863
  })];
7834
7864
  }
7835
7865
  }));
7836
7866
  }
7867
+ const $486360b09f0d5729$export$af2c67164f68e9e9 = content => {
7868
+ const {
7869
+ link: link,
7870
+ type: type,
7871
+ url: url,
7872
+ text: text,
7873
+ text_position: text_position,
7874
+ cta: cta
7875
+ } = content;
7876
+ return JSON.stringify([link, type, url, text ?? null, text_position ?? null, cta ?? null]);
7877
+ };
7837
7878
  function $486360b09f0d5729$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_, products_request_loading_, imageResizer_) {
7838
7879
  let hasSeenContentBlock = false;
7839
7880
  const [historyContentBlocks, setHistoryContentBlocks] = history_content_blocks_;
@@ -7870,13 +7911,11 @@ function $486360b09f0d5729$export$7a92d995f1bf3592(history_content_blocks_, plp_
7870
7911
  type: type,
7871
7912
  url: url,
7872
7913
  text: text,
7873
- text_position: text_position
7914
+ text_position: text_position,
7915
+ cta: cta
7874
7916
  }
7875
7917
  } = row;
7876
- // Key the "content"-component by its rendered inputs, so we can reuse the component (and later downstream the block elements) if it's the same
7877
- // This makes the block not flicker when going backwards/forwards if the content is the same on both pages
7878
- // Also it lets us rewrite the blocks state in the history based on the block aspect ratio without infinite looping
7879
- const componentCacheKey = JSON.stringify([link, type, url, text ?? null, text_position ?? null]);
7918
+ const componentCacheKey = $486360b09f0d5729$export$af2c67164f68e9e9(row.content);
7880
7919
  // The aspect ratio depends only on the media, so its history key must stay the pre-text 3-element shape — widening it would orphan every ratio already persisted in history.state
7881
7920
  const mediaCacheKey = JSON.stringify([link, type, url]);
7882
7921
  let component = contentComponents.get(componentCacheKey);
@@ -7896,7 +7935,8 @@ function $486360b09f0d5729$export$7a92d995f1bf3592(history_content_blocks_, plp_
7896
7935
  })),
7897
7936
  imageResizer_: imageResizer_,
7898
7937
  text_: text,
7899
- textPosition_: text_position
7938
+ textPosition_: text_position,
7939
+ cta_: cta
7900
7940
  });
7901
7941
  contentComponents.set(componentCacheKey, component);
7902
7942
  }
@@ -10676,6 +10716,7 @@ var $5285d2814d0fac0c$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<button class=b
10676
10716
  $5285d2814d0fac0c$var$_tmpl$3 = /*#__PURE__*/$9HbP8$template(`<div class=spacer>`),
10677
10717
  $5285d2814d0fac0c$var$_tmpl$4 = /*#__PURE__*/$9HbP8$template(`<button class="submit major"type=button>`),
10678
10718
  $5285d2814d0fac0c$var$_tmpl$5 = /*#__PURE__*/$9HbP8$template(`<div><!$><!/><!$><!/><div class=field><!$><!/><input class=query tabindex=0 enterkeyhint=search><!$><!/></div><!$><!/><!$><!/>`);
10719
+ const $5285d2814d0fac0c$var$keys_not_opening_modal = new Set(["Tab", "Shift", "Control", "Alt", "AltGraph", "Meta", "CapsLock", "Escape", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "PageUp", "PageDown", "Home", "End", "Insert", "ContextMenu", "NumLock", "ScrollLock", "Pause", "PrintScreen"]);
10679
10720
  function $5285d2814d0fac0c$export$b94867ecbd698f21({
10680
10721
  search_field_value_: [searchFieldValue, setSearchFieldValue],
10681
10722
  input_field_ref_: input_field_ref_,
@@ -10853,7 +10894,7 @@ function $5285d2814d0fac0c$export$b94867ecbd698f21({
10853
10894
  get onKeyDown() {
10854
10895
  return $9HbP8$catchify1(e => {
10855
10896
  if (disabled_) {
10856
- if (e.key !== "Tab" && e.key !== "Shift")
10897
+ if (!$5285d2814d0fac0c$var$keys_not_opening_modal.has(e.key) && !/^F\d{1,2}$/.test(e.key))
10857
10898
  // alow tab-selecting the input field and then open the modal when the user start writing but also to move past the field with tab
10858
10899
  input_element.click();
10859
10900
  } else if (e.key === "Enter") {
@@ -10956,6 +10997,31 @@ function $512b994d501f412b$export$93d9bfd0c9c1a5b8(close_modal, search_query_url
10956
10997
  }
10957
10998
  })();
10958
10999
  }
11000
+ function $8b2ecf1919837863$export$9e9e2ae069cf2fe1({
11001
+ props_search_field_value_: props_search_field_value_,
11002
+ props_submit_query_: props_submit_query_,
11003
+ dont_sync_search_field_value_except_on_submit_: dont_sync_search_field_value_except_on_submit_,
11004
+ set_focus_target_after_close_: set_focus_target_after_close_,
11005
+ get_search_page_input_element_: get_search_page_input_element_
11006
+ }) {
11007
+ const search_field_value_ = dont_sync_search_field_value_except_on_submit_ ? $9HbP8$createSignal("") : props_search_field_value_;
11008
+ let submits_in_flight = 0;
11009
+ const submit_query_ = async (new_query = $9HbP8$untrack(search_field_value_[0])) => {
11010
+ submits_in_flight++;
11011
+ try {
11012
+ return await props_submit_query_(new_query, () => set_focus_target_after_close_(get_search_page_input_element_));
11013
+ } finally {
11014
+ submits_in_flight--;
11015
+ }
11016
+ };
11017
+ if (dont_sync_search_field_value_except_on_submit_) $9HbP8$createEffect($9HbP8$on(search_field_value_[0], value => submits_in_flight > 0 && props_search_field_value_[1](value), {
11018
+ defer: true
11019
+ }));
11020
+ return {
11021
+ search_field_value_: search_field_value_,
11022
+ submit_query_: submit_query_
11023
+ };
11024
+ }
10959
11025
  var $42912431795f188e$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class=discover-more><button class=major type=button>`),
10960
11026
  $42912431795f188e$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<b>`),
10961
11027
  $42912431795f188e$var$_tmpl$3 = /*#__PURE__*/$9HbP8$template(`<div class=depict-search-modal><div class=body role=search aria-label="Search modal with search field, query suggestions and result preview"><!$><!/><div id=depict-suggestions-and-result-preview class=padded><!$><!/><!$><!/><!$><!/></div><!$><!/></div><!$><!/>`),
@@ -10969,6 +11035,8 @@ function $42912431795f188e$var$RawClassicSearchModal({
10969
11035
  search_query_url_param_name_: search_query_url_param_name_,
10970
11036
  previous_searches_: previous_searches_,
10971
11037
  close_modal_: close_modal_,
11038
+ set_focus_target_after_close_: set_focus_target_after_close_,
11039
+ get_search_page_input_element_: get_search_page_input_element_,
10972
11040
  depict_api_: depict_api_,
10973
11041
  merchant_: merchant_,
10974
11042
  market_: market_,
@@ -10993,15 +11061,16 @@ function $42912431795f188e$var$RawClassicSearchModal({
10993
11061
  // As per feedback from stronger we sometimes want a modal with the search field value disconnected from the one in the rest of the UI, see https://depictaiworkspace.slack.com/archives/C02J16R9XEH/p1679065878487709.
10994
11062
  // This is desired for when the modal is opened from a UI element that visually does not look connected with the search page or current query
10995
11063
  // Basically the UI signals that the button that opens the modal starts a new search.
10996
- const search_field_value_ = dont_sync_search_field_value_except_on_submit_ ? $9HbP8$createSignal("") : props_search_field_value;
10997
- const propagate_search_field_value_back = dont_sync_search_field_value_except_on_submit_ ? () => props_search_field_value[1]($9HbP8$untrack(search_field_value_[0])) // Set actual search field value to the throwaway internal one before submitting
10998
- : undefined;
10999
- const submit_query_ = (...args) => {
11000
- // submit_query expects to read the current search field value which is why we have to write the current one to the signal before calling it
11001
- // It will write the old one back and then write the new one after submit
11002
- propagate_search_field_value_back?.();
11003
- return props_submit_query(...args);
11004
- };
11064
+ const {
11065
+ search_field_value_: search_field_value_,
11066
+ submit_query_: submit_query_
11067
+ } = $8b2ecf1919837863$export$9e9e2ae069cf2fe1({
11068
+ props_search_field_value_: props_search_field_value,
11069
+ props_submit_query_: props_submit_query,
11070
+ dont_sync_search_field_value_except_on_submit_: dont_sync_search_field_value_except_on_submit_,
11071
+ set_focus_target_after_close_: set_focus_target_after_close_,
11072
+ get_search_page_input_element_: get_search_page_input_element_
11073
+ });
11005
11074
  const [input_field, set_input_field] = $9HbP8$createSignal();
11006
11075
  const [get_search_field_value_] = search_field_value_;
11007
11076
  // Search field alignment unused in ClassicSearchModal since the search field spans the whole modal
@@ -11796,6 +11865,8 @@ function $500a16dd18ee5a71$var$RawSearchModalV2({
11796
11865
  search_query_url_param_name_: search_query_url_param_name_,
11797
11866
  previous_searches_: previous_searches_,
11798
11867
  close_modal_: close_modal_,
11868
+ set_focus_target_after_close_: set_focus_target_after_close_,
11869
+ get_search_page_input_element_: get_search_page_input_element_,
11799
11870
  alignmentSignals_: alignmentSignals_,
11800
11871
  depict_api_: depict_api_,
11801
11872
  merchant_: merchant_,
@@ -11826,15 +11897,16 @@ function $500a16dd18ee5a71$var$RawSearchModalV2({
11826
11897
  // As per feedback from stronger we sometimes want a modal with the search field value disconnected from the one in the rest of the UI, see https://depictaiworkspace.slack.com/archives/C02J16R9XEH/p1679065878487709.
11827
11898
  // This is desired for when the modal is opened from a UI element that visually does not look connected with the search page or current query
11828
11899
  // Basically the UI signals that the button that opens the modal starts a new search.
11829
- const search_field_value_ = dont_sync_search_field_value_except_on_submit_ ? $9HbP8$createSignal("") : props_search_field_value;
11830
- const propagate_search_field_value_back = dont_sync_search_field_value_except_on_submit_ ? () => props_search_field_value[1]($9HbP8$untrack(search_field_value_[0])) // Set actual search field value to the throwaway internal one before submitting
11831
- : undefined;
11832
- const submit_query_ = (...args) => {
11833
- // submit_query expects to read the current search field value which is why we have to write the current one to the signal before calling it
11834
- // It will write the old one back and then write the new one after submit
11835
- propagate_search_field_value_back?.();
11836
- return props_submit_query(...args);
11837
- };
11900
+ const {
11901
+ search_field_value_: search_field_value_,
11902
+ submit_query_: submit_query_
11903
+ } = $8b2ecf1919837863$export$9e9e2ae069cf2fe1({
11904
+ props_search_field_value_: props_search_field_value,
11905
+ props_submit_query_: props_submit_query,
11906
+ dont_sync_search_field_value_except_on_submit_: dont_sync_search_field_value_except_on_submit_,
11907
+ set_focus_target_after_close_: set_focus_target_after_close_,
11908
+ get_search_page_input_element_: get_search_page_input_element_
11909
+ });
11838
11910
  const [input_field, set_input_field] = $9HbP8$createSignal();
11839
11911
  const [searching_for_value_, set_searching_for_value_] = $9HbP8$createSignal();
11840
11912
  const [show_stale_content_results_, set_show_stale_content_results_] = $9HbP8$createSignal(false);
@@ -13965,11 +14037,12 @@ function $21f51c14cb3f586f$export$84bba84a7b837187(read_search_query) {
13965
14037
  async function $bfd908d13d90934c$export$e16630ecb9644a1c({
13966
14038
  on_submit_with_unchanged_value_: on_submit_with_unchanged_value_,
13967
14039
  search_param_name_: search_param_name_,
13968
- set_search_field_value_: set_search_field_value_,
14040
+ search_field_value_: search_field_value_,
13969
14041
  get_search_query_: get_search_query_,
13970
14042
  url_transformer_: url_transformer_,
13971
14043
  router_: router_,
13972
14044
  after_submit_: after_submit_,
14045
+ before_navigate_: before_navigate_,
13973
14046
  get_new_query: get_new_query
13974
14047
  }) {
13975
14048
  const new_search_query = get_new_query();
@@ -13977,21 +14050,89 @@ async function $bfd908d13d90934c$export$e16630ecb9644a1c({
13977
14050
  if (previous_query === new_search_query && new URLSearchParams(location.search).has(search_param_name_)) {
13978
14051
  // don't push a history entry / re-search if someone submits a search again
13979
14052
  // do close the modal though
14053
+ search_field_value_.settle_(new_search_query);
13980
14054
  on_submit_with_unchanged_value_?.();
13981
- return;
14055
+ return false;
13982
14056
  }
13983
- set_search_field_value_(previous_query); // restore the value to the previous query since this one goes to the new history entry
13984
14057
  const target_url = new URL(location.href);
13985
14058
  url_transformer_?.(target_url);
13986
14059
  target_url.searchParams.set(search_param_name_, new_search_query);
13987
- await router_.navigate_.go_to_({
13988
- new_url_: target_url,
13989
- is_replace_: false,
13990
- force_spa_navigation_: true
13991
- });
13992
- set_search_field_value_(new_search_query);
14060
+ const end_submit = search_field_value_.begin_submit_(new_search_query, previous_query);
14061
+ before_navigate_?.();
14062
+ let landed;
14063
+ try {
14064
+ await router_.navigate_.go_to_({
14065
+ new_url_: target_url,
14066
+ is_replace_: false,
14067
+ force_spa_navigation_: true
14068
+ });
14069
+ } finally {
14070
+ landed = end_submit();
14071
+ }
14072
+ if (!landed) return false;
13993
14073
  scrollTo(0, 0);
13994
14074
  after_submit_?.();
14075
+ return true;
14076
+ }
14077
+ function $a578366fad1bde47$export$d13a185c53aa5edf(persisted_, get_search_query_) {
14078
+ const [get_persisted, set_persisted] = persisted_;
14079
+ const [get_submitting, set_submitting] = $9HbP8$createSignal();
14080
+ const get_value = $9HbP8$createMemo(() => get_submitting() ?? get_persisted());
14081
+ const set_value = value => {
14082
+ const new_value = typeof value === "function" ? value($9HbP8$untrack(get_value)) : value;
14083
+ if ($9HbP8$untrack(get_submitting) === undefined) set_persisted(new_value);else set_submitting(new_value);
14084
+ return new_value;
14085
+ };
14086
+ let current_submit;
14087
+ const end_submit = landed => {
14088
+ current_submit.landed_ = landed;
14089
+ current_submit = undefined;
14090
+ $9HbP8$batch(() => {
14091
+ const submitting = $9HbP8$untrack(get_submitting);
14092
+ set_submitting(undefined);
14093
+ if (landed && submitting !== undefined) set_persisted(submitting);
14094
+ });
14095
+ };
14096
+ const abort_on_popstate = what_happened => {
14097
+ if (what_happened === "popstate" && current_submit) end_submit(false);
14098
+ };
14099
+ (0, $9HbP8$instant_exec_on_suspect_history_change).add(abort_on_popstate);
14100
+ $9HbP8$onCleanup(() => (0, $9HbP8$instant_exec_on_suspect_history_change).delete(abort_on_popstate));
14101
+ $9HbP8$createEffect($9HbP8$on(get_search_query_, query => {
14102
+ const token = current_submit;
14103
+ if (!token || query !== token.query_) return;
14104
+ queueMicrotask(() => {
14105
+ if (current_submit === token) end_submit(true);
14106
+ });
14107
+ }, {
14108
+ defer: true
14109
+ }));
14110
+ const begin_submit_ = (submitted_query, query_of_current_history_entry) => {
14111
+ const token = current_submit = {
14112
+ query_: submitted_query,
14113
+ landed_: false
14114
+ };
14115
+ $9HbP8$batch(() => {
14116
+ set_submitting(submitted_query);
14117
+ set_persisted(query_of_current_history_entry);
14118
+ });
14119
+ return () => {
14120
+ if (current_submit === token) end_submit(true);
14121
+ return token.landed_;
14122
+ };
14123
+ };
14124
+ const settle_ = query => {
14125
+ if (current_submit) return;
14126
+ $9HbP8$batch(() => {
14127
+ set_submitting(undefined);
14128
+ set_persisted(query);
14129
+ });
14130
+ };
14131
+ return {
14132
+ value_: [get_value, set_value],
14133
+ begin_submit_: begin_submit_,
14134
+ settle_: settle_
14135
+ };
13995
14136
  }
13996
14137
  function $d68658730065de95$export$181cceed5c91919e(callback, alsoRaF, passiveListener) {
13997
14138
  let aligned_this_microtask = false;
@@ -14695,6 +14836,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
14695
14836
  scroll_restoration_data_: scroll_restoration_data_,
14696
14837
  product_card_template_: product_card_template_,
14697
14838
  modalAlignmentSignalsRef_: modalAlignmentSignalsRef_,
14839
+ inputFieldRef_: inputFieldRef_,
14698
14840
  router_: router_,
14699
14841
  content_results_rows_: content_results_rows_,
14700
14842
  content_layout_options_: content_layout_options_,
@@ -14883,6 +15025,8 @@ function $7097477c78a89208$export$a54ec244c8863715({
14883
15025
  if (!search_field) break add_input_field;
14884
15026
  setModalBodyStyle({});
14885
15027
  modalAlignmentSignalsRef_?.(alignmentSignals_);
15028
+ inputFieldRef_?.(input_element);
15029
+ $9HbP8$onCleanup(() => inputFieldRef_?.(undefined));
14886
15030
  const [pollAlignment, setPollAlignment_] = $9HbP8$createSignal(false);
14887
15031
  const align_position = $9HbP8$catchify1((0, $b6d5529b253681aa$export$b3ad617e9036868))(alignmentSignals_, search_field, (0, $b6d5529b253681aa$export$3f238c96c45e6cc6) | (0, $b6d5529b253681aa$export$7895aadd1956b1c7) | (modalVersionUsed_ === 1 ? (0, $b6d5529b253681aa$export$902f8b4a7dae5d78) : (0, $b6d5529b253681aa$export$6060bc6bee850eb6) | (0, $b6d5529b253681aa$export$5097308c5200105a)), true, pollAlignment);
14888
15032
  div_with_field_class.addEventListener("click", $9HbP8$catchify1(e => {
@@ -15225,14 +15369,16 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
15225
15369
  set_search_content_results_rows((0, $49de9d31aeea1b5e$export$70ceae36059a1036));
15226
15370
  }; // do this every time after we have submitted a new query - otherwise there might already be a saved number of rows in the state
15227
15371
  const on_submit_with_unchanged_value_ = () => this.modal_open = false;
15228
- const [get_search_field_value_, set_search_field_value_] = state_.field_value;
15229
- const configured_submit_query_ = new_query => $bfd908d13d90934c$export$e16630ecb9644a1c({
15372
+ const search_field_value_ = $a578366fad1bde47$export$d13a185c53aa5edf(state_.field_value, get_search_query_);
15373
+ const [get_search_field_value_] = search_field_value_.value_;
15374
+ const configured_submit_query_ = (new_query, before_navigate_) => $bfd908d13d90934c$export$e16630ecb9644a1c({
15230
15375
  on_submit_with_unchanged_value_: on_submit_with_unchanged_value_,
15231
- set_search_field_value_: set_search_field_value_,
15376
+ search_field_value_: search_field_value_,
15232
15377
  get_search_query_: get_search_query_,
15233
15378
  search_param_name_: search_query_url_param_name_,
15234
15379
  after_submit_: after_submit_,
15235
- get_new_query: () => new_query || $9HbP8$untrack(get_search_field_value_),
15380
+ before_navigate_: before_navigate_,
15381
+ get_new_query: () => new_query ?? $9HbP8$untrack(get_search_field_value_),
15236
15382
  url_transformer_: url_transformer,
15237
15383
  router_: this.#router
15238
15384
  });
@@ -15251,6 +15397,7 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
15251
15397
  search_query_url_param_name_: search_query_url_param_name_,
15252
15398
  reset_history_state_: reset_history_state_,
15253
15399
  state_: state_,
15400
+ search_field_value_: search_field_value_.value_,
15254
15401
  router_: this.#router,
15255
15402
  url_transformer_: url_transformer,
15256
15403
  depict_api_: depict_api_,
@@ -15274,7 +15421,8 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
15274
15421
  $9HbP8$onCleanup(() => this.modal_open = false);
15275
15422
  return searchModalComponent(...args);
15276
15423
  }, {
15277
- search_field_value_: state_.field_value,
15424
+ search_field_value_: search_field_value_.value_,
15425
+ get_search_page_input_element_: () => $806c97b931758897$export$dde08b2dca8cc1ce.get(this)?.search_page_input_element_,
15278
15426
  get_search_query_: get_search_query_,
15279
15427
  search_query_url_param_name_: search_query_url_param_name_,
15280
15428
  previous_searches_: previous_searches,
@@ -15422,6 +15570,7 @@ function $806c97b931758897$export$f2dc7e4e4aa11abb(props) {
15422
15570
  const {
15423
15571
  state_: state_
15424
15572
  } = shared_properties;
15573
+ let registered_input_element;
15425
15574
  const grid_spacing_override = $9HbP8$createMemo(() => {
15426
15575
  const {
15427
15576
  grid_spacing: grid_spacing
@@ -15450,7 +15599,7 @@ function $806c97b931758897$export$f2dc7e4e4aa11abb(props) {
15450
15599
  min_products_to_fetch_: $806c97b931758897$var$min_products_to_fetch_,
15451
15600
  local_filter_cache_: state_.local_filter_cache,
15452
15601
  content_search_enabled_: () => depict_search.enable_content_search ?? $806c97b931758897$var$content_search_default,
15453
- search_field_value_: state_.field_value,
15602
+ search_field_value_: shared_properties.search_field_value_,
15454
15603
  get_search_query_: shared_properties.get_search_query_,
15455
15604
  clear_filters_on_next_submit_: shared_properties.clear_filters_on_next_submit_,
15456
15605
  open_modal_: (...args) => depict_search.modal_open = args,
@@ -15458,6 +15607,16 @@ function $806c97b931758897$export$f2dc7e4e4aa11abb(props) {
15458
15607
  modalVersionUsed_: shared_properties.modalVersionUsed_,
15459
15608
  showSliderArrow_: () => props.showSliderArrow_,
15460
15609
  i18n_: shared_properties.i18n_,
15610
+ inputFieldRef_: input_element => {
15611
+ const shared_info_right_now = $806c97b931758897$export$dde08b2dca8cc1ce.get(depict_search);
15612
+ if (!shared_info_right_now) return;
15613
+ if (input_element === undefined && shared_info_right_now.search_page_input_element_ !== registered_input_element) return;
15614
+ registered_input_element = input_element;
15615
+ $806c97b931758897$export$dde08b2dca8cc1ce.set(depict_search, {
15616
+ ...shared_info_right_now,
15617
+ search_page_input_element_: input_element
15618
+ });
15619
+ },
15461
15620
  modalAlignmentSignalsRef_: style => {
15462
15621
  const shared_info_right_now = $806c97b931758897$export$dde08b2dca8cc1ce.get(depict_search);
15463
15622
  if (!shared_info_right_now) return;
@@ -15808,7 +15967,7 @@ function $58b3487626e85ece$export$316f6f283ae64765(props) {
15808
15967
  return shared_properties.BackIcon_;
15809
15968
  },
15810
15969
  get search_field_value_() {
15811
- return shared_properties.state_.field_value;
15970
+ return shared_properties.search_field_value_;
15812
15971
  },
15813
15972
  get submit_query_() {
15814
15973
  return shared_properties.configured_submit_query_;
@@ -15851,7 +16010,7 @@ function $58b3487626e85ece$export$316f6f283ae64765(props) {
15851
16010
  return shared_properties.BackIcon_;
15852
16011
  },
15853
16012
  get search_field_value_() {
15854
- return shared_properties.state_.field_value;
16013
+ return shared_properties.search_field_value_;
15855
16014
  },
15856
16015
  get submit_query_() {
15857
16016
  return shared_properties.configured_submit_query_;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/ui",
3
- "version": "4.10.18",
3
+ "version": "4.10.20",
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,9 +236,9 @@
236
236
  "@babel/plugin-transform-typescript": "^7.22.9",
237
237
  "@babel/runtime": "^7.22.6",
238
238
  "@babel/runtime-corejs3": "^7.22.6",
239
- "@depict-ai/plp-styling": "^4.6.10",
240
- "@depict-ai/types": "^5.6.8",
241
- "@depict-ai/utilishared": "^2.6.8",
239
+ "@depict-ai/plp-styling": "^4.6.12",
240
+ "@depict-ai/types": "^5.6.10",
241
+ "@depict-ai/utilishared": "^2.6.10",
242
242
  "solid-js": "^1.9.10"
243
243
  },
244
244
  "type": "module",