@depict-ai/ui 4.3.14 → 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/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.14";
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++) {
@@ -3411,9 +3411,12 @@ let $0b6e2070a98de347$export$44dad306455dddf;
3411
3411
  DEPICT_ID["PLP_CATEGORY"] = "depict-plp-category";
3412
3412
  })($0b6e2070a98de347$export$44dad306455dddf || ($0b6e2070a98de347$export$44dad306455dddf = {}));
3413
3413
  var $66b8b9a9613c141d$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button class=back type=button>`),
3414
- $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><!$><!/><!$><!/>`);
3415
3418
  function $66b8b9a9613c141d$export$b94867ecbd698f21({
3416
- search_field_value_: search_field_value_,
3419
+ search_field_value_: [searchFieldValue, setSearchFieldValue],
3417
3420
  input_field_ref_: input_field_ref_,
3418
3421
  field_element_ref_: field_element_ref_,
3419
3422
  submit_query_: submit_query_,
@@ -3438,30 +3441,102 @@ function $66b8b9a9613c141d$export$b94867ecbd698f21({
3438
3441
  })); // focus field on render
3439
3442
  const owner_of_field_element = $gVhhF$solidjs.getOwner();
3440
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
+ })();
3441
3507
  return (() => {
3442
- var _el$ = $gVhhF$solidjsweb.getNextElement($66b8b9a9613c141d$var$_tmpl$2),
3443
- _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,
3444
3515
  [_el$8, _co$] = $gVhhF$solidjsweb.getNextMarker(_el$7.nextSibling),
3445
- _el$3 = _el$8.nextSibling,
3446
- _el$4 = _el$3.firstChild,
3447
- _el$5 = _el$4.nextSibling,
3448
- _el$6 = _el$3.nextSibling;
3449
- $gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
3450
- 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
+ },
3451
3528
  get children() {
3452
- var _el$2 = $gVhhF$solidjsweb.getNextElement($66b8b9a9613c141d$var$_tmpl$);
3453
- $gVhhF$solidjsweb.addEventListener(_el$2, "click", $gVhhF$depictaiutilishared.catchify(on_back_), true);
3454
- $gVhhF$solidjsweb.insert(_el$2, $gVhhF$solidjsweb.createComponent(BackIcon_, {}));
3455
- $gVhhF$solidjsweb.effect(() => $gVhhF$solidjsweb.setAttribute(_el$2, "aria-label", i18n_.back_()));
3456
- $gVhhF$solidjsweb.runHydrationEvents();
3457
- 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;
3458
3532
  }
3459
- }), _el$8, _co$);
3533
+ }), _el$13, _co$3);
3534
+ $gVhhF$solidjsweb.insert(_el$3, !isNewModal && $gVhhF$solidjsweb.createComponent(BackButton, {}), _el$15, _co$4);
3460
3535
  $gVhhF$solidjsweb.use(el => {
3461
3536
  field_div = el;
3462
3537
  field_element_ref_?.(el);
3463
- }, _el$3);
3464
- $gVhhF$solidjsweb.addEventListener(_el$3, "click", $gVhhF$depictaiutilishared.catchify(({
3538
+ }, _el$5);
3539
+ $gVhhF$solidjsweb.addEventListener(_el$5, "click", $gVhhF$depictaiutilishared.catchify(({
3465
3540
  target: target,
3466
3541
  currentTarget: currentTarget,
3467
3542
  detail: detail
@@ -3485,7 +3560,8 @@ function $66b8b9a9613c141d$export$b94867ecbd698f21({
3485
3560
  }
3486
3561
  }
3487
3562
  }), true);
3488
- _el$4.$$pointerdown = ({
3563
+ $gVhhF$solidjsweb.insert(_el$5, isNewModal && $gVhhF$solidjsweb.createComponent(ClearButton, {}), _el$8, _co$);
3564
+ _el$6.$$pointerdown = ({
3489
3565
  pointerType: pointerType
3490
3566
  }) => {
3491
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).
@@ -3503,7 +3579,7 @@ function $66b8b9a9613c141d$export$b94867ecbd698f21({
3503
3579
  $gVhhF$solidjs.runWithOwner(owner_of_field_element, () => $gVhhF$solidjs.onCleanup(() => window.removeEventListener("pointerup", handler)));
3504
3580
  }
3505
3581
  };
3506
- $gVhhF$solidjsweb.addEventListener(_el$4, "select", $gVhhF$depictaiutilishared.catchify(() => {
3582
+ $gVhhF$solidjsweb.addEventListener(_el$6, "select", $gVhhF$depictaiutilishared.catchify(() => {
3507
3583
  if (disabled_)
3508
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
3509
3585
  return;
@@ -3515,14 +3591,14 @@ function $66b8b9a9613c141d$export$b94867ecbd698f21({
3515
3591
  once: true
3516
3592
  });
3517
3593
  }));
3518
- $gVhhF$solidjsweb.addEventListener(_el$4, "input", $gVhhF$depictaiutilishared.catchify(() => {
3594
+ $gVhhF$solidjsweb.addEventListener(_el$6, "input", $gVhhF$depictaiutilishared.catchify(() => {
3519
3595
  const {
3520
3596
  value: value
3521
3597
  } = input_element;
3522
3598
  if (!disabled_ && !value.length) clear_filters_(false); // if the user clears the whole field, reset filters on next submit
3523
- search_field_value_[1](value);
3599
+ setSearchFieldValue(value);
3524
3600
  }), true);
3525
- $gVhhF$solidjsweb.addEventListener(_el$4, "keydown", $gVhhF$depictaiutilishared.catchify(e => {
3601
+ $gVhhF$solidjsweb.addEventListener(_el$6, "keydown", $gVhhF$depictaiutilishared.catchify(e => {
3526
3602
  if (disabled_) {
3527
3603
  if (e.key !== "Tab" && e.key !== "Shift")
3528
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
@@ -3536,45 +3612,36 @@ function $66b8b9a9613c141d$export$b94867ecbd698f21({
3536
3612
  input_element = el;
3537
3613
  input_field_ref_?.(el);
3538
3614
  });
3539
- typeof _ref$ === "function" && $gVhhF$solidjsweb.use(_ref$, _el$4);
3540
- _el$4.classList.toggle("has-adjacent-back-button", !!!!on_back_);
3541
- $gVhhF$solidjsweb.addEventListener(_el$5, "click", $gVhhF$depictaiutilishared.catchify(() => {
3542
- search_field_value_[1]("");
3543
- clear_filters_(true);
3544
- if (!disabled_) input_element.focus();
3545
- }), true);
3546
- $gVhhF$solidjsweb.insert(_el$5, $gVhhF$solidjsweb.createComponent((0, $c77c68e559a1506c$export$3b621d86b1566b2), {}));
3547
- var _ref$2 = submit_button_ref_;
3548
- typeof _ref$2 === "function" ? $gVhhF$solidjsweb.use(_ref$2, _el$6) : submit_button_ref_ = _el$6;
3549
- $gVhhF$solidjsweb.spread(_el$6, $gVhhF$solidjsweb.mergeProps({
3550
- get onClick() {
3551
- 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;
3552
3630
  }
3553
- }, () => isNewModal ? {
3554
- tabindex: "-1"
3555
- } : {
3556
- "aria-label": i18n_.search_submit_button_aria_label_()
3557
- }), false, true);
3558
- $gVhhF$solidjsweb.insert(_el$6, $gVhhF$solidjsweb.createComponent((0, $87d7574e1d89d69b$export$82eafebb825fc23f), {}));
3631
+ }), _el$19, _co$6);
3559
3632
  $gVhhF$solidjsweb.effect(_p$ => {
3560
3633
  var _v$ = i18n_.search_field_field_aria_label_(),
3561
- _v$2 = i18n_.placeholder_text_(),
3562
- _v$3 = i18n_.clear_filters_query_sorting_after_submit_(),
3563
- _v$4 = $gVhhF$solidjs.createMemo(() => search_field_value_[0]() ? "" : "display: none")();
3564
- _v$ !== _p$.e && $gVhhF$solidjsweb.setAttribute(_el$4, "aria-label", _p$.e = _v$);
3565
- _v$2 !== _p$.t && $gVhhF$solidjsweb.setAttribute(_el$4, "placeholder", _p$.t = _v$2);
3566
- _v$3 !== _p$.a && $gVhhF$solidjsweb.setAttribute(_el$5, "title", _p$.a = _v$3);
3567
- _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);
3568
3637
  return _p$;
3569
3638
  }, {
3570
3639
  e: undefined,
3571
- t: undefined,
3572
- a: undefined,
3573
- o: undefined
3640
+ t: undefined
3574
3641
  });
3575
- $gVhhF$solidjsweb.effect(() => $gVhhF$solidjsweb.setProperty(_el$4, "value", search_field_value_[0]()));
3642
+ $gVhhF$solidjsweb.effect(() => $gVhhF$solidjsweb.setProperty(_el$6, "value", searchFieldValue()));
3576
3643
  $gVhhF$solidjsweb.runHydrationEvents();
3577
- return _el$;
3644
+ return _el$3;
3578
3645
  })();
3579
3646
  }
3580
3647
  $gVhhF$solidjsweb.delegateEvents(["click", "keydown", "input", "pointerdown"]);
@@ -3754,7 +3821,7 @@ function $44f0b2e312a9b710$var$RawClassicSearchModal({
3754
3821
  };
3755
3822
  });
3756
3823
  const search_field = $66b8b9a9613c141d$export$b94867ecbd698f21({
3757
- BackIcon_: () => $gVhhF$solidjsweb.createComponent((0, $610b584d4f54699e$export$8d8893ffd8aca39a), {}),
3824
+ BackIcon_: (0, $610b584d4f54699e$export$8d8893ffd8aca39a),
3758
3825
  input_field_ref_: element => set_input_field(element),
3759
3826
  override_on_enter_: e => on_enter_in_search_field_function?.(e),
3760
3827
  on_back_: close_modal_,
@@ -3770,7 +3837,6 @@ function $44f0b2e312a9b710$var$RawClassicSearchModal({
3770
3837
  input_el.setSelectionRange(start, end);
3771
3838
  }
3772
3839
  });
3773
- search_field.classList.add("in-modal");
3774
3840
  const modal_element = (() => {
3775
3841
  var _el$4 = $gVhhF$solidjsweb.getNextElement($44f0b2e312a9b710$var$_tmpl$3),
3776
3842
  _el$5 = _el$4.firstChild,
@@ -4994,7 +5060,7 @@ function $11597ae03e703a47$var$RawSearchModalV2({
4994
5060
  return _el$7;
4995
5061
  })();
4996
5062
  const search_field = $66b8b9a9613c141d$export$b94867ecbd698f21({
4997
- BackIcon_: () => $gVhhF$solidjsweb.createComponent((0, $b8660a70353e03cf$export$11e9f390c90a537f), {}),
5063
+ BackIcon_: (0, $b8660a70353e03cf$export$11e9f390c90a537f),
4998
5064
  input_field_ref_: element => set_input_field(element),
4999
5065
  override_on_enter_: e => on_enter_in_search_field_function?.(e),
5000
5066
  on_back_: close_modal_,
@@ -5010,7 +5076,6 @@ function $11597ae03e703a47$var$RawSearchModalV2({
5010
5076
  input_el.setSelectionRange(start, end);
5011
5077
  }
5012
5078
  });
5013
- search_field.classList.add("in-modal");
5014
5079
  if (setSearchFieldOuterWidth_) {
5015
5080
  const resizeObserver = new ResizeObserver($gVhhF$depictaiutilishared.catchify(records => setSearchFieldOuterWidth_(records.at(-1).contentRect.width)));
5016
5081
  resizeObserver.observe(search_field);
@@ -12800,7 +12865,7 @@ function $5cbaffcb5602e671$export$44f738469d5570cf({
12800
12865
  const closeDuration_ = pxOffCenter > 100 ? 150 : 100;
12801
12866
  setPollAlignment_(true);
12802
12867
  // Fade out submit button so there aren't two overlapping buttons for a split second
12803
- submitButton_.animate([{
12868
+ submitButton_?.animate([{
12804
12869
  opacity: 1
12805
12870
  }, {
12806
12871
  opacity: 0
@@ -12882,7 +12947,7 @@ function $5cbaffcb5602e671$export$44f738469d5570cf({
12882
12947
  duration: closeDuration_,
12883
12948
  fill: "forwards",
12884
12949
  easing: "ease-out"
12885
- }).finished, submitButton_.animate([{
12950
+ }).finished, submitButton_?.animate([{
12886
12951
  opacity: 0
12887
12952
  }, {
12888
12953
  opacity: 1
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 _SearchFilter3 } from "@depict-ai/types/api/SearchRequestV2";
13
- export const version = "4.3.14";
13
+ export const version = "4.4.0";
14
14
  declare const LISTING_ID = "listingId";
15
15
  declare const EXTERNAL_ID = "externalId";
16
16
  type ScrollRestorationData = {
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.3.14";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "4.4.0";
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++) {
@@ -3324,9 +3324,12 @@ let $f86ba724282f6690$export$44dad306455dddf;
3324
3324
  DEPICT_ID["PLP_CATEGORY"] = "depict-plp-category";
3325
3325
  })($f86ba724282f6690$export$44dad306455dddf || ($f86ba724282f6690$export$44dad306455dddf = {}));
3326
3326
  var $5285d2814d0fac0c$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<button class=back type=button>`),
3327
- $5285d2814d0fac0c$var$_tmpl$2 = /*#__PURE__*/$9HbP8$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>`);
3327
+ $5285d2814d0fac0c$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<button type=button class=clear>`),
3328
+ $5285d2814d0fac0c$var$_tmpl$3 = /*#__PURE__*/$9HbP8$template(`<div class=spacer>`),
3329
+ $5285d2814d0fac0c$var$_tmpl$4 = /*#__PURE__*/$9HbP8$template(`<button class="submit major"type=button>`),
3330
+ $5285d2814d0fac0c$var$_tmpl$5 = /*#__PURE__*/$9HbP8$template(`<div class=search-field role=search><!$><!/><!$><!/><div class=field><!$><!/><input class=query tabindex=0><!$><!/></div><!$><!/><!$><!/>`);
3328
3331
  function $5285d2814d0fac0c$export$b94867ecbd698f21({
3329
- search_field_value_: search_field_value_,
3332
+ search_field_value_: [searchFieldValue, setSearchFieldValue],
3330
3333
  input_field_ref_: input_field_ref_,
3331
3334
  field_element_ref_: field_element_ref_,
3332
3335
  submit_query_: submit_query_,
@@ -3351,30 +3354,102 @@ function $5285d2814d0fac0c$export$b94867ecbd698f21({
3351
3354
  })); // focus field on render
3352
3355
  const owner_of_field_element = $9HbP8$getOwner();
3353
3356
  const isNewModal = BackIcon_[(0, $66db7a014e20802e$export$1ea76ea778b880dd)] === 2;
3357
+ const [backButtonWidthAccessor, setBackButtonWidthAccessor] = $9HbP8$createSignal();
3358
+ const getBackButtonWidth = () => backButtonWidthAccessor()?.();
3359
+ const searchFieldEmpty = $9HbP8$createMemo(() => !searchFieldValue());
3360
+ const BackButton = () => $9HbP8$createComponent((0, $9HbP8$Show), {
3361
+ when: on_back_,
3362
+ get children() {
3363
+ var _el$ = $9HbP8$getNextElement($5285d2814d0fac0c$var$_tmpl$);
3364
+ $9HbP8$spread(_el$, $9HbP8$mergeProps({
3365
+ get onClick() {
3366
+ return $9HbP8$catchify(on_back_);
3367
+ },
3368
+ get ["aria-label"]() {
3369
+ return i18n_.back_();
3370
+ }
3371
+ }, isNewModal && {
3372
+ ref: el => {
3373
+ setBackButtonWidthAccessor(() => $2449872a62a75a20$export$ebdc3711f7e02ccd(el));
3374
+ $9HbP8$onCleanup(() => setBackButtonWidthAccessor());
3375
+ }
3376
+ }), false, true);
3377
+ $9HbP8$insert(_el$, isNewModal ? $9HbP8$createComponent((0, $19976a74d273070d$export$3b621d86b1566b2), {}) : $9HbP8$createComponent(BackIcon_, {}));
3378
+ $9HbP8$runHydrationEvents();
3379
+ return _el$;
3380
+ }
3381
+ });
3382
+ const ClearButton = () => (() => {
3383
+ var _el$2 = $9HbP8$getNextElement($5285d2814d0fac0c$var$_tmpl$2);
3384
+ $9HbP8$spread(_el$2, $9HbP8$mergeProps({
3385
+ get classList() {
3386
+ return {
3387
+ empty: searchFieldEmpty()
3388
+ };
3389
+ },
3390
+ get style() {
3391
+ return isNewModal || !searchFieldEmpty() ? "" : "display: none";
3392
+ },
3393
+ get onClick() {
3394
+ return $9HbP8$catchify(() => {
3395
+ if (isNewModal && searchFieldEmpty()) return;
3396
+ setSearchFieldValue("");
3397
+ clear_filters_(true);
3398
+ if (!disabled_) input_element.focus();
3399
+ });
3400
+ }
3401
+ }, () => searchFieldEmpty() ? {
3402
+ "aria-hidden": "true"
3403
+ } : {
3404
+ title: i18n_.clear_filters_query_sorting_after_submit_()
3405
+ }), false, true);
3406
+ $9HbP8$insert(_el$2, isNewModal ? $9HbP8$createComponent((0, $9HbP8$Show), {
3407
+ get when() {
3408
+ return !searchFieldEmpty();
3409
+ },
3410
+ get fallback() {
3411
+ return $9HbP8$createComponent((0, $16f0ed5ea30d8d9c$export$82eafebb825fc23f), {});
3412
+ },
3413
+ get children() {
3414
+ return $9HbP8$createComponent(BackIcon_, {});
3415
+ }
3416
+ }) : $9HbP8$createComponent((0, $19976a74d273070d$export$3b621d86b1566b2), {}));
3417
+ $9HbP8$runHydrationEvents();
3418
+ return _el$2;
3419
+ })();
3354
3420
  return (() => {
3355
- var _el$ = $9HbP8$getNextElement($5285d2814d0fac0c$var$_tmpl$2),
3356
- _el$7 = _el$.firstChild,
3421
+ var _el$3 = $9HbP8$getNextElement($5285d2814d0fac0c$var$_tmpl$5),
3422
+ _el$12 = _el$3.firstChild,
3423
+ [_el$13, _co$3] = $9HbP8$getNextMarker(_el$12.nextSibling),
3424
+ _el$14 = _el$13.nextSibling,
3425
+ [_el$15, _co$4] = $9HbP8$getNextMarker(_el$14.nextSibling),
3426
+ _el$5 = _el$15.nextSibling,
3427
+ _el$7 = _el$5.firstChild,
3357
3428
  [_el$8, _co$] = $9HbP8$getNextMarker(_el$7.nextSibling),
3358
- _el$3 = _el$8.nextSibling,
3359
- _el$4 = _el$3.firstChild,
3360
- _el$5 = _el$4.nextSibling,
3361
- _el$6 = _el$3.nextSibling;
3362
- $9HbP8$insert(_el$, $9HbP8$createComponent((0, $9HbP8$Show), {
3363
- when: on_back_,
3429
+ _el$6 = _el$8.nextSibling,
3430
+ _el$9 = _el$6.nextSibling,
3431
+ [_el$10, _co$2] = $9HbP8$getNextMarker(_el$9.nextSibling),
3432
+ _el$16 = _el$5.nextSibling,
3433
+ [_el$17, _co$5] = $9HbP8$getNextMarker(_el$16.nextSibling),
3434
+ _el$18 = _el$17.nextSibling,
3435
+ [_el$19, _co$6] = $9HbP8$getNextMarker(_el$18.nextSibling);
3436
+ _el$3.classList.toggle("in-modal", !!!!on_back_);
3437
+ $9HbP8$insert(_el$3, $9HbP8$createComponent((0, $9HbP8$Show), {
3438
+ get when() {
3439
+ return getBackButtonWidth() !== undefined && on_back_;
3440
+ },
3364
3441
  get children() {
3365
- var _el$2 = $9HbP8$getNextElement($5285d2814d0fac0c$var$_tmpl$);
3366
- $9HbP8$addEventListener(_el$2, "click", $9HbP8$catchify(on_back_), true);
3367
- $9HbP8$insert(_el$2, $9HbP8$createComponent(BackIcon_, {}));
3368
- $9HbP8$effect(() => $9HbP8$setAttribute(_el$2, "aria-label", i18n_.back_()));
3369
- $9HbP8$runHydrationEvents();
3370
- return _el$2;
3442
+ var _el$4 = $9HbP8$getNextElement($5285d2814d0fac0c$var$_tmpl$3);
3443
+ $9HbP8$effect(() => (getBackButtonWidth(), _el$4.style.setProperty("width", getBackButtonWidth() + "px")));
3444
+ return _el$4;
3371
3445
  }
3372
- }), _el$8, _co$);
3446
+ }), _el$13, _co$3);
3447
+ $9HbP8$insert(_el$3, !isNewModal && $9HbP8$createComponent(BackButton, {}), _el$15, _co$4);
3373
3448
  $9HbP8$use(el => {
3374
3449
  field_div = el;
3375
3450
  field_element_ref_?.(el);
3376
- }, _el$3);
3377
- $9HbP8$addEventListener(_el$3, "click", $9HbP8$catchify(({
3451
+ }, _el$5);
3452
+ $9HbP8$addEventListener(_el$5, "click", $9HbP8$catchify(({
3378
3453
  target: target,
3379
3454
  currentTarget: currentTarget,
3380
3455
  detail: detail
@@ -3398,7 +3473,8 @@ function $5285d2814d0fac0c$export$b94867ecbd698f21({
3398
3473
  }
3399
3474
  }
3400
3475
  }), true);
3401
- _el$4.$$pointerdown = ({
3476
+ $9HbP8$insert(_el$5, isNewModal && $9HbP8$createComponent(ClearButton, {}), _el$8, _co$);
3477
+ _el$6.$$pointerdown = ({
3402
3478
  pointerType: pointerType
3403
3479
  }) => {
3404
3480
  // 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).
@@ -3416,7 +3492,7 @@ function $5285d2814d0fac0c$export$b94867ecbd698f21({
3416
3492
  $9HbP8$runWithOwner(owner_of_field_element, () => $9HbP8$onCleanup(() => window.removeEventListener("pointerup", handler)));
3417
3493
  }
3418
3494
  };
3419
- $9HbP8$addEventListener(_el$4, "select", $9HbP8$catchify(() => {
3495
+ $9HbP8$addEventListener(_el$6, "select", $9HbP8$catchify(() => {
3420
3496
  if (disabled_)
3421
3497
  // 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
3422
3498
  return;
@@ -3428,14 +3504,14 @@ function $5285d2814d0fac0c$export$b94867ecbd698f21({
3428
3504
  once: true
3429
3505
  });
3430
3506
  }));
3431
- $9HbP8$addEventListener(_el$4, "input", $9HbP8$catchify(() => {
3507
+ $9HbP8$addEventListener(_el$6, "input", $9HbP8$catchify(() => {
3432
3508
  const {
3433
3509
  value: value
3434
3510
  } = input_element;
3435
3511
  if (!disabled_ && !value.length) clear_filters_(false); // if the user clears the whole field, reset filters on next submit
3436
- search_field_value_[1](value);
3512
+ setSearchFieldValue(value);
3437
3513
  }), true);
3438
- $9HbP8$addEventListener(_el$4, "keydown", $9HbP8$catchify(e => {
3514
+ $9HbP8$addEventListener(_el$6, "keydown", $9HbP8$catchify(e => {
3439
3515
  if (disabled_) {
3440
3516
  if (e.key !== "Tab" && e.key !== "Shift")
3441
3517
  // 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
@@ -3449,45 +3525,36 @@ function $5285d2814d0fac0c$export$b94867ecbd698f21({
3449
3525
  input_element = el;
3450
3526
  input_field_ref_?.(el);
3451
3527
  });
3452
- typeof _ref$ === "function" && $9HbP8$use(_ref$, _el$4);
3453
- _el$4.classList.toggle("has-adjacent-back-button", !!!!on_back_);
3454
- $9HbP8$addEventListener(_el$5, "click", $9HbP8$catchify(() => {
3455
- search_field_value_[1]("");
3456
- clear_filters_(true);
3457
- if (!disabled_) input_element.focus();
3458
- }), true);
3459
- $9HbP8$insert(_el$5, $9HbP8$createComponent((0, $19976a74d273070d$export$3b621d86b1566b2), {}));
3460
- var _ref$2 = submit_button_ref_;
3461
- typeof _ref$2 === "function" ? $9HbP8$use(_ref$2, _el$6) : submit_button_ref_ = _el$6;
3462
- $9HbP8$spread(_el$6, $9HbP8$mergeProps({
3463
- get onClick() {
3464
- return $9HbP8$catchify(() => submit_query_());
3528
+ typeof _ref$ === "function" && $9HbP8$use(_ref$, _el$6);
3529
+ _el$6.classList.toggle("has-adjacent-back-button", !!!!on_back_);
3530
+ $9HbP8$insert(_el$5, !isNewModal && $9HbP8$createComponent(ClearButton, {}), _el$10, _co$2);
3531
+ $9HbP8$insert(_el$3, isNewModal && $9HbP8$createComponent(BackButton, {}), _el$17, _co$5);
3532
+ $9HbP8$insert(_el$3, $9HbP8$createComponent((0, $9HbP8$Show), {
3533
+ when: !isNewModal,
3534
+ get children() {
3535
+ var _el$11 = $9HbP8$getNextElement($5285d2814d0fac0c$var$_tmpl$4);
3536
+ $9HbP8$addEventListener(_el$11, "click", $9HbP8$catchify(() => submit_query_()), true);
3537
+ var _ref$2 = submit_button_ref_;
3538
+ typeof _ref$2 === "function" ? $9HbP8$use(_ref$2, _el$11) : submit_button_ref_ = _el$11;
3539
+ $9HbP8$insert(_el$11, $9HbP8$createComponent((0, $16f0ed5ea30d8d9c$export$82eafebb825fc23f), {}));
3540
+ $9HbP8$effect(() => $9HbP8$setAttribute(_el$11, "aria-label", i18n_.search_submit_button_aria_label_()));
3541
+ $9HbP8$runHydrationEvents();
3542
+ return _el$11;
3465
3543
  }
3466
- }, () => isNewModal ? {
3467
- tabindex: "-1"
3468
- } : {
3469
- "aria-label": i18n_.search_submit_button_aria_label_()
3470
- }), false, true);
3471
- $9HbP8$insert(_el$6, $9HbP8$createComponent((0, $16f0ed5ea30d8d9c$export$82eafebb825fc23f), {}));
3544
+ }), _el$19, _co$6);
3472
3545
  $9HbP8$effect(_p$ => {
3473
3546
  var _v$ = i18n_.search_field_field_aria_label_(),
3474
- _v$2 = i18n_.placeholder_text_(),
3475
- _v$3 = i18n_.clear_filters_query_sorting_after_submit_(),
3476
- _v$4 = $9HbP8$createMemo(() => search_field_value_[0]() ? "" : "display: none")();
3477
- _v$ !== _p$.e && $9HbP8$setAttribute(_el$4, "aria-label", _p$.e = _v$);
3478
- _v$2 !== _p$.t && $9HbP8$setAttribute(_el$4, "placeholder", _p$.t = _v$2);
3479
- _v$3 !== _p$.a && $9HbP8$setAttribute(_el$5, "title", _p$.a = _v$3);
3480
- _p$.o = $9HbP8$style(_el$5, _v$4, _p$.o);
3547
+ _v$2 = i18n_.placeholder_text_();
3548
+ _v$ !== _p$.e && $9HbP8$setAttribute(_el$6, "aria-label", _p$.e = _v$);
3549
+ _v$2 !== _p$.t && $9HbP8$setAttribute(_el$6, "placeholder", _p$.t = _v$2);
3481
3550
  return _p$;
3482
3551
  }, {
3483
3552
  e: undefined,
3484
- t: undefined,
3485
- a: undefined,
3486
- o: undefined
3553
+ t: undefined
3487
3554
  });
3488
- $9HbP8$effect(() => $9HbP8$setProperty(_el$4, "value", search_field_value_[0]()));
3555
+ $9HbP8$effect(() => $9HbP8$setProperty(_el$6, "value", searchFieldValue()));
3489
3556
  $9HbP8$runHydrationEvents();
3490
- return _el$;
3557
+ return _el$3;
3491
3558
  })();
3492
3559
  }
3493
3560
  $9HbP8$delegateEvents(["click", "keydown", "input", "pointerdown"]);
@@ -3667,7 +3734,7 @@ function $42912431795f188e$var$RawClassicSearchModal({
3667
3734
  };
3668
3735
  });
3669
3736
  const search_field = $5285d2814d0fac0c$export$b94867ecbd698f21({
3670
- BackIcon_: () => $9HbP8$createComponent((0, $ffb84ffbf4014982$export$8d8893ffd8aca39a), {}),
3737
+ BackIcon_: (0, $ffb84ffbf4014982$export$8d8893ffd8aca39a),
3671
3738
  input_field_ref_: element => set_input_field(element),
3672
3739
  override_on_enter_: e => on_enter_in_search_field_function?.(e),
3673
3740
  on_back_: close_modal_,
@@ -3683,7 +3750,6 @@ function $42912431795f188e$var$RawClassicSearchModal({
3683
3750
  input_el.setSelectionRange(start, end);
3684
3751
  }
3685
3752
  });
3686
- search_field.classList.add("in-modal");
3687
3753
  const modal_element = (() => {
3688
3754
  var _el$4 = $9HbP8$getNextElement($42912431795f188e$var$_tmpl$3),
3689
3755
  _el$5 = _el$4.firstChild,
@@ -4907,7 +4973,7 @@ function $500a16dd18ee5a71$var$RawSearchModalV2({
4907
4973
  return _el$7;
4908
4974
  })();
4909
4975
  const search_field = $5285d2814d0fac0c$export$b94867ecbd698f21({
4910
- BackIcon_: () => $9HbP8$createComponent((0, $5cec65dd06ade2c4$export$11e9f390c90a537f), {}),
4976
+ BackIcon_: (0, $5cec65dd06ade2c4$export$11e9f390c90a537f),
4911
4977
  input_field_ref_: element => set_input_field(element),
4912
4978
  override_on_enter_: e => on_enter_in_search_field_function?.(e),
4913
4979
  on_back_: close_modal_,
@@ -4923,7 +4989,6 @@ function $500a16dd18ee5a71$var$RawSearchModalV2({
4923
4989
  input_el.setSelectionRange(start, end);
4924
4990
  }
4925
4991
  });
4926
- search_field.classList.add("in-modal");
4927
4992
  if (setSearchFieldOuterWidth_) {
4928
4993
  const resizeObserver = new ResizeObserver($9HbP8$catchify(records => setSearchFieldOuterWidth_(records.at(-1).contentRect.width)));
4929
4994
  resizeObserver.observe(search_field);
@@ -12713,7 +12778,7 @@ function $0e562a5b247b1fc2$export$44f738469d5570cf({
12713
12778
  const closeDuration_ = pxOffCenter > 100 ? 150 : 100;
12714
12779
  setPollAlignment_(true);
12715
12780
  // Fade out submit button so there aren't two overlapping buttons for a split second
12716
- submitButton_.animate([{
12781
+ submitButton_?.animate([{
12717
12782
  opacity: 1
12718
12783
  }, {
12719
12784
  opacity: 0
@@ -12795,7 +12860,7 @@ function $0e562a5b247b1fc2$export$44f738469d5570cf({
12795
12860
  duration: closeDuration_,
12796
12861
  fill: "forwards",
12797
12862
  easing: "ease-out"
12798
- }).finished, submitButton_.animate([{
12863
+ }).finished, submitButton_?.animate([{
12799
12864
  opacity: 0
12800
12865
  }, {
12801
12866
  opacity: 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/ui",
3
- "version": "4.3.14",
3
+ "version": "4.4.0",
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": "^4.0.4",
239
+ "@depict-ai/plp-styling": "^4.1.0",
240
240
  "@depict-ai/types": "^5.1.2",
241
241
  "@depict-ai/utilishared": "^2.1.2",
242
242
  "solid-js": "^1.8.12"