@depict-ai/ui 4.3.13 → 4.4.0

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/ES10/index.js CHANGED
@@ -10,7 +10,7 @@ import { createStore as $8tj43$createStore, reconcile as $8tj43$reconcile } from
10
10
  /*! Depict.ai search and product listing SDK */
11
11
  import { register_es_version } from "../multi_import_deduplicator.mjs";
12
12
  register_es_version("ui", "ES10");
13
- const $8db9a15135765c11$export$83d89fbfd8236492 = "4.3.13";
13
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "4.4.0";
14
14
  const $a9c7ba6087881ac2$var$transform_elements = sorted_cols_at_size => {
15
15
  const cols_at_size = [];
16
16
  for (let i = 0; i < sorted_cols_at_size.length; i++) {
@@ -1330,9 +1330,9 @@ function $0c5b1686f971e5e7$export$b73ed90f0ee50dc3(_ref) {
1330
1330
  is_replace_: false,
1331
1331
  event_: event_
1332
1332
  });
1333
- if (event_.defaultPrevented)
1334
- // We single-page-navigated in this tab, close the look
1335
- setUserWantsExpanded(false);
1333
+ if (!event_.defaultPrevented)
1334
+ // If the user opened in a new tab, prevent the event from propagating to the parent which would close the look
1335
+ event_.stopImmediatePropagation();
1336
1336
  }
1337
1337
  });
1338
1338
  }
@@ -1693,10 +1693,7 @@ function $697d8713dc82b9ab$export$44809a8a3e867e30(_ref) {
1693
1693
  let {
1694
1694
  target: target
1695
1695
  } = _ref2;
1696
- // Don't toggle when clicking on the links
1697
- const selector = "a[href]";
1698
- if (target.matches(selector) || target.closest(selector)) return;
1699
- setUserWantsExpanded(prev => !prev);
1696
+ return setUserWantsExpanded(prev => !prev);
1700
1697
  }), true);
1701
1698
  _el$.classList.toggle("placeholder", !!!display_);
1702
1699
  $8tj43$runHydrationEvents();
@@ -3514,10 +3511,13 @@ let $c3820807ac1e6fd7$export$44dad306455dddf;
3514
3511
  DEPICT_ID["PLP_CATEGORY"] = "depict-plp-category";
3515
3512
  })($c3820807ac1e6fd7$export$44dad306455dddf || ($c3820807ac1e6fd7$export$44dad306455dddf = {}));
3516
3513
  var $584c06c09cf4609d$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<button class=back type=button>`),
3517
- $584c06c09cf4609d$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<div class=search-field role=search><!$><!/><div class=field><input class=query tabindex=0><button type=button class=clear></button></div><button class="submit major"type=button>`);
3514
+ $584c06c09cf4609d$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<button type=button class=clear>`),
3515
+ $584c06c09cf4609d$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<div class=spacer>`),
3516
+ $584c06c09cf4609d$var$_tmpl$4 = /*#__PURE__*/$8tj43$template(`<button class="submit major"type=button>`),
3517
+ $584c06c09cf4609d$var$_tmpl$5 = /*#__PURE__*/$8tj43$template(`<div class=search-field role=search><!$><!/><!$><!/><div class=field><!$><!/><input class=query tabindex=0><!$><!/></div><!$><!/><!$><!/>`);
3518
3518
  function $584c06c09cf4609d$export$b94867ecbd698f21(_ref) {
3519
3519
  let {
3520
- search_field_value_: search_field_value_,
3520
+ search_field_value_: [searchFieldValue, setSearchFieldValue],
3521
3521
  input_field_ref_: input_field_ref_,
3522
3522
  field_element_ref_: field_element_ref_,
3523
3523
  submit_query_: submit_query_,
@@ -3542,30 +3542,105 @@ function $584c06c09cf4609d$export$b94867ecbd698f21(_ref) {
3542
3542
  })); // focus field on render
3543
3543
  const owner_of_field_element = $8tj43$getOwner();
3544
3544
  const isNewModal = BackIcon_[(0, $b026fa9c9c904a98$export$1ea76ea778b880dd)] === 2;
3545
+ const [backButtonWidthAccessor, setBackButtonWidthAccessor] = $8tj43$createSignal();
3546
+ const getBackButtonWidth = () => {
3547
+ var _backButtonWidthAcces;
3548
+ return (_backButtonWidthAcces = backButtonWidthAccessor()) === null || _backButtonWidthAcces === void 0 ? void 0 : _backButtonWidthAcces();
3549
+ };
3550
+ const searchFieldEmpty = $8tj43$createMemo(() => !searchFieldValue());
3551
+ const BackButton = () => $8tj43$createComponent((0, $8tj43$Show), {
3552
+ when: on_back_,
3553
+ get children() {
3554
+ var _el$ = $8tj43$getNextElement($584c06c09cf4609d$var$_tmpl$);
3555
+ $8tj43$spread(_el$, $8tj43$mergeProps({
3556
+ get onClick() {
3557
+ return $8tj43$catchify(on_back_);
3558
+ },
3559
+ get ["aria-label"]() {
3560
+ return i18n_.back_();
3561
+ }
3562
+ }, isNewModal && {
3563
+ ref: el => {
3564
+ setBackButtonWidthAccessor(() => $fc830a7ee59416ef$export$ebdc3711f7e02ccd(el));
3565
+ $8tj43$onCleanup(() => setBackButtonWidthAccessor());
3566
+ }
3567
+ }), false, true);
3568
+ $8tj43$insert(_el$, isNewModal ? $8tj43$createComponent((0, $9783d437ad61594c$export$3b621d86b1566b2), {}) : $8tj43$createComponent(BackIcon_, {}));
3569
+ $8tj43$runHydrationEvents();
3570
+ return _el$;
3571
+ }
3572
+ });
3573
+ const ClearButton = () => (() => {
3574
+ var _el$2 = $8tj43$getNextElement($584c06c09cf4609d$var$_tmpl$2);
3575
+ $8tj43$spread(_el$2, $8tj43$mergeProps({
3576
+ get classList() {
3577
+ return {
3578
+ empty: searchFieldEmpty()
3579
+ };
3580
+ },
3581
+ get style() {
3582
+ return isNewModal || !searchFieldEmpty() ? "" : "display: none";
3583
+ },
3584
+ get onClick() {
3585
+ return $8tj43$catchify(() => {
3586
+ if (isNewModal && searchFieldEmpty()) return;
3587
+ setSearchFieldValue("");
3588
+ clear_filters_(true);
3589
+ if (!disabled_) input_element.focus();
3590
+ });
3591
+ }
3592
+ }, () => searchFieldEmpty() ? {
3593
+ "aria-hidden": "true"
3594
+ } : {
3595
+ title: i18n_.clear_filters_query_sorting_after_submit_()
3596
+ }), false, true);
3597
+ $8tj43$insert(_el$2, isNewModal ? $8tj43$createComponent((0, $8tj43$Show), {
3598
+ get when() {
3599
+ return !searchFieldEmpty();
3600
+ },
3601
+ get fallback() {
3602
+ return $8tj43$createComponent((0, $ef0f18a578b32578$export$82eafebb825fc23f), {});
3603
+ },
3604
+ get children() {
3605
+ return $8tj43$createComponent(BackIcon_, {});
3606
+ }
3607
+ }) : $8tj43$createComponent((0, $9783d437ad61594c$export$3b621d86b1566b2), {}));
3608
+ $8tj43$runHydrationEvents();
3609
+ return _el$2;
3610
+ })();
3545
3611
  return (() => {
3546
- var _el$ = $8tj43$getNextElement($584c06c09cf4609d$var$_tmpl$2),
3547
- _el$7 = _el$.firstChild,
3612
+ var _el$3 = $8tj43$getNextElement($584c06c09cf4609d$var$_tmpl$5),
3613
+ _el$12 = _el$3.firstChild,
3614
+ [_el$13, _co$3] = $8tj43$getNextMarker(_el$12.nextSibling),
3615
+ _el$14 = _el$13.nextSibling,
3616
+ [_el$15, _co$4] = $8tj43$getNextMarker(_el$14.nextSibling),
3617
+ _el$5 = _el$15.nextSibling,
3618
+ _el$7 = _el$5.firstChild,
3548
3619
  [_el$8, _co$] = $8tj43$getNextMarker(_el$7.nextSibling),
3549
- _el$3 = _el$8.nextSibling,
3550
- _el$4 = _el$3.firstChild,
3551
- _el$5 = _el$4.nextSibling,
3552
- _el$6 = _el$3.nextSibling;
3553
- $8tj43$insert(_el$, $8tj43$createComponent((0, $8tj43$Show), {
3554
- when: on_back_,
3620
+ _el$6 = _el$8.nextSibling,
3621
+ _el$9 = _el$6.nextSibling,
3622
+ [_el$10, _co$2] = $8tj43$getNextMarker(_el$9.nextSibling),
3623
+ _el$16 = _el$5.nextSibling,
3624
+ [_el$17, _co$5] = $8tj43$getNextMarker(_el$16.nextSibling),
3625
+ _el$18 = _el$17.nextSibling,
3626
+ [_el$19, _co$6] = $8tj43$getNextMarker(_el$18.nextSibling);
3627
+ _el$3.classList.toggle("in-modal", !!!!on_back_);
3628
+ $8tj43$insert(_el$3, $8tj43$createComponent((0, $8tj43$Show), {
3629
+ get when() {
3630
+ return getBackButtonWidth() !== undefined && on_back_;
3631
+ },
3555
3632
  get children() {
3556
- var _el$2 = $8tj43$getNextElement($584c06c09cf4609d$var$_tmpl$);
3557
- $8tj43$addEventListener(_el$2, "click", $8tj43$catchify(on_back_), true);
3558
- $8tj43$insert(_el$2, $8tj43$createComponent(BackIcon_, {}));
3559
- $8tj43$effect(() => $8tj43$setAttribute(_el$2, "aria-label", i18n_.back_()));
3560
- $8tj43$runHydrationEvents();
3561
- return _el$2;
3633
+ var _el$4 = $8tj43$getNextElement($584c06c09cf4609d$var$_tmpl$3);
3634
+ $8tj43$effect(() => (getBackButtonWidth(), _el$4.style.setProperty("width", getBackButtonWidth() + "px")));
3635
+ return _el$4;
3562
3636
  }
3563
- }), _el$8, _co$);
3637
+ }), _el$13, _co$3);
3638
+ $8tj43$insert(_el$3, !isNewModal && $8tj43$createComponent(BackButton, {}), _el$15, _co$4);
3564
3639
  $8tj43$use(el => {
3565
3640
  field_div = el;
3566
3641
  field_element_ref_ === null || field_element_ref_ === void 0 || field_element_ref_(el);
3567
- }, _el$3);
3568
- $8tj43$addEventListener(_el$3, "click", $8tj43$catchify(_ref2 => {
3642
+ }, _el$5);
3643
+ $8tj43$addEventListener(_el$5, "click", $8tj43$catchify(_ref2 => {
3569
3644
  let {
3570
3645
  target: target,
3571
3646
  currentTarget: currentTarget,
@@ -3590,7 +3665,8 @@ function $584c06c09cf4609d$export$b94867ecbd698f21(_ref) {
3590
3665
  }
3591
3666
  }
3592
3667
  }), true);
3593
- _el$4.$$pointerdown = _ref3 => {
3668
+ $8tj43$insert(_el$5, isNewModal && $8tj43$createComponent(ClearButton, {}), _el$8, _co$);
3669
+ _el$6.$$pointerdown = _ref3 => {
3594
3670
  let {
3595
3671
  pointerType: pointerType
3596
3672
  } = _ref3;
@@ -3610,7 +3686,7 @@ function $584c06c09cf4609d$export$b94867ecbd698f21(_ref) {
3610
3686
  $8tj43$runWithOwner(owner_of_field_element, () => $8tj43$onCleanup(() => window.removeEventListener("pointerup", handler)));
3611
3687
  }
3612
3688
  };
3613
- $8tj43$addEventListener(_el$4, "select", $8tj43$catchify(() => {
3689
+ $8tj43$addEventListener(_el$6, "select", $8tj43$catchify(() => {
3614
3690
  if (disabled_)
3615
3691
  // just in case. The field not actually being disabled when being disabled_ is so that you can focus it and open the modal. We don't want any of the other input-field-interaction features to work
3616
3692
  return;
@@ -3622,14 +3698,14 @@ function $584c06c09cf4609d$export$b94867ecbd698f21(_ref) {
3622
3698
  once: true
3623
3699
  });
3624
3700
  }));
3625
- $8tj43$addEventListener(_el$4, "input", $8tj43$catchify(() => {
3701
+ $8tj43$addEventListener(_el$6, "input", $8tj43$catchify(() => {
3626
3702
  const {
3627
3703
  value: value
3628
3704
  } = input_element;
3629
3705
  if (!disabled_ && !value.length) clear_filters_(false); // if the user clears the whole field, reset filters on next submit
3630
- search_field_value_[1](value);
3706
+ setSearchFieldValue(value);
3631
3707
  }), true);
3632
- $8tj43$addEventListener(_el$4, "keydown", $8tj43$catchify(e => {
3708
+ $8tj43$addEventListener(_el$6, "keydown", $8tj43$catchify(e => {
3633
3709
  if (disabled_) {
3634
3710
  if (e.key !== "Tab" && e.key !== "Shift")
3635
3711
  // 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
@@ -3643,45 +3719,36 @@ function $584c06c09cf4609d$export$b94867ecbd698f21(_ref) {
3643
3719
  input_element = el;
3644
3720
  input_field_ref_ === null || input_field_ref_ === void 0 || input_field_ref_(el);
3645
3721
  });
3646
- typeof _ref$ === "function" && $8tj43$use(_ref$, _el$4);
3647
- _el$4.classList.toggle("has-adjacent-back-button", !!!!on_back_);
3648
- $8tj43$addEventListener(_el$5, "click", $8tj43$catchify(() => {
3649
- search_field_value_[1]("");
3650
- clear_filters_(true);
3651
- if (!disabled_) input_element.focus();
3652
- }), true);
3653
- $8tj43$insert(_el$5, $8tj43$createComponent((0, $9783d437ad61594c$export$3b621d86b1566b2), {}));
3654
- var _ref$2 = submit_button_ref_;
3655
- typeof _ref$2 === "function" ? $8tj43$use(_ref$2, _el$6) : submit_button_ref_ = _el$6;
3656
- $8tj43$spread(_el$6, $8tj43$mergeProps({
3657
- get onClick() {
3658
- return $8tj43$catchify(() => submit_query_());
3722
+ typeof _ref$ === "function" && $8tj43$use(_ref$, _el$6);
3723
+ _el$6.classList.toggle("has-adjacent-back-button", !!!!on_back_);
3724
+ $8tj43$insert(_el$5, !isNewModal && $8tj43$createComponent(ClearButton, {}), _el$10, _co$2);
3725
+ $8tj43$insert(_el$3, isNewModal && $8tj43$createComponent(BackButton, {}), _el$17, _co$5);
3726
+ $8tj43$insert(_el$3, $8tj43$createComponent((0, $8tj43$Show), {
3727
+ when: !isNewModal,
3728
+ get children() {
3729
+ var _el$11 = $8tj43$getNextElement($584c06c09cf4609d$var$_tmpl$4);
3730
+ $8tj43$addEventListener(_el$11, "click", $8tj43$catchify(() => submit_query_()), true);
3731
+ var _ref$2 = submit_button_ref_;
3732
+ typeof _ref$2 === "function" ? $8tj43$use(_ref$2, _el$11) : submit_button_ref_ = _el$11;
3733
+ $8tj43$insert(_el$11, $8tj43$createComponent((0, $ef0f18a578b32578$export$82eafebb825fc23f), {}));
3734
+ $8tj43$effect(() => $8tj43$setAttribute(_el$11, "aria-label", i18n_.search_submit_button_aria_label_()));
3735
+ $8tj43$runHydrationEvents();
3736
+ return _el$11;
3659
3737
  }
3660
- }, () => isNewModal ? {
3661
- tabindex: "-1"
3662
- } : {
3663
- "aria-label": i18n_.search_submit_button_aria_label_()
3664
- }), false, true);
3665
- $8tj43$insert(_el$6, $8tj43$createComponent((0, $ef0f18a578b32578$export$82eafebb825fc23f), {}));
3738
+ }), _el$19, _co$6);
3666
3739
  $8tj43$effect(_p$ => {
3667
3740
  var _v$ = i18n_.search_field_field_aria_label_(),
3668
- _v$2 = i18n_.placeholder_text_(),
3669
- _v$3 = i18n_.clear_filters_query_sorting_after_submit_(),
3670
- _v$4 = $8tj43$createMemo(() => search_field_value_[0]() ? "" : "display: none")();
3671
- _v$ !== _p$.e && $8tj43$setAttribute(_el$4, "aria-label", _p$.e = _v$);
3672
- _v$2 !== _p$.t && $8tj43$setAttribute(_el$4, "placeholder", _p$.t = _v$2);
3673
- _v$3 !== _p$.a && $8tj43$setAttribute(_el$5, "title", _p$.a = _v$3);
3674
- _p$.o = $8tj43$style(_el$5, _v$4, _p$.o);
3741
+ _v$2 = i18n_.placeholder_text_();
3742
+ _v$ !== _p$.e && $8tj43$setAttribute(_el$6, "aria-label", _p$.e = _v$);
3743
+ _v$2 !== _p$.t && $8tj43$setAttribute(_el$6, "placeholder", _p$.t = _v$2);
3675
3744
  return _p$;
3676
3745
  }, {
3677
3746
  e: undefined,
3678
- t: undefined,
3679
- a: undefined,
3680
- o: undefined
3747
+ t: undefined
3681
3748
  });
3682
- $8tj43$effect(() => $8tj43$setProperty(_el$4, "value", search_field_value_[0]()));
3749
+ $8tj43$effect(() => $8tj43$setProperty(_el$6, "value", searchFieldValue()));
3683
3750
  $8tj43$runHydrationEvents();
3684
- return _el$;
3751
+ return _el$3;
3685
3752
  })();
3686
3753
  }
3687
3754
  $8tj43$delegateEvents(["click", "keydown", "input", "pointerdown"]);
@@ -3864,7 +3931,7 @@ function $40411f2ec772c376$var$RawClassicSearchModal(_ref) {
3864
3931
  };
3865
3932
  });
3866
3933
  const search_field = $584c06c09cf4609d$export$b94867ecbd698f21({
3867
- BackIcon_: () => $8tj43$createComponent((0, $fac58b5610eec6a9$export$8d8893ffd8aca39a), {}),
3934
+ BackIcon_: (0, $fac58b5610eec6a9$export$8d8893ffd8aca39a),
3868
3935
  input_field_ref_: element => set_input_field(element),
3869
3936
  override_on_enter_: e => {
3870
3937
  var _on_enter_in_search_f;
@@ -3883,7 +3950,6 @@ function $40411f2ec772c376$var$RawClassicSearchModal(_ref) {
3883
3950
  input_el.setSelectionRange(start, end);
3884
3951
  }
3885
3952
  });
3886
- search_field.classList.add("in-modal");
3887
3953
  const modal_element = (() => {
3888
3954
  var _el$4 = $8tj43$getNextElement($40411f2ec772c376$var$_tmpl$3),
3889
3955
  _el$5 = _el$4.firstChild,
@@ -5152,7 +5218,7 @@ function $06fcd2a345efd24d$var$RawSearchModalV2(_ref) {
5152
5218
  return _el$7;
5153
5219
  })();
5154
5220
  const search_field = $584c06c09cf4609d$export$b94867ecbd698f21({
5155
- BackIcon_: () => $8tj43$createComponent((0, $c2fe922d21c40514$export$11e9f390c90a537f), {}),
5221
+ BackIcon_: (0, $c2fe922d21c40514$export$11e9f390c90a537f),
5156
5222
  input_field_ref_: element => set_input_field(element),
5157
5223
  override_on_enter_: e => {
5158
5224
  var _on_enter_in_search_f;
@@ -5171,7 +5237,6 @@ function $06fcd2a345efd24d$var$RawSearchModalV2(_ref) {
5171
5237
  input_el.setSelectionRange(start, end);
5172
5238
  }
5173
5239
  });
5174
- search_field.classList.add("in-modal");
5175
5240
  if (setSearchFieldOuterWidth_) {
5176
5241
  const resizeObserver = new ResizeObserver($8tj43$catchify(records => setSearchFieldOuterWidth_(records.at(-1).contentRect.width)));
5177
5242
  resizeObserver.observe(search_field);
@@ -13504,7 +13569,7 @@ function $937791b86d3d1509$export$44f738469d5570cf(_ref) {
13504
13569
  const closeDuration_ = pxOffCenter > 100 ? 150 : 100;
13505
13570
  setPollAlignment_(true);
13506
13571
  // Fade out submit button so there aren't two overlapping buttons for a split second
13507
- submitButton_.animate([{
13572
+ submitButton_ === null || submitButton_ === void 0 || submitButton_.animate([{
13508
13573
  opacity: 1
13509
13574
  }, {
13510
13575
  opacity: 0
@@ -13586,7 +13651,7 @@ function $937791b86d3d1509$export$44f738469d5570cf(_ref) {
13586
13651
  duration: closeDuration_,
13587
13652
  fill: "forwards",
13588
13653
  easing: "ease-out"
13589
- }).finished, submitButton_.animate([{
13654
+ }).finished, submitButton_ === null || submitButton_ === void 0 ? void 0 : submitButton_.animate([{
13590
13655
  opacity: 0
13591
13656
  }, {
13592
13657
  opacity: 1
package/latest/index.cjs CHANGED
@@ -94,7 +94,7 @@ $parcel$export(module.exports, "BreadCrumbs", () => $1f4925833f07df29$export$5b7
94
94
  $parcel$export(module.exports, "QuickLinks", () => $1f4925833f07df29$export$de035477d6fef996);
95
95
  $parcel$export(module.exports, "CategoryPage", () => $14f289047713d67a$export$e2bf8ce7779e827e);
96
96
  /*! Depict.ai search and product listing SDK */
97
- const $b757f75811f3261f$export$83d89fbfd8236492 = "4.3.13";
97
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "4.4.0";
98
98
  const $4e04be41243c3d80$var$transform_elements = sorted_cols_at_size => {
99
99
  const cols_at_size = [];
100
100
  for (let i = 0; i < sorted_cols_at_size.length; i++) {
@@ -1339,9 +1339,9 @@ function $1ae437d7d388a66e$export$b73ed90f0ee50dc3({
1339
1339
  is_replace_: false,
1340
1340
  event_: event_
1341
1341
  });
1342
- if (event_.defaultPrevented)
1343
- // We single-page-navigated in this tab, close the look
1344
- setUserWantsExpanded(false);
1342
+ if (!event_.defaultPrevented)
1343
+ // If the user opened in a new tab, prevent the event from propagating to the parent which would close the look
1344
+ event_.stopImmediatePropagation();
1345
1345
  }
1346
1346
  });
1347
1347
  }
@@ -1694,12 +1694,7 @@ function $ad882bbe664dbd53$export$44809a8a3e867e30({
1694
1694
  var _el$ = $gVhhF$solidjsweb.getNextElement($ad882bbe664dbd53$var$_tmpl$);
1695
1695
  $gVhhF$solidjsweb.addEventListener(_el$, "click", $gVhhF$depictaiutilishared.catchify(({
1696
1696
  target: target
1697
- }) => {
1698
- // Don't toggle when clicking on the links
1699
- const selector = "a[href]";
1700
- if (target.matches(selector) || target.closest(selector)) return;
1701
- setUserWantsExpanded(prev => !prev);
1702
- }), true);
1697
+ }) => setUserWantsExpanded(prev => !prev)), true);
1703
1698
  _el$.classList.toggle("placeholder", !!!display_);
1704
1699
  $gVhhF$solidjsweb.runHydrationEvents();
1705
1700
  return _el$;
@@ -3416,9 +3411,12 @@ let $0b6e2070a98de347$export$44dad306455dddf;
3416
3411
  DEPICT_ID["PLP_CATEGORY"] = "depict-plp-category";
3417
3412
  })($0b6e2070a98de347$export$44dad306455dddf || ($0b6e2070a98de347$export$44dad306455dddf = {}));
3418
3413
  var $66b8b9a9613c141d$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button class=back type=button>`),
3419
- $66b8b9a9613c141d$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=search-field role=search><!$><!/><div class=field><input class=query tabindex=0><button type=button class=clear></button></div><button class="submit major"type=button>`);
3414
+ $66b8b9a9613c141d$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button type=button class=clear>`),
3415
+ $66b8b9a9613c141d$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=spacer>`),
3416
+ $66b8b9a9613c141d$var$_tmpl$4 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button class="submit major"type=button>`),
3417
+ $66b8b9a9613c141d$var$_tmpl$5 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=search-field role=search><!$><!/><!$><!/><div class=field><!$><!/><input class=query tabindex=0><!$><!/></div><!$><!/><!$><!/>`);
3420
3418
  function $66b8b9a9613c141d$export$b94867ecbd698f21({
3421
- search_field_value_: search_field_value_,
3419
+ search_field_value_: [searchFieldValue, setSearchFieldValue],
3422
3420
  input_field_ref_: input_field_ref_,
3423
3421
  field_element_ref_: field_element_ref_,
3424
3422
  submit_query_: submit_query_,
@@ -3443,30 +3441,102 @@ function $66b8b9a9613c141d$export$b94867ecbd698f21({
3443
3441
  })); // focus field on render
3444
3442
  const owner_of_field_element = $gVhhF$solidjs.getOwner();
3445
3443
  const isNewModal = BackIcon_[(0, $ad1fa088e5509cca$export$1ea76ea778b880dd)] === 2;
3444
+ const [backButtonWidthAccessor, setBackButtonWidthAccessor] = $gVhhF$solidjs.createSignal();
3445
+ const getBackButtonWidth = () => backButtonWidthAccessor()?.();
3446
+ const searchFieldEmpty = $gVhhF$solidjs.createMemo(() => !searchFieldValue());
3447
+ const BackButton = () => $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
3448
+ when: on_back_,
3449
+ get children() {
3450
+ var _el$ = $gVhhF$solidjsweb.getNextElement($66b8b9a9613c141d$var$_tmpl$);
3451
+ $gVhhF$solidjsweb.spread(_el$, $gVhhF$solidjsweb.mergeProps({
3452
+ get onClick() {
3453
+ return $gVhhF$depictaiutilishared.catchify(on_back_);
3454
+ },
3455
+ get ["aria-label"]() {
3456
+ return i18n_.back_();
3457
+ }
3458
+ }, isNewModal && {
3459
+ ref: el => {
3460
+ setBackButtonWidthAccessor(() => $f13855d1b951b24a$export$ebdc3711f7e02ccd(el));
3461
+ $gVhhF$solidjs.onCleanup(() => setBackButtonWidthAccessor());
3462
+ }
3463
+ }), false, true);
3464
+ $gVhhF$solidjsweb.insert(_el$, isNewModal ? $gVhhF$solidjsweb.createComponent((0, $c77c68e559a1506c$export$3b621d86b1566b2), {}) : $gVhhF$solidjsweb.createComponent(BackIcon_, {}));
3465
+ $gVhhF$solidjsweb.runHydrationEvents();
3466
+ return _el$;
3467
+ }
3468
+ });
3469
+ const ClearButton = () => (() => {
3470
+ var _el$2 = $gVhhF$solidjsweb.getNextElement($66b8b9a9613c141d$var$_tmpl$2);
3471
+ $gVhhF$solidjsweb.spread(_el$2, $gVhhF$solidjsweb.mergeProps({
3472
+ get classList() {
3473
+ return {
3474
+ empty: searchFieldEmpty()
3475
+ };
3476
+ },
3477
+ get style() {
3478
+ return isNewModal || !searchFieldEmpty() ? "" : "display: none";
3479
+ },
3480
+ get onClick() {
3481
+ return $gVhhF$depictaiutilishared.catchify(() => {
3482
+ if (isNewModal && searchFieldEmpty()) return;
3483
+ setSearchFieldValue("");
3484
+ clear_filters_(true);
3485
+ if (!disabled_) input_element.focus();
3486
+ });
3487
+ }
3488
+ }, () => searchFieldEmpty() ? {
3489
+ "aria-hidden": "true"
3490
+ } : {
3491
+ title: i18n_.clear_filters_query_sorting_after_submit_()
3492
+ }), false, true);
3493
+ $gVhhF$solidjsweb.insert(_el$2, isNewModal ? $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
3494
+ get when() {
3495
+ return !searchFieldEmpty();
3496
+ },
3497
+ get fallback() {
3498
+ return $gVhhF$solidjsweb.createComponent((0, $87d7574e1d89d69b$export$82eafebb825fc23f), {});
3499
+ },
3500
+ get children() {
3501
+ return $gVhhF$solidjsweb.createComponent(BackIcon_, {});
3502
+ }
3503
+ }) : $gVhhF$solidjsweb.createComponent((0, $c77c68e559a1506c$export$3b621d86b1566b2), {}));
3504
+ $gVhhF$solidjsweb.runHydrationEvents();
3505
+ return _el$2;
3506
+ })();
3446
3507
  return (() => {
3447
- var _el$ = $gVhhF$solidjsweb.getNextElement($66b8b9a9613c141d$var$_tmpl$2),
3448
- _el$7 = _el$.firstChild,
3508
+ var _el$3 = $gVhhF$solidjsweb.getNextElement($66b8b9a9613c141d$var$_tmpl$5),
3509
+ _el$12 = _el$3.firstChild,
3510
+ [_el$13, _co$3] = $gVhhF$solidjsweb.getNextMarker(_el$12.nextSibling),
3511
+ _el$14 = _el$13.nextSibling,
3512
+ [_el$15, _co$4] = $gVhhF$solidjsweb.getNextMarker(_el$14.nextSibling),
3513
+ _el$5 = _el$15.nextSibling,
3514
+ _el$7 = _el$5.firstChild,
3449
3515
  [_el$8, _co$] = $gVhhF$solidjsweb.getNextMarker(_el$7.nextSibling),
3450
- _el$3 = _el$8.nextSibling,
3451
- _el$4 = _el$3.firstChild,
3452
- _el$5 = _el$4.nextSibling,
3453
- _el$6 = _el$3.nextSibling;
3454
- $gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
3455
- when: on_back_,
3516
+ _el$6 = _el$8.nextSibling,
3517
+ _el$9 = _el$6.nextSibling,
3518
+ [_el$10, _co$2] = $gVhhF$solidjsweb.getNextMarker(_el$9.nextSibling),
3519
+ _el$16 = _el$5.nextSibling,
3520
+ [_el$17, _co$5] = $gVhhF$solidjsweb.getNextMarker(_el$16.nextSibling),
3521
+ _el$18 = _el$17.nextSibling,
3522
+ [_el$19, _co$6] = $gVhhF$solidjsweb.getNextMarker(_el$18.nextSibling);
3523
+ _el$3.classList.toggle("in-modal", !!!!on_back_);
3524
+ $gVhhF$solidjsweb.insert(_el$3, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
3525
+ get when() {
3526
+ return getBackButtonWidth() !== undefined && on_back_;
3527
+ },
3456
3528
  get children() {
3457
- var _el$2 = $gVhhF$solidjsweb.getNextElement($66b8b9a9613c141d$var$_tmpl$);
3458
- $gVhhF$solidjsweb.addEventListener(_el$2, "click", $gVhhF$depictaiutilishared.catchify(on_back_), true);
3459
- $gVhhF$solidjsweb.insert(_el$2, $gVhhF$solidjsweb.createComponent(BackIcon_, {}));
3460
- $gVhhF$solidjsweb.effect(() => $gVhhF$solidjsweb.setAttribute(_el$2, "aria-label", i18n_.back_()));
3461
- $gVhhF$solidjsweb.runHydrationEvents();
3462
- return _el$2;
3529
+ var _el$4 = $gVhhF$solidjsweb.getNextElement($66b8b9a9613c141d$var$_tmpl$3);
3530
+ $gVhhF$solidjsweb.effect(() => (getBackButtonWidth(), _el$4.style.setProperty("width", getBackButtonWidth() + "px")));
3531
+ return _el$4;
3463
3532
  }
3464
- }), _el$8, _co$);
3533
+ }), _el$13, _co$3);
3534
+ $gVhhF$solidjsweb.insert(_el$3, !isNewModal && $gVhhF$solidjsweb.createComponent(BackButton, {}), _el$15, _co$4);
3465
3535
  $gVhhF$solidjsweb.use(el => {
3466
3536
  field_div = el;
3467
3537
  field_element_ref_?.(el);
3468
- }, _el$3);
3469
- $gVhhF$solidjsweb.addEventListener(_el$3, "click", $gVhhF$depictaiutilishared.catchify(({
3538
+ }, _el$5);
3539
+ $gVhhF$solidjsweb.addEventListener(_el$5, "click", $gVhhF$depictaiutilishared.catchify(({
3470
3540
  target: target,
3471
3541
  currentTarget: currentTarget,
3472
3542
  detail: detail
@@ -3490,7 +3560,8 @@ function $66b8b9a9613c141d$export$b94867ecbd698f21({
3490
3560
  }
3491
3561
  }
3492
3562
  }), true);
3493
- _el$4.$$pointerdown = ({
3563
+ $gVhhF$solidjsweb.insert(_el$5, isNewModal && $gVhhF$solidjsweb.createComponent(ClearButton, {}), _el$8, _co$);
3564
+ _el$6.$$pointerdown = ({
3494
3565
  pointerType: pointerType
3495
3566
  }) => {
3496
3567
  // When selecting text with a mouse we want a SearchField to be focussed even when releasing the mouse outside the .field element (we assume the event listener which opens the modal is attached to that).
@@ -3508,7 +3579,7 @@ function $66b8b9a9613c141d$export$b94867ecbd698f21({
3508
3579
  $gVhhF$solidjs.runWithOwner(owner_of_field_element, () => $gVhhF$solidjs.onCleanup(() => window.removeEventListener("pointerup", handler)));
3509
3580
  }
3510
3581
  };
3511
- $gVhhF$solidjsweb.addEventListener(_el$4, "select", $gVhhF$depictaiutilishared.catchify(() => {
3582
+ $gVhhF$solidjsweb.addEventListener(_el$6, "select", $gVhhF$depictaiutilishared.catchify(() => {
3512
3583
  if (disabled_)
3513
3584
  // just in case. The field not actually being disabled when being disabled_ is so that you can focus it and open the modal. We don't want any of the other input-field-interaction features to work
3514
3585
  return;
@@ -3520,14 +3591,14 @@ function $66b8b9a9613c141d$export$b94867ecbd698f21({
3520
3591
  once: true
3521
3592
  });
3522
3593
  }));
3523
- $gVhhF$solidjsweb.addEventListener(_el$4, "input", $gVhhF$depictaiutilishared.catchify(() => {
3594
+ $gVhhF$solidjsweb.addEventListener(_el$6, "input", $gVhhF$depictaiutilishared.catchify(() => {
3524
3595
  const {
3525
3596
  value: value
3526
3597
  } = input_element;
3527
3598
  if (!disabled_ && !value.length) clear_filters_(false); // if the user clears the whole field, reset filters on next submit
3528
- search_field_value_[1](value);
3599
+ setSearchFieldValue(value);
3529
3600
  }), true);
3530
- $gVhhF$solidjsweb.addEventListener(_el$4, "keydown", $gVhhF$depictaiutilishared.catchify(e => {
3601
+ $gVhhF$solidjsweb.addEventListener(_el$6, "keydown", $gVhhF$depictaiutilishared.catchify(e => {
3531
3602
  if (disabled_) {
3532
3603
  if (e.key !== "Tab" && e.key !== "Shift")
3533
3604
  // 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
@@ -3541,45 +3612,36 @@ function $66b8b9a9613c141d$export$b94867ecbd698f21({
3541
3612
  input_element = el;
3542
3613
  input_field_ref_?.(el);
3543
3614
  });
3544
- typeof _ref$ === "function" && $gVhhF$solidjsweb.use(_ref$, _el$4);
3545
- _el$4.classList.toggle("has-adjacent-back-button", !!!!on_back_);
3546
- $gVhhF$solidjsweb.addEventListener(_el$5, "click", $gVhhF$depictaiutilishared.catchify(() => {
3547
- search_field_value_[1]("");
3548
- clear_filters_(true);
3549
- if (!disabled_) input_element.focus();
3550
- }), true);
3551
- $gVhhF$solidjsweb.insert(_el$5, $gVhhF$solidjsweb.createComponent((0, $c77c68e559a1506c$export$3b621d86b1566b2), {}));
3552
- var _ref$2 = submit_button_ref_;
3553
- typeof _ref$2 === "function" ? $gVhhF$solidjsweb.use(_ref$2, _el$6) : submit_button_ref_ = _el$6;
3554
- $gVhhF$solidjsweb.spread(_el$6, $gVhhF$solidjsweb.mergeProps({
3555
- get onClick() {
3556
- return $gVhhF$depictaiutilishared.catchify(() => submit_query_());
3615
+ typeof _ref$ === "function" && $gVhhF$solidjsweb.use(_ref$, _el$6);
3616
+ _el$6.classList.toggle("has-adjacent-back-button", !!!!on_back_);
3617
+ $gVhhF$solidjsweb.insert(_el$5, !isNewModal && $gVhhF$solidjsweb.createComponent(ClearButton, {}), _el$10, _co$2);
3618
+ $gVhhF$solidjsweb.insert(_el$3, isNewModal && $gVhhF$solidjsweb.createComponent(BackButton, {}), _el$17, _co$5);
3619
+ $gVhhF$solidjsweb.insert(_el$3, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
3620
+ when: !isNewModal,
3621
+ get children() {
3622
+ var _el$11 = $gVhhF$solidjsweb.getNextElement($66b8b9a9613c141d$var$_tmpl$4);
3623
+ $gVhhF$solidjsweb.addEventListener(_el$11, "click", $gVhhF$depictaiutilishared.catchify(() => submit_query_()), true);
3624
+ var _ref$2 = submit_button_ref_;
3625
+ typeof _ref$2 === "function" ? $gVhhF$solidjsweb.use(_ref$2, _el$11) : submit_button_ref_ = _el$11;
3626
+ $gVhhF$solidjsweb.insert(_el$11, $gVhhF$solidjsweb.createComponent((0, $87d7574e1d89d69b$export$82eafebb825fc23f), {}));
3627
+ $gVhhF$solidjsweb.effect(() => $gVhhF$solidjsweb.setAttribute(_el$11, "aria-label", i18n_.search_submit_button_aria_label_()));
3628
+ $gVhhF$solidjsweb.runHydrationEvents();
3629
+ return _el$11;
3557
3630
  }
3558
- }, () => isNewModal ? {
3559
- tabindex: "-1"
3560
- } : {
3561
- "aria-label": i18n_.search_submit_button_aria_label_()
3562
- }), false, true);
3563
- $gVhhF$solidjsweb.insert(_el$6, $gVhhF$solidjsweb.createComponent((0, $87d7574e1d89d69b$export$82eafebb825fc23f), {}));
3631
+ }), _el$19, _co$6);
3564
3632
  $gVhhF$solidjsweb.effect(_p$ => {
3565
3633
  var _v$ = i18n_.search_field_field_aria_label_(),
3566
- _v$2 = i18n_.placeholder_text_(),
3567
- _v$3 = i18n_.clear_filters_query_sorting_after_submit_(),
3568
- _v$4 = $gVhhF$solidjs.createMemo(() => search_field_value_[0]() ? "" : "display: none")();
3569
- _v$ !== _p$.e && $gVhhF$solidjsweb.setAttribute(_el$4, "aria-label", _p$.e = _v$);
3570
- _v$2 !== _p$.t && $gVhhF$solidjsweb.setAttribute(_el$4, "placeholder", _p$.t = _v$2);
3571
- _v$3 !== _p$.a && $gVhhF$solidjsweb.setAttribute(_el$5, "title", _p$.a = _v$3);
3572
- _p$.o = $gVhhF$solidjsweb.style(_el$5, _v$4, _p$.o);
3634
+ _v$2 = i18n_.placeholder_text_();
3635
+ _v$ !== _p$.e && $gVhhF$solidjsweb.setAttribute(_el$6, "aria-label", _p$.e = _v$);
3636
+ _v$2 !== _p$.t && $gVhhF$solidjsweb.setAttribute(_el$6, "placeholder", _p$.t = _v$2);
3573
3637
  return _p$;
3574
3638
  }, {
3575
3639
  e: undefined,
3576
- t: undefined,
3577
- a: undefined,
3578
- o: undefined
3640
+ t: undefined
3579
3641
  });
3580
- $gVhhF$solidjsweb.effect(() => $gVhhF$solidjsweb.setProperty(_el$4, "value", search_field_value_[0]()));
3642
+ $gVhhF$solidjsweb.effect(() => $gVhhF$solidjsweb.setProperty(_el$6, "value", searchFieldValue()));
3581
3643
  $gVhhF$solidjsweb.runHydrationEvents();
3582
- return _el$;
3644
+ return _el$3;
3583
3645
  })();
3584
3646
  }
3585
3647
  $gVhhF$solidjsweb.delegateEvents(["click", "keydown", "input", "pointerdown"]);
@@ -3759,7 +3821,7 @@ function $44f0b2e312a9b710$var$RawClassicSearchModal({
3759
3821
  };
3760
3822
  });
3761
3823
  const search_field = $66b8b9a9613c141d$export$b94867ecbd698f21({
3762
- BackIcon_: () => $gVhhF$solidjsweb.createComponent((0, $610b584d4f54699e$export$8d8893ffd8aca39a), {}),
3824
+ BackIcon_: (0, $610b584d4f54699e$export$8d8893ffd8aca39a),
3763
3825
  input_field_ref_: element => set_input_field(element),
3764
3826
  override_on_enter_: e => on_enter_in_search_field_function?.(e),
3765
3827
  on_back_: close_modal_,
@@ -3775,7 +3837,6 @@ function $44f0b2e312a9b710$var$RawClassicSearchModal({
3775
3837
  input_el.setSelectionRange(start, end);
3776
3838
  }
3777
3839
  });
3778
- search_field.classList.add("in-modal");
3779
3840
  const modal_element = (() => {
3780
3841
  var _el$4 = $gVhhF$solidjsweb.getNextElement($44f0b2e312a9b710$var$_tmpl$3),
3781
3842
  _el$5 = _el$4.firstChild,
@@ -4999,7 +5060,7 @@ function $11597ae03e703a47$var$RawSearchModalV2({
4999
5060
  return _el$7;
5000
5061
  })();
5001
5062
  const search_field = $66b8b9a9613c141d$export$b94867ecbd698f21({
5002
- BackIcon_: () => $gVhhF$solidjsweb.createComponent((0, $b8660a70353e03cf$export$11e9f390c90a537f), {}),
5063
+ BackIcon_: (0, $b8660a70353e03cf$export$11e9f390c90a537f),
5003
5064
  input_field_ref_: element => set_input_field(element),
5004
5065
  override_on_enter_: e => on_enter_in_search_field_function?.(e),
5005
5066
  on_back_: close_modal_,
@@ -5015,7 +5076,6 @@ function $11597ae03e703a47$var$RawSearchModalV2({
5015
5076
  input_el.setSelectionRange(start, end);
5016
5077
  }
5017
5078
  });
5018
- search_field.classList.add("in-modal");
5019
5079
  if (setSearchFieldOuterWidth_) {
5020
5080
  const resizeObserver = new ResizeObserver($gVhhF$depictaiutilishared.catchify(records => setSearchFieldOuterWidth_(records.at(-1).contentRect.width)));
5021
5081
  resizeObserver.observe(search_field);
@@ -12805,7 +12865,7 @@ function $5cbaffcb5602e671$export$44f738469d5570cf({
12805
12865
  const closeDuration_ = pxOffCenter > 100 ? 150 : 100;
12806
12866
  setPollAlignment_(true);
12807
12867
  // Fade out submit button so there aren't two overlapping buttons for a split second
12808
- submitButton_.animate([{
12868
+ submitButton_?.animate([{
12809
12869
  opacity: 1
12810
12870
  }, {
12811
12871
  opacity: 0
@@ -12887,7 +12947,7 @@ function $5cbaffcb5602e671$export$44f738469d5570cf({
12887
12947
  duration: closeDuration_,
12888
12948
  fill: "forwards",
12889
12949
  easing: "ease-out"
12890
- }).finished, submitButton_.animate([{
12950
+ }).finished, submitButton_?.animate([{
12891
12951
  opacity: 0
12892
12952
  }, {
12893
12953
  opacity: 1