@depict-ai/ui 4.9.2 → 4.9.3

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
@@ -109,7 +109,7 @@ $parcel$export(module.exports, "BreadCrumbs", () => $1f4925833f07df29$export$5b7
109
109
  $parcel$export(module.exports, "QuickLinks", () => $1f4925833f07df29$export$de035477d6fef996);
110
110
  $parcel$export(module.exports, "CategoryPage", () => $14f289047713d67a$export$e2bf8ce7779e827e);
111
111
  /*! Depict.ai search and product listing SDK */
112
- const $b757f75811f3261f$export$83d89fbfd8236492 = "4.9.2";
112
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "4.9.3";
113
113
  function $b54e6192d0caa293$export$d9f36cf74e24d595(media_query) {
114
114
  const signal = $gVhhF$solidjs.createSignal(false);
115
115
  $gVhhF$solidjs.onCleanup($gVhhF$depictaiutilishared.javascript_media_query(media_query, ({
@@ -10480,7 +10480,7 @@ var $66b8b9a9613c141d$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<but
10480
10480
  $66b8b9a9613c141d$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button type=button class=clear>`),
10481
10481
  $66b8b9a9613c141d$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=spacer>`),
10482
10482
  $66b8b9a9613c141d$var$_tmpl$4 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button class="submit major"type=button>`),
10483
- $66b8b9a9613c141d$var$_tmpl$5 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div role=search><!$><!/><!$><!/><div class=field><!$><!/><input class=query tabindex=0 enterkeyhint=search><!$><!/></div><!$><!/><!$><!/>`);
10483
+ $66b8b9a9613c141d$var$_tmpl$5 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div><!$><!/><!$><!/><div class=field><!$><!/><input class=query tabindex=0 enterkeyhint=search><!$><!/></div><!$><!/><!$><!/>`);
10484
10484
  function $66b8b9a9613c141d$export$b94867ecbd698f21({
10485
10485
  search_field_value_: [searchFieldValue, setSearchFieldValue],
10486
10486
  input_field_ref_: input_field_ref_,
@@ -10494,7 +10494,8 @@ function $66b8b9a9613c141d$export$b94867ecbd698f21({
10494
10494
  after_focusing_: after_focusing_,
10495
10495
  BackIcon_: BackIcon_,
10496
10496
  buttonInFieldRef_: buttonInFieldRef_,
10497
- class_: class_
10497
+ class_: class_,
10498
+ setSearchRoleOnContainer_ = true
10498
10499
  }) {
10499
10500
  let input_element;
10500
10501
  // This is the div where we recommend (and ourselves do) attach the event listener to that opens the search modal.
@@ -10590,6 +10591,13 @@ function $66b8b9a9613c141d$export$b94867ecbd698f21({
10590
10591
  [_el$17, _co$5] = $gVhhF$solidjsweb.getNextMarker(_el$16.nextSibling),
10591
10592
  _el$18 = _el$17.nextSibling,
10592
10593
  [_el$19, _co$6] = $gVhhF$solidjsweb.getNextMarker(_el$18.nextSibling);
10594
+ $gVhhF$solidjsweb.spread(_el$3, $gVhhF$solidjsweb.mergeProps({
10595
+ get ["class"]() {
10596
+ return `search-field${on_back_ ? " in-modal" : ""}${class_?.() ? ` ${class_()}` : ""}`;
10597
+ }
10598
+ }, setSearchRoleOnContainer_ && {
10599
+ role: "search"
10600
+ }), false, true);
10593
10601
  $gVhhF$solidjsweb.insert(_el$3, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
10594
10602
  get when() {
10595
10603
  return getBackButtonWidth() !== undefined && on_back_;
@@ -10630,59 +10638,79 @@ function $66b8b9a9613c141d$export$b94867ecbd698f21({
10630
10638
  }
10631
10639
  }), true);
10632
10640
  $gVhhF$solidjsweb.insert(_el$5, isNewModal && $gVhhF$solidjsweb.createComponent(ClearButton, {}), _el$8, _co$);
10633
- _el$6.$$pointerdown = ({
10634
- pointerType: pointerType
10635
- }) => {
10636
- // 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).
10637
- if (pointerType === "mouse") {
10638
- const handler = $gVhhF$depictaiutilishared.catchify(({
10639
- pointerType: pointerType,
10640
- target: target
10641
- }) => {
10642
- if (pointerType !== "mouse" || !(target instanceof Node) || target === field_div || field_div.contains(target)) return;
10643
- input_element.click();
10644
- });
10645
- window.addEventListener("pointerup", handler, {
10646
- once: true
10647
- });
10648
- $gVhhF$solidjs.runWithOwner(owner_of_field_element, () => $gVhhF$solidjs.onCleanup(() => window.removeEventListener("pointerup", handler)));
10649
- }
10650
- };
10651
- $gVhhF$solidjsweb.addEventListener(_el$6, "select", $gVhhF$depictaiutilishared.catchify(() => {
10652
- if (disabled_)
10653
- // 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
10654
- return;
10655
- if (input_element.selectionStart === 0 && input_element.selectionEnd === input_element.value.length)
10656
- // everything was selected, clear filters on next submit on next input
10657
- input_element.addEventListener("input", $gVhhF$depictaiutilishared.catchify(() => clear_filters_(false)),
10658
- // We don't count this as user triggered since it wasn't explicit
10659
- {
10660
- once: true
10661
- });
10662
- }));
10663
- $gVhhF$solidjsweb.addEventListener(_el$6, "input", $gVhhF$depictaiutilishared.catchify(() => {
10664
- const {
10665
- value: value
10666
- } = input_element;
10667
- if (!disabled_ && !value.length) clear_filters_(false); // if the user clears the whole field, reset filters on next submit
10668
- setSearchFieldValue(value);
10669
- }), true);
10670
- $gVhhF$solidjsweb.addEventListener(_el$6, "keydown", $gVhhF$depictaiutilishared.catchify(e => {
10671
- if (disabled_) {
10672
- if (e.key !== "Tab" && e.key !== "Shift")
10673
- // 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
10674
- input_element.click();
10675
- } else if (e.key === "Enter") {
10676
- const dont_submit = override_on_enter_?.(e);
10677
- if (!dont_submit) submit_query_();
10678
- }
10679
- }), true);
10680
10641
  var _ref$2 = $gVhhF$depictaiutilishared.catchify(el => {
10681
10642
  input_element = el;
10682
10643
  input_field_ref_?.(el);
10683
10644
  });
10684
10645
  typeof _ref$2 === "function" && $gVhhF$solidjsweb.use(_ref$2, _el$6);
10685
10646
  _el$6.classList.toggle("has-adjacent-back-button", !!!!on_back_);
10647
+ $gVhhF$solidjsweb.spread(_el$6, $gVhhF$solidjsweb.mergeProps(() => setSearchRoleOnContainer_ ? {
10648
+ "aria-label": i18n_.search_field_field_aria_label_()
10649
+ } :
10650
+ // Searchbox announces basically the same as our aria-label, we could explore always using searchbox in the future
10651
+ {
10652
+ role: "searchbox"
10653
+ }, {
10654
+ get value() {
10655
+ return searchFieldValue();
10656
+ },
10657
+ get onKeyDown() {
10658
+ return $gVhhF$depictaiutilishared.catchify(e => {
10659
+ if (disabled_) {
10660
+ if (e.key !== "Tab" && e.key !== "Shift")
10661
+ // 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
10662
+ input_element.click();
10663
+ } else if (e.key === "Enter") {
10664
+ const dont_submit = override_on_enter_?.(e);
10665
+ if (!dont_submit) submit_query_();
10666
+ }
10667
+ });
10668
+ },
10669
+ get onInput() {
10670
+ return $gVhhF$depictaiutilishared.catchify(() => {
10671
+ const {
10672
+ value: value
10673
+ } = input_element;
10674
+ if (!disabled_ && !value.length) clear_filters_(false); // if the user clears the whole field, reset filters on next submit
10675
+ setSearchFieldValue(value);
10676
+ });
10677
+ },
10678
+ get onSelect() {
10679
+ return $gVhhF$depictaiutilishared.catchify(() => {
10680
+ if (disabled_)
10681
+ // 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
10682
+ return;
10683
+ if (input_element.selectionStart === 0 && input_element.selectionEnd === input_element.value.length)
10684
+ // everything was selected, clear filters on next submit on next input
10685
+ input_element.addEventListener("input", $gVhhF$depictaiutilishared.catchify(() => clear_filters_(false)),
10686
+ // We don't count this as user triggered since it wasn't explicit
10687
+ {
10688
+ once: true
10689
+ });
10690
+ });
10691
+ },
10692
+ "onPointerDown": ({
10693
+ pointerType: pointerType
10694
+ }) => {
10695
+ // 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).
10696
+ if (pointerType === "mouse") {
10697
+ const handler = $gVhhF$depictaiutilishared.catchify(({
10698
+ pointerType: pointerType,
10699
+ target: target
10700
+ }) => {
10701
+ if (pointerType !== "mouse" || !(target instanceof Node) || target === field_div || field_div.contains(target)) return;
10702
+ input_element.click();
10703
+ });
10704
+ window.addEventListener("pointerup", handler, {
10705
+ once: true
10706
+ });
10707
+ $gVhhF$solidjs.runWithOwner(owner_of_field_element, () => $gVhhF$solidjs.onCleanup(() => window.removeEventListener("pointerup", handler)));
10708
+ }
10709
+ },
10710
+ get placeholder() {
10711
+ return i18n_.placeholder_text_();
10712
+ }
10713
+ }), false, false);
10686
10714
  $gVhhF$solidjsweb.insert(_el$5, !isNewModal && $gVhhF$solidjsweb.createComponent(ClearButton, {}), _el$10, _co$2);
10687
10715
  $gVhhF$solidjsweb.insert(_el$3, isNewModal && $gVhhF$solidjsweb.createComponent(BackButton, {}), _el$17, _co$5);
10688
10716
  $gVhhF$solidjsweb.insert(_el$3, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
@@ -10696,25 +10724,11 @@ function $66b8b9a9613c141d$export$b94867ecbd698f21({
10696
10724
  return _el$11;
10697
10725
  }
10698
10726
  }), _el$19, _co$6);
10699
- $gVhhF$solidjsweb.effect(_p$ => {
10700
- var _v$ = `search-field${on_back_ ? " in-modal" : ""}${class_?.() ? ` ${class_()}` : ""}`,
10701
- _v$2 = i18n_.search_field_field_aria_label_(),
10702
- _v$3 = i18n_.placeholder_text_();
10703
- _v$ !== _p$.e && $gVhhF$solidjsweb.className(_el$3, _p$.e = _v$);
10704
- _v$2 !== _p$.t && $gVhhF$solidjsweb.setAttribute(_el$6, "aria-label", _p$.t = _v$2);
10705
- _v$3 !== _p$.a && $gVhhF$solidjsweb.setAttribute(_el$6, "placeholder", _p$.a = _v$3);
10706
- return _p$;
10707
- }, {
10708
- e: undefined,
10709
- t: undefined,
10710
- a: undefined
10711
- });
10712
- $gVhhF$solidjsweb.effect(() => $gVhhF$solidjsweb.setProperty(_el$6, "value", searchFieldValue()));
10713
10727
  $gVhhF$solidjsweb.runHydrationEvents();
10714
10728
  return _el$3;
10715
10729
  })();
10716
10730
  }
10717
- $gVhhF$solidjsweb.delegateEvents(["click", "keydown", "input", "pointerdown"]);
10731
+ $gVhhF$solidjsweb.delegateEvents(["click"]);
10718
10732
  var $610b584d4f54699e$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<svg xmlns=http://www.w3.org/2000/svg width=24 height=16><path d="M.773 7.371L7.98.176C8.098.059 8.238 0 8.402 0s.305.059.422.176S9 .434 9 .598s-.059.305-.176.422L2.648 7.195h19.547a.59.59 0 0 1 .609.609c0 .172-.059.305-.176.422s-.262.176-.434.176H2.648l6.176 6.176a.59.59 0 0 1 .176.426c0 .16-.059.301-.176.422-.055.059-.121.109-.199.137s-.148.039-.223.039-.156-.012-.234-.039a.54.54 0 0 1-.187-.137L.773 8.227c-.117-.117-.176-.258-.176-.422a.6.6 0 0 1 .176-.434zm0 0">`);
10719
10733
  function $610b584d4f54699e$export$8d8893ffd8aca39a() {
10720
10734
  return $gVhhF$solidjsweb.getNextElement($610b584d4f54699e$var$_tmpl$);
@@ -10744,7 +10758,7 @@ function $eb3039a27db40508$export$93d9bfd0c9c1a5b8(close_modal, search_query_url
10744
10758
  }
10745
10759
  var $44f0b2e312a9b710$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=discover-more><button class=major type=button>`),
10746
10760
  $44f0b2e312a9b710$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<b>`),
10747
- $44f0b2e312a9b710$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=depict-search-modal><div class=body><!$><!/><div class=padded><!$><!/><!$><!/><!$><!/></div><!$><!/></div><!$><!/>`),
10761
+ $44f0b2e312a9b710$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=depict-search-modal><div class=body role=search><!$><!/><div class=padded><!$><!/><!$><!/><!$><!/></div><!$><!/></div><!$><!/>`),
10748
10762
  $44f0b2e312a9b710$var$_tmpl$4 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="depict plp search"><div class=depict-search-modal-backdrop></div><!$><!/>`);
10749
10763
  /**
10750
10764
  * First generation (classic) search modal - the solid component that gets added to <body> when the search modal is opened
@@ -10887,7 +10901,8 @@ function $44f0b2e312a9b710$var$RawClassicSearchModal({
10887
10901
  const [start, end] = selected_text_range_;
10888
10902
  if (start === null || end === null) return;
10889
10903
  input_el.setSelectionRange(start, end);
10890
- }
10904
+ },
10905
+ setSearchRoleOnContainer_: false
10891
10906
  });
10892
10907
  const modal_element = (() => {
10893
10908
  var _el$4 = $gVhhF$solidjsweb.getNextElement($44f0b2e312a9b710$var$_tmpl$3),
@@ -11323,6 +11338,7 @@ function $a13dbcf80d79229c$export$d4994a86c6235f72({
11323
11338
  return urlObject.href;
11324
11339
  });
11325
11340
  const [isSelected, selectedDueToKeyboardNavigation] = $f144ea315d9e4caa$export$fb40a80c530e5f2b(read_selected_index_, itemIndex_, () => index);
11341
+ const wholeTextToDisplay = $gVhhF$solidjs.createMemo(() => item().title_);
11326
11342
  return (() => {
11327
11343
  var _el$7 = $gVhhF$solidjsweb.getNextElement($a13dbcf80d79229c$var$_tmpl$2);
11328
11344
  $gVhhF$solidjsweb.use(element => {
@@ -11347,20 +11363,21 @@ function $a13dbcf80d79229c$export$d4994a86c6235f72({
11347
11363
  $gVhhF$solidjsweb.addEventListener(_el$7, "mouseenter", $gVhhF$depictaiutilishared.catchify(() => write_selected_index_([itemIndex_(), index])));
11348
11364
  $gVhhF$solidjsweb.insert(_el$7, $gVhhF$solidjsweb.createComponent((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
11349
11365
  class_: "title line-clamp",
11350
- get whole_text_to_display_() {
11351
- return $gVhhF$solidjs.createMemo(() => item().title_);
11352
- },
11366
+ whole_text_to_display_: wholeTextToDisplay,
11353
11367
  searching_for_value_: searching_for_value_
11354
11368
  }));
11355
11369
  $gVhhF$solidjsweb.effect(_p$ => {
11356
11370
  var _v$ = !!isSelected(),
11357
- _v$2 = href();
11371
+ _v$2 = href(),
11372
+ _v$3 = wholeTextToDisplay();
11358
11373
  _v$ !== _p$.e && _el$7.classList.toggle("selected", _p$.e = _v$);
11359
11374
  _v$2 !== _p$.t && $gVhhF$solidjsweb.setAttribute(_el$7, "href", _p$.t = _v$2);
11375
+ _v$3 !== _p$.a && $gVhhF$solidjsweb.setAttribute(_el$7, "aria-label", _p$.a = _v$3);
11360
11376
  return _p$;
11361
11377
  }, {
11362
11378
  e: undefined,
11363
- t: undefined
11379
+ t: undefined,
11380
+ a: undefined
11364
11381
  });
11365
11382
  return _el$7;
11366
11383
  })();
@@ -11548,7 +11565,7 @@ var $11597ae03e703a47$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div
11548
11565
  $11597ae03e703a47$var$_tmpl$4 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=discover-more><button class=major type=button>`),
11549
11566
  $11597ae03e703a47$var$_tmpl$5 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<b>`),
11550
11567
  $11597ae03e703a47$var$_tmpl$6 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=depict-search-modal-backdrop>`),
11551
- $11597ae03e703a47$var$_tmpl$7 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=depict-search-modal><div class=body><!$><!/><div class=padded></div></div><!$><!/>`),
11568
+ $11597ae03e703a47$var$_tmpl$7 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=depict-search-modal><div class=body role=search><!$><!/><div class=padded></div></div><!$><!/>`),
11552
11569
  $11597ae03e703a47$var$_tmpl$8 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=left>`),
11553
11570
  $11597ae03e703a47$var$_tmpl$9 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=right>`);
11554
11571
  /**
@@ -11790,6 +11807,9 @@ function $11597ae03e703a47$var$RawSearchModalV2({
11790
11807
  aspectRatio: 1,
11791
11808
  get ["class"]() {
11792
11809
  return props.class_;
11810
+ },
11811
+ imgProps: {
11812
+ alt: "Product image"
11793
11813
  }
11794
11814
  }),
11795
11815
  ...instant_results_options_
@@ -11892,7 +11912,8 @@ function $11597ae03e703a47$var$RawSearchModalV2({
11892
11912
  const [start, end] = selected_text_range_;
11893
11913
  if (start === null || end === null) return;
11894
11914
  input_el.setSelectionRange(start, end);
11895
- }
11915
+ },
11916
+ setSearchRoleOnContainer_: false
11896
11917
  });
11897
11918
  if (setSearchFieldOuterWidth_) {
11898
11919
  const resizeObserver = new ResizeObserver($gVhhF$depictaiutilishared.catchify(records => setSearchFieldOuterWidth_(records.at(-1).contentRect.width)));
package/latest/index.d.ts CHANGED
@@ -11,7 +11,7 @@ import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { FeaturedInDisplay } from "@depict-ai/types/api/FeaturedInResponseV3";
13
13
  import { SearchFilter as _SearchFilter3 } from "@depict-ai/types/api/SearchRequestV2";
14
- export const version = "4.9.2";
14
+ export const version = "4.9.3";
15
15
  /**
16
16
  * Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
17
17
  */
@@ -1539,7 +1539,7 @@ type OpenModalParams<OriginalDisplay extends Display, OutputDisplay extends Mode
1539
1539
  * Open the modal with support for alignment.
1540
1540
  * @returns {void}
1541
1541
  */
1542
- export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends ModernDisplay>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
1542
+ export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends unknown>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
1543
1543
  export function open_search_with_shift_slash(open_search: VoidFunction): () => void;
1544
1544
  export interface PageReplacer {
1545
1545
  readonly render_: () => Node_Array;
@@ -1619,5 +1619,5 @@ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay exte
1619
1619
  layout?: PossibleLayout;
1620
1620
  filterModalParent_?: HTMLElement | ShadowRoot;
1621
1621
  showSliderArrow_?: boolean;
1622
- }): import("@depict-ai/utilishared/latest").Node_Array;
1622
+ }): import("@depict-ai/utilishared").Node_Array;
1623
1623
  export type { SearchFilter } from "@depict-ai/types/api/SearchRequestV3";
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.9.2";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "4.9.3";
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, ({
@@ -10378,7 +10378,7 @@ var $5285d2814d0fac0c$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<button class=b
10378
10378
  $5285d2814d0fac0c$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<button type=button class=clear>`),
10379
10379
  $5285d2814d0fac0c$var$_tmpl$3 = /*#__PURE__*/$9HbP8$template(`<div class=spacer>`),
10380
10380
  $5285d2814d0fac0c$var$_tmpl$4 = /*#__PURE__*/$9HbP8$template(`<button class="submit major"type=button>`),
10381
- $5285d2814d0fac0c$var$_tmpl$5 = /*#__PURE__*/$9HbP8$template(`<div role=search><!$><!/><!$><!/><div class=field><!$><!/><input class=query tabindex=0 enterkeyhint=search><!$><!/></div><!$><!/><!$><!/>`);
10381
+ $5285d2814d0fac0c$var$_tmpl$5 = /*#__PURE__*/$9HbP8$template(`<div><!$><!/><!$><!/><div class=field><!$><!/><input class=query tabindex=0 enterkeyhint=search><!$><!/></div><!$><!/><!$><!/>`);
10382
10382
  function $5285d2814d0fac0c$export$b94867ecbd698f21({
10383
10383
  search_field_value_: [searchFieldValue, setSearchFieldValue],
10384
10384
  input_field_ref_: input_field_ref_,
@@ -10392,7 +10392,8 @@ function $5285d2814d0fac0c$export$b94867ecbd698f21({
10392
10392
  after_focusing_: after_focusing_,
10393
10393
  BackIcon_: BackIcon_,
10394
10394
  buttonInFieldRef_: buttonInFieldRef_,
10395
- class_: class_
10395
+ class_: class_,
10396
+ setSearchRoleOnContainer_ = true
10396
10397
  }) {
10397
10398
  let input_element;
10398
10399
  // This is the div where we recommend (and ourselves do) attach the event listener to that opens the search modal.
@@ -10488,6 +10489,13 @@ function $5285d2814d0fac0c$export$b94867ecbd698f21({
10488
10489
  [_el$17, _co$5] = $9HbP8$getNextMarker(_el$16.nextSibling),
10489
10490
  _el$18 = _el$17.nextSibling,
10490
10491
  [_el$19, _co$6] = $9HbP8$getNextMarker(_el$18.nextSibling);
10492
+ $9HbP8$spread(_el$3, $9HbP8$mergeProps1({
10493
+ get ["class"]() {
10494
+ return `search-field${on_back_ ? " in-modal" : ""}${class_?.() ? ` ${class_()}` : ""}`;
10495
+ }
10496
+ }, setSearchRoleOnContainer_ && {
10497
+ role: "search"
10498
+ }), false, true);
10491
10499
  $9HbP8$insert(_el$3, $9HbP8$createComponent((0, $9HbP8$Show), {
10492
10500
  get when() {
10493
10501
  return getBackButtonWidth() !== undefined && on_back_;
@@ -10528,59 +10536,79 @@ function $5285d2814d0fac0c$export$b94867ecbd698f21({
10528
10536
  }
10529
10537
  }), true);
10530
10538
  $9HbP8$insert(_el$5, isNewModal && $9HbP8$createComponent(ClearButton, {}), _el$8, _co$);
10531
- _el$6.$$pointerdown = ({
10532
- pointerType: pointerType
10533
- }) => {
10534
- // 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).
10535
- if (pointerType === "mouse") {
10536
- const handler = $9HbP8$catchify1(({
10537
- pointerType: pointerType,
10538
- target: target
10539
- }) => {
10540
- if (pointerType !== "mouse" || !(target instanceof Node) || target === field_div || field_div.contains(target)) return;
10541
- input_element.click();
10542
- });
10543
- window.addEventListener("pointerup", handler, {
10544
- once: true
10545
- });
10546
- $9HbP8$runWithOwner(owner_of_field_element, () => $9HbP8$onCleanup(() => window.removeEventListener("pointerup", handler)));
10547
- }
10548
- };
10549
- $9HbP8$addEventListener(_el$6, "select", $9HbP8$catchify1(() => {
10550
- if (disabled_)
10551
- // 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
10552
- return;
10553
- if (input_element.selectionStart === 0 && input_element.selectionEnd === input_element.value.length)
10554
- // everything was selected, clear filters on next submit on next input
10555
- input_element.addEventListener("input", $9HbP8$catchify1(() => clear_filters_(false)),
10556
- // We don't count this as user triggered since it wasn't explicit
10557
- {
10558
- once: true
10559
- });
10560
- }));
10561
- $9HbP8$addEventListener(_el$6, "input", $9HbP8$catchify1(() => {
10562
- const {
10563
- value: value
10564
- } = input_element;
10565
- if (!disabled_ && !value.length) clear_filters_(false); // if the user clears the whole field, reset filters on next submit
10566
- setSearchFieldValue(value);
10567
- }), true);
10568
- $9HbP8$addEventListener(_el$6, "keydown", $9HbP8$catchify1(e => {
10569
- if (disabled_) {
10570
- if (e.key !== "Tab" && e.key !== "Shift")
10571
- // 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
10572
- input_element.click();
10573
- } else if (e.key === "Enter") {
10574
- const dont_submit = override_on_enter_?.(e);
10575
- if (!dont_submit) submit_query_();
10576
- }
10577
- }), true);
10578
10539
  var _ref$2 = $9HbP8$catchify1(el => {
10579
10540
  input_element = el;
10580
10541
  input_field_ref_?.(el);
10581
10542
  });
10582
10543
  typeof _ref$2 === "function" && $9HbP8$use(_ref$2, _el$6);
10583
10544
  _el$6.classList.toggle("has-adjacent-back-button", !!!!on_back_);
10545
+ $9HbP8$spread(_el$6, $9HbP8$mergeProps1(() => setSearchRoleOnContainer_ ? {
10546
+ "aria-label": i18n_.search_field_field_aria_label_()
10547
+ } :
10548
+ // Searchbox announces basically the same as our aria-label, we could explore always using searchbox in the future
10549
+ {
10550
+ role: "searchbox"
10551
+ }, {
10552
+ get value() {
10553
+ return searchFieldValue();
10554
+ },
10555
+ get onKeyDown() {
10556
+ return $9HbP8$catchify1(e => {
10557
+ if (disabled_) {
10558
+ if (e.key !== "Tab" && e.key !== "Shift")
10559
+ // 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
10560
+ input_element.click();
10561
+ } else if (e.key === "Enter") {
10562
+ const dont_submit = override_on_enter_?.(e);
10563
+ if (!dont_submit) submit_query_();
10564
+ }
10565
+ });
10566
+ },
10567
+ get onInput() {
10568
+ return $9HbP8$catchify1(() => {
10569
+ const {
10570
+ value: value
10571
+ } = input_element;
10572
+ if (!disabled_ && !value.length) clear_filters_(false); // if the user clears the whole field, reset filters on next submit
10573
+ setSearchFieldValue(value);
10574
+ });
10575
+ },
10576
+ get onSelect() {
10577
+ return $9HbP8$catchify1(() => {
10578
+ if (disabled_)
10579
+ // 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
10580
+ return;
10581
+ if (input_element.selectionStart === 0 && input_element.selectionEnd === input_element.value.length)
10582
+ // everything was selected, clear filters on next submit on next input
10583
+ input_element.addEventListener("input", $9HbP8$catchify1(() => clear_filters_(false)),
10584
+ // We don't count this as user triggered since it wasn't explicit
10585
+ {
10586
+ once: true
10587
+ });
10588
+ });
10589
+ },
10590
+ "onPointerDown": ({
10591
+ pointerType: pointerType
10592
+ }) => {
10593
+ // 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).
10594
+ if (pointerType === "mouse") {
10595
+ const handler = $9HbP8$catchify1(({
10596
+ pointerType: pointerType,
10597
+ target: target
10598
+ }) => {
10599
+ if (pointerType !== "mouse" || !(target instanceof Node) || target === field_div || field_div.contains(target)) return;
10600
+ input_element.click();
10601
+ });
10602
+ window.addEventListener("pointerup", handler, {
10603
+ once: true
10604
+ });
10605
+ $9HbP8$runWithOwner(owner_of_field_element, () => $9HbP8$onCleanup(() => window.removeEventListener("pointerup", handler)));
10606
+ }
10607
+ },
10608
+ get placeholder() {
10609
+ return i18n_.placeholder_text_();
10610
+ }
10611
+ }), false, false);
10584
10612
  $9HbP8$insert(_el$5, !isNewModal && $9HbP8$createComponent(ClearButton, {}), _el$10, _co$2);
10585
10613
  $9HbP8$insert(_el$3, isNewModal && $9HbP8$createComponent(BackButton, {}), _el$17, _co$5);
10586
10614
  $9HbP8$insert(_el$3, $9HbP8$createComponent((0, $9HbP8$Show), {
@@ -10594,25 +10622,11 @@ function $5285d2814d0fac0c$export$b94867ecbd698f21({
10594
10622
  return _el$11;
10595
10623
  }
10596
10624
  }), _el$19, _co$6);
10597
- $9HbP8$effect(_p$ => {
10598
- var _v$ = `search-field${on_back_ ? " in-modal" : ""}${class_?.() ? ` ${class_()}` : ""}`,
10599
- _v$2 = i18n_.search_field_field_aria_label_(),
10600
- _v$3 = i18n_.placeholder_text_();
10601
- _v$ !== _p$.e && $9HbP8$className(_el$3, _p$.e = _v$);
10602
- _v$2 !== _p$.t && $9HbP8$setAttribute(_el$6, "aria-label", _p$.t = _v$2);
10603
- _v$3 !== _p$.a && $9HbP8$setAttribute(_el$6, "placeholder", _p$.a = _v$3);
10604
- return _p$;
10605
- }, {
10606
- e: undefined,
10607
- t: undefined,
10608
- a: undefined
10609
- });
10610
- $9HbP8$effect(() => $9HbP8$setProperty(_el$6, "value", searchFieldValue()));
10611
10625
  $9HbP8$runHydrationEvents();
10612
10626
  return _el$3;
10613
10627
  })();
10614
10628
  }
10615
- $9HbP8$delegateEvents(["click", "keydown", "input", "pointerdown"]);
10629
+ $9HbP8$delegateEvents(["click"]);
10616
10630
  var $ffb84ffbf4014982$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<svg xmlns=http://www.w3.org/2000/svg width=24 height=16><path d="M.773 7.371L7.98.176C8.098.059 8.238 0 8.402 0s.305.059.422.176S9 .434 9 .598s-.059.305-.176.422L2.648 7.195h19.547a.59.59 0 0 1 .609.609c0 .172-.059.305-.176.422s-.262.176-.434.176H2.648l6.176 6.176a.59.59 0 0 1 .176.426c0 .16-.059.301-.176.422-.055.059-.121.109-.199.137s-.148.039-.223.039-.156-.012-.234-.039a.54.54 0 0 1-.187-.137L.773 8.227c-.117-.117-.176-.258-.176-.422a.6.6 0 0 1 .176-.434zm0 0">`);
10617
10631
  function $ffb84ffbf4014982$export$8d8893ffd8aca39a() {
10618
10632
  return $9HbP8$getNextElement($ffb84ffbf4014982$var$_tmpl$);
@@ -10642,7 +10656,7 @@ function $512b994d501f412b$export$93d9bfd0c9c1a5b8(close_modal, search_query_url
10642
10656
  }
10643
10657
  var $42912431795f188e$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class=discover-more><button class=major type=button>`),
10644
10658
  $42912431795f188e$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<b>`),
10645
- $42912431795f188e$var$_tmpl$3 = /*#__PURE__*/$9HbP8$template(`<div class=depict-search-modal><div class=body><!$><!/><div class=padded><!$><!/><!$><!/><!$><!/></div><!$><!/></div><!$><!/>`),
10659
+ $42912431795f188e$var$_tmpl$3 = /*#__PURE__*/$9HbP8$template(`<div class=depict-search-modal><div class=body role=search><!$><!/><div class=padded><!$><!/><!$><!/><!$><!/></div><!$><!/></div><!$><!/>`),
10646
10660
  $42912431795f188e$var$_tmpl$4 = /*#__PURE__*/$9HbP8$template(`<div class="depict plp search"><div class=depict-search-modal-backdrop></div><!$><!/>`);
10647
10661
  /**
10648
10662
  * First generation (classic) search modal - the solid component that gets added to <body> when the search modal is opened
@@ -10785,7 +10799,8 @@ function $42912431795f188e$var$RawClassicSearchModal({
10785
10799
  const [start, end] = selected_text_range_;
10786
10800
  if (start === null || end === null) return;
10787
10801
  input_el.setSelectionRange(start, end);
10788
- }
10802
+ },
10803
+ setSearchRoleOnContainer_: false
10789
10804
  });
10790
10805
  const modal_element = (() => {
10791
10806
  var _el$4 = $9HbP8$getNextElement($42912431795f188e$var$_tmpl$3),
@@ -11221,6 +11236,7 @@ function $903297121898e5ff$export$d4994a86c6235f72({
11221
11236
  return urlObject.href;
11222
11237
  });
11223
11238
  const [isSelected, selectedDueToKeyboardNavigation] = $f4125ce4984deee6$export$fb40a80c530e5f2b(read_selected_index_, itemIndex_, () => index);
11239
+ const wholeTextToDisplay = $9HbP8$createMemo(() => item().title_);
11224
11240
  return (() => {
11225
11241
  var _el$7 = $9HbP8$getNextElement($903297121898e5ff$var$_tmpl$2);
11226
11242
  $9HbP8$use(element => {
@@ -11245,20 +11261,21 @@ function $903297121898e5ff$export$d4994a86c6235f72({
11245
11261
  $9HbP8$addEventListener(_el$7, "mouseenter", $9HbP8$catchify1(() => write_selected_index_([itemIndex_(), index])));
11246
11262
  $9HbP8$insert(_el$7, $9HbP8$createComponent((0, $f3213c0640246d58$export$ba17c5b7e6dda39f), {
11247
11263
  class_: "title line-clamp",
11248
- get whole_text_to_display_() {
11249
- return $9HbP8$createMemo(() => item().title_);
11250
- },
11264
+ whole_text_to_display_: wholeTextToDisplay,
11251
11265
  searching_for_value_: searching_for_value_
11252
11266
  }));
11253
11267
  $9HbP8$effect(_p$ => {
11254
11268
  var _v$ = !!isSelected(),
11255
- _v$2 = href();
11269
+ _v$2 = href(),
11270
+ _v$3 = wholeTextToDisplay();
11256
11271
  _v$ !== _p$.e && _el$7.classList.toggle("selected", _p$.e = _v$);
11257
11272
  _v$2 !== _p$.t && $9HbP8$setAttribute(_el$7, "href", _p$.t = _v$2);
11273
+ _v$3 !== _p$.a && $9HbP8$setAttribute(_el$7, "aria-label", _p$.a = _v$3);
11258
11274
  return _p$;
11259
11275
  }, {
11260
11276
  e: undefined,
11261
- t: undefined
11277
+ t: undefined,
11278
+ a: undefined
11262
11279
  });
11263
11280
  return _el$7;
11264
11281
  })();
@@ -11446,7 +11463,7 @@ var $500a16dd18ee5a71$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class=inst
11446
11463
  $500a16dd18ee5a71$var$_tmpl$4 = /*#__PURE__*/$9HbP8$template(`<div class=discover-more><button class=major type=button>`),
11447
11464
  $500a16dd18ee5a71$var$_tmpl$5 = /*#__PURE__*/$9HbP8$template(`<b>`),
11448
11465
  $500a16dd18ee5a71$var$_tmpl$6 = /*#__PURE__*/$9HbP8$template(`<div class=depict-search-modal-backdrop>`),
11449
- $500a16dd18ee5a71$var$_tmpl$7 = /*#__PURE__*/$9HbP8$template(`<div class=depict-search-modal><div class=body><!$><!/><div class=padded></div></div><!$><!/>`),
11466
+ $500a16dd18ee5a71$var$_tmpl$7 = /*#__PURE__*/$9HbP8$template(`<div class=depict-search-modal><div class=body role=search><!$><!/><div class=padded></div></div><!$><!/>`),
11450
11467
  $500a16dd18ee5a71$var$_tmpl$8 = /*#__PURE__*/$9HbP8$template(`<div class=left>`),
11451
11468
  $500a16dd18ee5a71$var$_tmpl$9 = /*#__PURE__*/$9HbP8$template(`<div class=right>`);
11452
11469
  /**
@@ -11688,6 +11705,9 @@ function $500a16dd18ee5a71$var$RawSearchModalV2({
11688
11705
  aspectRatio: 1,
11689
11706
  get ["class"]() {
11690
11707
  return props.class_;
11708
+ },
11709
+ imgProps: {
11710
+ alt: "Product image"
11691
11711
  }
11692
11712
  }),
11693
11713
  ...instant_results_options_
@@ -11790,7 +11810,8 @@ function $500a16dd18ee5a71$var$RawSearchModalV2({
11790
11810
  const [start, end] = selected_text_range_;
11791
11811
  if (start === null || end === null) return;
11792
11812
  input_el.setSelectionRange(start, end);
11793
- }
11813
+ },
11814
+ setSearchRoleOnContainer_: false
11794
11815
  });
11795
11816
  if (setSearchFieldOuterWidth_) {
11796
11817
  const resizeObserver = new ResizeObserver($9HbP8$catchify1(records => setSearchFieldOuterWidth_(records.at(-1).contentRect.width)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/ui",
3
- "version": "4.9.2",
3
+ "version": "4.9.3",
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",