@depict-ai/ui 4.3.14 → 4.4.1

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 = "4.3.14";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "4.4.1";
11
11
  const $b5cccc8ee7d24677$var$transform_elements = sorted_cols_at_size => {
12
12
  const cols_at_size = [];
13
13
  for (let i = 0; i < sorted_cols_at_size.length; i++) {
@@ -2798,10 +2798,11 @@ let $f86ba724282f6690$export$44dad306455dddf;
2798
2798
  DEPICT_ID["SEARCH_PAGE"] = "depict-search-page";
2799
2799
  DEPICT_ID["PLP_CATEGORY"] = "depict-plp-category";
2800
2800
  })($f86ba724282f6690$export$44dad306455dddf || ($f86ba724282f6690$export$44dad306455dddf = {}));
2801
- var $5285d2814d0fac0c$var$_tmpl$ = ["<button", ' class="back" type="button"', ">", "</button>"],
2802
- $5285d2814d0fac0c$var$_tmpl$2 = ["<div", ' class="search-field" role="search"><!--$-->', '<!--/--><div class="field"><input class="', '" tabindex="0"', '><button type="button" class="clear"', ' style="', '">', "</button></div>", "</div>"];
2801
+ var $5285d2814d0fac0c$var$_tmpl$ = ["<div", ' style="', '" class="spacer"></div>'],
2802
+ $5285d2814d0fac0c$var$_tmpl$2 = ["<button", ' class="submit major" type="button"', ">", "</button>"],
2803
+ $5285d2814d0fac0c$var$_tmpl$3 = ["<div", ' class="', '" role="search"><!--$-->', "<!--/--><!--$-->", '<!--/--><div class="field"><!--$-->', '<!--/--><input class="', '" tabindex="0"', "><!--$-->", "<!--/--></div><!--$-->", "<!--/--><!--$-->", "<!--/--></div>"];
2803
2804
  function $5285d2814d0fac0c$export$b94867ecbd698f21({
2804
- search_field_value_: search_field_value_,
2805
+ search_field_value_: [searchFieldValue, setSearchFieldValue],
2805
2806
  input_field_ref_: input_field_ref_,
2806
2807
  field_element_ref_: field_element_ref_,
2807
2808
  submit_query_: submit_query_,
@@ -2812,7 +2813,7 @@ function $5285d2814d0fac0c$export$b94867ecbd698f21({
2812
2813
  i18n_: i18n_,
2813
2814
  after_focusing_: after_focusing_,
2814
2815
  BackIcon_: BackIcon_,
2815
- submit_button_ref_: submit_button_ref_
2816
+ buttonInFieldRef_: buttonInFieldRef_
2816
2817
  }) {
2817
2818
  let input_element;
2818
2819
  // This is the div where we recommend (and ourselves do) attach the event listener to that opens the search modal.
@@ -2826,19 +2827,62 @@ function $5285d2814d0fac0c$export$b94867ecbd698f21({
2826
2827
  })); // focus field on render
2827
2828
  const owner_of_field_element = $i7OB2$getOwner();
2828
2829
  const isNewModal = BackIcon_[(0, $66db7a014e20802e$export$1ea76ea778b880dd)] === 2;
2829
- return $i7OB2$ssr($5285d2814d0fac0c$var$_tmpl$2, $i7OB2$ssrHydrationKey(), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Show), {
2830
+ const [backButtonWidthAccessor, setBackButtonWidthAccessor] = $i7OB2$createSignal();
2831
+ const getBackButtonWidth = () => backButtonWidthAccessor()?.();
2832
+ const searchFieldEmpty = $i7OB2$createMemo(() => !searchFieldValue());
2833
+ const BackButton = () => $i7OB2$createComponent((0, $i7OB2$Show), {
2830
2834
  when: on_back_,
2831
2835
  get children() {
2832
- return $i7OB2$ssr($5285d2814d0fac0c$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$ssrAttribute("aria-label", $i7OB2$escape(i18n_.back_(), true), false), $i7OB2$escape($i7OB2$createComponent(BackIcon_, {})));
2836
+ return $i7OB2$ssrElement("button", $i7OB2$mergeProps({
2837
+ "class": "back",
2838
+ type: "button",
2839
+ get ["aria-label"]() {
2840
+ return i18n_.back_();
2841
+ }
2842
+ }, isNewModal && {
2843
+ ref: el => {
2844
+ setBackButtonWidthAccessor(() => $2449872a62a75a20$export$ebdc3711f7e02ccd(el));
2845
+ $i7OB2$onCleanup(() => setBackButtonWidthAccessor());
2846
+ }
2847
+ }), () => isNewModal ? $i7OB2$escape($i7OB2$createComponent((0, $19976a74d273070d$export$3b621d86b1566b2), {})) : $i7OB2$escape($i7OB2$createComponent(BackIcon_, {})), true);
2833
2848
  }
2834
- })), `query ${!!on_back_ ? "has-adjacent-back-button" : ""}`, $i7OB2$ssrAttribute("aria-label", $i7OB2$escape(i18n_.search_field_field_aria_label_(), true), false) + $i7OB2$ssrAttribute("value", $i7OB2$escape(search_field_value_[0](), true), false) + $i7OB2$ssrAttribute("placeholder", $i7OB2$escape(i18n_.placeholder_text_(), true), false), $i7OB2$ssrAttribute("title", $i7OB2$escape(i18n_.clear_filters_query_sorting_after_submit_(), true), false), $i7OB2$ssrStyle($i7OB2$createMemo(() => search_field_value_[0]() ? "" : "display: none")()), $i7OB2$escape($i7OB2$createComponent((0, $19976a74d273070d$export$3b621d86b1566b2), {})), $i7OB2$ssrElement("button", $i7OB2$mergeProps({
2835
- "class": "submit major",
2836
- type: "button"
2837
- }, () => isNewModal ? {
2838
- tabindex: "-1"
2849
+ });
2850
+ const ClearButton = () => $i7OB2$ssrElement("button", $i7OB2$mergeProps({
2851
+ type: "button",
2852
+ get ["class"]() {
2853
+ return `clear ${searchFieldEmpty() ? "empty" : ""}`;
2854
+ },
2855
+ get style() {
2856
+ return isNewModal || !searchFieldEmpty() ? "" : "display: none";
2857
+ }
2858
+ }, () => searchFieldEmpty() ? {
2859
+ "aria-hidden": "true"
2839
2860
  } : {
2840
- "aria-label": i18n_.search_submit_button_aria_label_()
2841
- }), () => $i7OB2$escape($i7OB2$createComponent((0, $16f0ed5ea30d8d9c$export$82eafebb825fc23f), {})), false));
2861
+ title: i18n_.clear_filters_query_sorting_after_submit_()
2862
+ }), () => isNewModal ? $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Show), {
2863
+ get when() {
2864
+ return !searchFieldEmpty();
2865
+ },
2866
+ get fallback() {
2867
+ return $i7OB2$createComponent((0, $16f0ed5ea30d8d9c$export$82eafebb825fc23f), {});
2868
+ },
2869
+ get children() {
2870
+ return $i7OB2$createComponent(BackIcon_, {});
2871
+ }
2872
+ })) : $i7OB2$escape($i7OB2$createComponent((0, $19976a74d273070d$export$3b621d86b1566b2), {})), true);
2873
+ return $i7OB2$ssr($5285d2814d0fac0c$var$_tmpl$3, $i7OB2$ssrHydrationKey(), `search-field ${!!on_back_ ? "in-modal" : ""}`, $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Show), {
2874
+ get when() {
2875
+ return getBackButtonWidth() !== undefined && on_back_;
2876
+ },
2877
+ get children() {
2878
+ return $i7OB2$ssr($5285d2814d0fac0c$var$_tmpl$, $i7OB2$ssrHydrationKey(), "width:" + ($i7OB2$escape(getBackButtonWidth(), true) + "px"));
2879
+ }
2880
+ })), !isNewModal && $i7OB2$escape($i7OB2$createComponent(BackButton, {})), isNewModal && $i7OB2$escape($i7OB2$createComponent(ClearButton, {})), `query ${!!on_back_ ? "has-adjacent-back-button" : ""}`, $i7OB2$ssrAttribute("aria-label", $i7OB2$escape(i18n_.search_field_field_aria_label_(), true), false) + $i7OB2$ssrAttribute("value", $i7OB2$escape(searchFieldValue(), true), false) + $i7OB2$ssrAttribute("placeholder", $i7OB2$escape(i18n_.placeholder_text_(), true), false), !isNewModal && $i7OB2$escape($i7OB2$createComponent(ClearButton, {})), isNewModal && $i7OB2$escape($i7OB2$createComponent(BackButton, {})), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Show), {
2881
+ when: !isNewModal,
2882
+ get children() {
2883
+ return $i7OB2$ssr($5285d2814d0fac0c$var$_tmpl$2, $i7OB2$ssrHydrationKey(), $i7OB2$ssrAttribute("aria-label", $i7OB2$escape(i18n_.search_submit_button_aria_label_(), true), false), $i7OB2$escape($i7OB2$createComponent((0, $16f0ed5ea30d8d9c$export$82eafebb825fc23f), {})));
2884
+ }
2885
+ })));
2842
2886
  }
2843
2887
  function $aea1edf92433e81e$export$fe334901e8bebd57() {
2844
2888
  const cleanup_fns = [];
@@ -3002,7 +3046,7 @@ function $42912431795f188e$var$RawClassicSearchModal({
3002
3046
  };
3003
3047
  });
3004
3048
  const search_field = $5285d2814d0fac0c$export$b94867ecbd698f21({
3005
- BackIcon_: () => $i7OB2$createComponent((0, $ffb84ffbf4014982$export$8d8893ffd8aca39a), {}),
3049
+ BackIcon_: (0, $ffb84ffbf4014982$export$8d8893ffd8aca39a),
3006
3050
  input_field_ref_: element => set_input_field(element),
3007
3051
  override_on_enter_: e => on_enter_in_search_field_function?.(e),
3008
3052
  on_back_: close_modal_,
@@ -3018,7 +3062,6 @@ function $42912431795f188e$var$RawClassicSearchModal({
3018
3062
  input_el.setSelectionRange(start, end);
3019
3063
  }
3020
3064
  });
3021
- search_field.classList.add("in-modal");
3022
3065
  const modal_element = $i7OB2$ssr($42912431795f188e$var$_tmpl$3, $i7OB2$ssrHydrationKey(), `depict-search-modal`, `${`body` || ""} ${$i7OB2$escape($i7OB2$escape(random_classname, true), true)}`, $i7OB2$escape(search_field), $i7OB2$escape($i7OB2$createComponent((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
3023
3066
  severity_: "error",
3024
3067
  message_: "Autocomplete/suggestions failed",
@@ -4013,7 +4056,7 @@ function $500a16dd18ee5a71$var$RawSearchModalV2({
4013
4056
  };
4014
4057
  const discoverMoreSection = $i7OB2$ssr($500a16dd18ee5a71$var$_tmpl$2, $i7OB2$ssrHydrationKey(), get_search_field_value_() ? $i7OB2$escape(i18n_.modal_view_all_results_()($i7OB2$ssr($500a16dd18ee5a71$var$_tmpl$3, $i7OB2$ssrHydrationKey(), $i7OB2$escape(formattedTotalNumberResults())))) : $i7OB2$escape(i18n_.modal_discover_more_()));
4015
4058
  const search_field = $5285d2814d0fac0c$export$b94867ecbd698f21({
4016
- BackIcon_: () => $i7OB2$createComponent((0, $5cec65dd06ade2c4$export$11e9f390c90a537f), {}),
4059
+ BackIcon_: (0, $5cec65dd06ade2c4$export$11e9f390c90a537f),
4017
4060
  input_field_ref_: element => set_input_field(element),
4018
4061
  override_on_enter_: e => on_enter_in_search_field_function?.(e),
4019
4062
  on_back_: close_modal_,
@@ -4029,7 +4072,6 @@ function $500a16dd18ee5a71$var$RawSearchModalV2({
4029
4072
  input_el.setSelectionRange(start, end);
4030
4073
  }
4031
4074
  });
4032
- search_field.classList.add("in-modal");
4033
4075
  if (setSearchFieldOuterWidth_) {
4034
4076
  const resizeObserver = new ResizeObserver($i7OB2$catchify(records => setSearchFieldOuterWidth_(records.at(-1).contentRect.width)));
4035
4077
  resizeObserver.observe(search_field);
@@ -10310,7 +10352,7 @@ function $0e562a5b247b1fc2$export$44f738469d5570cf({
10310
10352
  bodyAlignmentSignal_: [, setBodyAlignment_],
10311
10353
  backdropStyleSignal_: [, setBackdropStyle_],
10312
10354
  setPollAlignment_: setPollAlignment_,
10313
- submitButton_: submitButton_,
10355
+ buttonInField_: buttonInField_,
10314
10356
  modalSearchFieldOuterWidth_: modalSearchFieldOuterWidth_
10315
10357
  }) {
10316
10358
  return $i7OB2$createRoot(dispose => {
@@ -10353,7 +10395,7 @@ function $0e562a5b247b1fc2$export$44f738469d5570cf({
10353
10395
  const closeDuration_ = pxOffCenter > 100 ? 150 : 100;
10354
10396
  setPollAlignment_(true);
10355
10397
  // Fade out submit button so there aren't two overlapping buttons for a split second
10356
- submitButton_.animate([{
10398
+ if (pxOffCenter > 10) buttonInField_.animate([{
10357
10399
  opacity: 1
10358
10400
  }, {
10359
10401
  opacity: 0
@@ -10420,6 +10462,8 @@ function $0e562a5b247b1fc2$export$44f738469d5570cf({
10420
10462
  width: width,
10421
10463
  left: left
10422
10464
  } = fakeField.getBoundingClientRect();
10465
+ // Just copy-pasted below line without thinking, it might be wrong
10466
+ const pxOffCenter = Math.abs($i7OB2$untrack(innerWidthReactive) / 2 - (left + width / 2));
10423
10467
  $0a901077d5c8a2b2$export$23d40cc5971c3acd({
10424
10468
  setBackdropStyle_: setBackdropStyle_,
10425
10469
  setBodyAlignment_: setBodyAlignment_,
@@ -10435,12 +10479,12 @@ function $0e562a5b247b1fc2$export$44f738469d5570cf({
10435
10479
  duration: closeDuration_,
10436
10480
  fill: "forwards",
10437
10481
  easing: "ease-out"
10438
- }).finished, submitButton_.animate([{
10482
+ }).finished, buttonInField_.animate([{
10439
10483
  opacity: 0
10440
10484
  }, {
10441
10485
  opacity: 1
10442
10486
  }], {
10443
- duration: closeDuration_ / 3,
10487
+ duration: pxOffCenter > 10 ? closeDuration_ / 3 : 1,
10444
10488
  delay: closeDuration_ * (2 / 3),
10445
10489
  fill: "forwards"
10446
10490
  }).finished]);
@@ -10633,7 +10677,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
10633
10677
  if (!input_field_accessor_value) break add_input_field;
10634
10678
  let input_element;
10635
10679
  let div_with_field_class;
10636
- let submitButton_;
10680
+ let buttonInField;
10637
10681
  const search_field = SafeSearchField({
10638
10682
  i18n_: i18n_,
10639
10683
  search_field_value_: search_field_value_,
@@ -10643,7 +10687,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
10643
10687
  field_element_ref_: el => div_with_field_class = el,
10644
10688
  disabled_: true,
10645
10689
  BackIcon_: BackIcon_,
10646
- submit_button_ref_: el => submitButton_ = el
10690
+ buttonInFieldRef_: el => buttonInField = el
10647
10691
  });
10648
10692
  if (!search_field) break add_input_field;
10649
10693
  setModalBodyStyle({});
@@ -10677,7 +10721,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
10677
10721
  bodyAlignmentSignal_: modal_body_style,
10678
10722
  backdropStyleSignal_: modal_backdrop_style,
10679
10723
  setPollAlignment_: setPollAlignment_,
10680
- submitButton_: submitButton_,
10724
+ buttonInField_: buttonInField,
10681
10725
  modalSearchFieldOuterWidth_: modalSearchFieldOuterWidth_
10682
10726
  });
10683
10727
  }
@@ -11515,7 +11559,7 @@ function $58b3487626e85ece$export$316f6f283ae64765(props) {
11515
11559
  const shared_properties = $806c97b931758897$export$12fa711345994013(depict_search);
11516
11560
  return $16b52438165aafe2$export$23fca46f3143581f(() => {
11517
11561
  let input_element;
11518
- let submitButton_;
11562
+ let buttonInField;
11519
11563
  const search_field = $i7OB2$createComponent((0, $5285d2814d0fac0c$export$b94867ecbd698f21), {
11520
11564
  get BackIcon_() {
11521
11565
  return shared_properties.BackIcon_;
@@ -11534,7 +11578,7 @@ function $58b3487626e85ece$export$316f6f283ae64765(props) {
11534
11578
  },
11535
11579
  disabled_: true,
11536
11580
  input_field_ref_: el => input_element = el,
11537
- submit_button_ref_: el => submitButton_ = el,
11581
+ buttonInFieldRef_: el => buttonInField = el,
11538
11582
  field_element_ref_: field => {
11539
11583
  const bodyAlignmentSignal_ = $i7OB2$createSignal({
11540
11584
  position: "fixed"
@@ -11581,7 +11625,7 @@ function $58b3487626e85ece$export$316f6f283ae64765(props) {
11581
11625
  bodyAlignmentSignal_: bodyAlignmentSignal_,
11582
11626
  backdropStyleSignal_: backdropAlignmentSignal_,
11583
11627
  setPollAlignment_: setPollAlignment_,
11584
- submitButton_: submitButton_,
11628
+ buttonInField_: buttonInField,
11585
11629
  modalSearchFieldOuterWidth_: modalSearchFieldOuterWidth_
11586
11630
  });
11587
11631
  }