@depict-ai/ui 4.9.2 → 4.9.4

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 $8tj43$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpe
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.9.2";
13
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "4.9.4";
14
14
  function $00a5b94f0c11efbb$export$d9f36cf74e24d595(media_query) {
15
15
  const signal = $8tj43$createSignal(false);
16
16
  $8tj43$onCleanup($8tj43$javascript_media_query(media_query, _ref => {
@@ -9985,15 +9985,18 @@ const $9a693c7e832d3f18$export$b05c0ae390cf3e06 = _ref => {
9985
9985
  $8tj43$effect(_p$ => {
9986
9986
  var _v$ = href(),
9987
9987
  _v$2 = display_.search_result_id,
9988
- _v$3 = !!(isSelected !== null && isSelected !== void 0 && isSelected());
9988
+ _v$3 = !!(isSelected !== null && isSelected !== void 0 && isSelected()),
9989
+ _v$4 = isSelected === null || isSelected === void 0 ? void 0 : isSelected();
9989
9990
  _v$ !== _p$.e && $8tj43$setAttribute(_el$4, "href", _p$.e = _v$);
9990
9991
  _v$2 !== _p$.t && $8tj43$setAttribute(_el$4, "data-search-result-id", _p$.t = _v$2);
9991
9992
  _v$3 !== _p$.a && _el$4.classList.toggle("selected", _p$.a = _v$3);
9993
+ _v$4 !== _p$.o && $8tj43$setAttribute(_el$4, "aria-selected", _p$.o = _v$4);
9992
9994
  return _p$;
9993
9995
  }, {
9994
9996
  e: undefined,
9995
9997
  t: undefined,
9996
- a: undefined
9998
+ a: undefined,
9999
+ o: undefined
9997
10000
  });
9998
10001
  $8tj43$runHydrationEvents();
9999
10002
  return _el$4;
@@ -10983,7 +10986,7 @@ var $584c06c09cf4609d$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<button class=b
10983
10986
  $584c06c09cf4609d$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<button type=button class=clear>`),
10984
10987
  $584c06c09cf4609d$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<div class=spacer>`),
10985
10988
  $584c06c09cf4609d$var$_tmpl$4 = /*#__PURE__*/$8tj43$template(`<button class="submit major"type=button>`),
10986
- $584c06c09cf4609d$var$_tmpl$5 = /*#__PURE__*/$8tj43$template(`<div role=search><!$><!/><!$><!/><div class=field><!$><!/><input class=query tabindex=0 enterkeyhint=search><!$><!/></div><!$><!/><!$><!/>`);
10989
+ $584c06c09cf4609d$var$_tmpl$5 = /*#__PURE__*/$8tj43$template(`<div><!$><!/><!$><!/><div class=field><!$><!/><input class=query tabindex=0 enterkeyhint=search><!$><!/></div><!$><!/><!$><!/>`);
10987
10990
  function $584c06c09cf4609d$export$b94867ecbd698f21(_ref) {
10988
10991
  let {
10989
10992
  search_field_value_: [searchFieldValue, setSearchFieldValue],
@@ -10998,7 +11001,9 @@ function $584c06c09cf4609d$export$b94867ecbd698f21(_ref) {
10998
11001
  after_focusing_: after_focusing_,
10999
11002
  BackIcon_: BackIcon_,
11000
11003
  buttonInFieldRef_: buttonInFieldRef_,
11001
- class_: class_
11004
+ class_: class_,
11005
+ setSearchRoleOnContainer_ = true,
11006
+ ariaControls: ariaControls
11002
11007
  } = _ref;
11003
11008
  let input_element;
11004
11009
  // This is the div where we recommend (and ourselves do) attach the event listener to that opens the search modal.
@@ -11097,6 +11102,13 @@ function $584c06c09cf4609d$export$b94867ecbd698f21(_ref) {
11097
11102
  [_el$17, _co$5] = $8tj43$getNextMarker(_el$16.nextSibling),
11098
11103
  _el$18 = _el$17.nextSibling,
11099
11104
  [_el$19, _co$6] = $8tj43$getNextMarker(_el$18.nextSibling);
11105
+ $8tj43$spread(_el$3, $8tj43$mergeProps1({
11106
+ get ["class"]() {
11107
+ return "search-field".concat(on_back_ ? " in-modal" : "").concat(class_ !== null && class_ !== void 0 && class_() ? " ".concat(class_()) : "");
11108
+ }
11109
+ }, setSearchRoleOnContainer_ && {
11110
+ role: "search"
11111
+ }), false, true);
11100
11112
  $8tj43$insert(_el$3, $8tj43$createComponent((0, $8tj43$Show), {
11101
11113
  get when() {
11102
11114
  return getBackButtonWidth() !== undefined && on_back_;
@@ -11138,61 +11150,85 @@ function $584c06c09cf4609d$export$b94867ecbd698f21(_ref) {
11138
11150
  }
11139
11151
  }), true);
11140
11152
  $8tj43$insert(_el$5, isNewModal && $8tj43$createComponent(ClearButton, {}), _el$8, _co$);
11141
- _el$6.$$pointerdown = _ref3 => {
11142
- let {
11143
- pointerType: pointerType
11144
- } = _ref3;
11145
- // 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).
11146
- if (pointerType === "mouse") {
11147
- const handler = $8tj43$catchify1(_ref4 => {
11148
- let {
11149
- pointerType: pointerType,
11150
- target: target
11151
- } = _ref4;
11152
- if (pointerType !== "mouse" || !(target instanceof Node) || target === field_div || field_div.contains(target)) return;
11153
- input_element.click();
11154
- });
11155
- window.addEventListener("pointerup", handler, {
11156
- once: true
11157
- });
11158
- $8tj43$runWithOwner(owner_of_field_element, () => $8tj43$onCleanup(() => window.removeEventListener("pointerup", handler)));
11159
- }
11160
- };
11161
- $8tj43$addEventListener(_el$6, "select", $8tj43$catchify1(() => {
11162
- if (disabled_)
11163
- // 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
11164
- return;
11165
- if (input_element.selectionStart === 0 && input_element.selectionEnd === input_element.value.length)
11166
- // everything was selected, clear filters on next submit on next input
11167
- input_element.addEventListener("input", $8tj43$catchify1(() => clear_filters_(false)),
11168
- // We don't count this as user triggered since it wasn't explicit
11169
- {
11170
- once: true
11171
- });
11172
- }));
11173
- $8tj43$addEventListener(_el$6, "input", $8tj43$catchify1(() => {
11174
- const {
11175
- value: value
11176
- } = input_element;
11177
- if (!disabled_ && !value.length) clear_filters_(false); // if the user clears the whole field, reset filters on next submit
11178
- setSearchFieldValue(value);
11179
- }), true);
11180
- $8tj43$addEventListener(_el$6, "keydown", $8tj43$catchify1(e => {
11181
- if (disabled_) {
11182
- if (e.key !== "Tab" && e.key !== "Shift")
11183
- // 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
11184
- input_element.click();
11185
- } else if (e.key === "Enter") {
11186
- const dont_submit = override_on_enter_ === null || override_on_enter_ === void 0 ? void 0 : override_on_enter_(e);
11187
- if (!dont_submit) submit_query_();
11188
- }
11189
- }), true);
11190
11153
  var _ref$2 = $8tj43$catchify1(el => {
11191
11154
  input_element = el;
11192
11155
  input_field_ref_ === null || input_field_ref_ === void 0 || input_field_ref_(el);
11193
11156
  });
11194
11157
  typeof _ref$2 === "function" && $8tj43$use(_ref$2, _el$6);
11195
11158
  _el$6.classList.toggle("has-adjacent-back-button", !!!!on_back_);
11159
+ $8tj43$spread(_el$6, $8tj43$mergeProps1(() => setSearchRoleOnContainer_ ? {
11160
+ "aria-label": i18n_.search_field_field_aria_label_()
11161
+ } :
11162
+ // Searchbox announces basically the same as our aria-label, we could explore always using searchbox in the future
11163
+ {
11164
+ role: "searchbox"
11165
+ }, {
11166
+ get value() {
11167
+ return searchFieldValue();
11168
+ },
11169
+ get onKeyDown() {
11170
+ return $8tj43$catchify1(e => {
11171
+ if (disabled_) {
11172
+ if (e.key !== "Tab" && e.key !== "Shift")
11173
+ // 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
11174
+ input_element.click();
11175
+ } else if (e.key === "Enter") {
11176
+ const dont_submit = override_on_enter_ === null || override_on_enter_ === void 0 ? void 0 : override_on_enter_(e);
11177
+ if (!dont_submit) submit_query_();
11178
+ }
11179
+ });
11180
+ },
11181
+ get onInput() {
11182
+ return $8tj43$catchify1(() => {
11183
+ const {
11184
+ value: value
11185
+ } = input_element;
11186
+ if (!disabled_ && !value.length) clear_filters_(false); // if the user clears the whole field, reset filters on next submit
11187
+ setSearchFieldValue(value);
11188
+ });
11189
+ },
11190
+ get onSelect() {
11191
+ return $8tj43$catchify1(() => {
11192
+ if (disabled_)
11193
+ // 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
11194
+ return;
11195
+ if (input_element.selectionStart === 0 && input_element.selectionEnd === input_element.value.length)
11196
+ // everything was selected, clear filters on next submit on next input
11197
+ input_element.addEventListener("input", $8tj43$catchify1(() => clear_filters_(false)),
11198
+ // We don't count this as user triggered since it wasn't explicit
11199
+ {
11200
+ once: true
11201
+ });
11202
+ });
11203
+ },
11204
+ "onPointerDown": _ref3 => {
11205
+ let {
11206
+ pointerType: pointerType
11207
+ } = _ref3;
11208
+ // 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).
11209
+ if (pointerType === "mouse") {
11210
+ const handler = $8tj43$catchify1(_ref4 => {
11211
+ let {
11212
+ pointerType: pointerType,
11213
+ target: target
11214
+ } = _ref4;
11215
+ if (pointerType !== "mouse" || !(target instanceof Node) || target === field_div || field_div.contains(target)) return;
11216
+ input_element.click();
11217
+ });
11218
+ window.addEventListener("pointerup", handler, {
11219
+ once: true
11220
+ });
11221
+ $8tj43$runWithOwner(owner_of_field_element, () => $8tj43$onCleanup(() => window.removeEventListener("pointerup", handler)));
11222
+ }
11223
+ },
11224
+ get placeholder() {
11225
+ return i18n_.placeholder_text_();
11226
+ },
11227
+ "aria-autocomplete": "list",
11228
+ "aria-haspopup": "dialog"
11229
+ }, ariaControls && {
11230
+ "aria-controls": ariaControls
11231
+ }), false, false);
11196
11232
  $8tj43$insert(_el$5, !isNewModal && $8tj43$createComponent(ClearButton, {}), _el$10, _co$2);
11197
11233
  $8tj43$insert(_el$3, isNewModal && $8tj43$createComponent(BackButton, {}), _el$17, _co$5);
11198
11234
  $8tj43$insert(_el$3, $8tj43$createComponent((0, $8tj43$Show), {
@@ -11206,25 +11242,11 @@ function $584c06c09cf4609d$export$b94867ecbd698f21(_ref) {
11206
11242
  return _el$11;
11207
11243
  }
11208
11244
  }), _el$19, _co$6);
11209
- $8tj43$effect(_p$ => {
11210
- var _v$ = "search-field".concat(on_back_ ? " in-modal" : "").concat(class_ !== null && class_ !== void 0 && class_() ? " ".concat(class_()) : ""),
11211
- _v$2 = i18n_.search_field_field_aria_label_(),
11212
- _v$3 = i18n_.placeholder_text_();
11213
- _v$ !== _p$.e && $8tj43$className(_el$3, _p$.e = _v$);
11214
- _v$2 !== _p$.t && $8tj43$setAttribute(_el$6, "aria-label", _p$.t = _v$2);
11215
- _v$3 !== _p$.a && $8tj43$setAttribute(_el$6, "placeholder", _p$.a = _v$3);
11216
- return _p$;
11217
- }, {
11218
- e: undefined,
11219
- t: undefined,
11220
- a: undefined
11221
- });
11222
- $8tj43$effect(() => $8tj43$setProperty(_el$6, "value", searchFieldValue()));
11223
11245
  $8tj43$runHydrationEvents();
11224
11246
  return _el$3;
11225
11247
  })();
11226
11248
  }
11227
- $8tj43$delegateEvents(["click", "keydown", "input", "pointerdown"]);
11249
+ $8tj43$delegateEvents(["click"]);
11228
11250
  var $fac58b5610eec6a9$var$_tmpl$ = /*#__PURE__*/$8tj43$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">`);
11229
11251
  function $fac58b5610eec6a9$export$8d8893ffd8aca39a() {
11230
11252
  return $8tj43$getNextElement($fac58b5610eec6a9$var$_tmpl$);
@@ -11254,8 +11276,8 @@ function $a82a41ab7188eda2$export$93d9bfd0c9c1a5b8(close_modal, search_query_url
11254
11276
  }
11255
11277
  var $40411f2ec772c376$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class=discover-more><button class=major type=button>`),
11256
11278
  $40411f2ec772c376$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<b>`),
11257
- $40411f2ec772c376$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<div class=depict-search-modal><div class=body><!$><!/><div class=padded><!$><!/><!$><!/><!$><!/></div><!$><!/></div><!$><!/>`),
11258
- $40411f2ec772c376$var$_tmpl$4 = /*#__PURE__*/$8tj43$template(`<div class="depict plp search"><div class=depict-search-modal-backdrop></div><!$><!/>`);
11279
+ $40411f2ec772c376$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<div class=depict-search-modal><div class=body role=search aria-label="Search modal with search field, query suggestions and result preview"><!$><!/><div id=depict-suggestions-and-result-preview class=padded><!$><!/><!$><!/><!$><!/></div><!$><!/></div><!$><!/>`),
11280
+ $40411f2ec772c376$var$_tmpl$4 = /*#__PURE__*/$8tj43$template(`<div class="depict plp search"role=dialog><div class=depict-search-modal-backdrop></div><!$><!/>`);
11259
11281
  /**
11260
11282
  * First generation (classic) search modal - the solid component that gets added to <body> when the search modal is opened
11261
11283
  */
@@ -11403,7 +11425,9 @@ function $40411f2ec772c376$var$RawClassicSearchModal(_ref) {
11403
11425
  const [start, end] = selected_text_range_;
11404
11426
  if (start === null || end === null) return;
11405
11427
  input_el.setSelectionRange(start, end);
11406
- }
11428
+ },
11429
+ setSearchRoleOnContainer_: false,
11430
+ ariaControls: "depict-suggestions-and-result-preview"
11407
11431
  });
11408
11432
  const modal_element = (() => {
11409
11433
  var _el$4 = $8tj43$getNextElement($40411f2ec772c376$var$_tmpl$3),
@@ -11659,7 +11683,16 @@ function $26db6925469636a4$export$67152d26d4f56ee8(_ref) {
11659
11683
  });
11660
11684
  }
11661
11685
  }));
11662
- $8tj43$effect(() => _el$2.classList.toggle("selected", !!isSelected()));
11686
+ $8tj43$effect(_p$ => {
11687
+ var _v$ = !!isSelected(),
11688
+ _v$2 = isSelected();
11689
+ _v$ !== _p$.e && _el$2.classList.toggle("selected", _p$.e = _v$);
11690
+ _v$2 !== _p$.t && $8tj43$setAttribute(_el$2, "aria-selected", _p$.t = _v$2);
11691
+ return _p$;
11692
+ }, {
11693
+ e: undefined,
11694
+ t: undefined
11695
+ });
11663
11696
  $8tj43$runHydrationEvents();
11664
11697
  return _el$2;
11665
11698
  })();
@@ -11863,6 +11896,7 @@ function $5175a47d13b7c228$export$d4994a86c6235f72(_ref) {
11863
11896
  return urlObject.href;
11864
11897
  });
11865
11898
  const [isSelected, selectedDueToKeyboardNavigation] = $d0883254246d3eb6$export$fb40a80c530e5f2b(read_selected_index_, itemIndex_, () => index);
11899
+ const wholeTextToDisplay = $8tj43$createMemo(() => item().title_);
11866
11900
  return (() => {
11867
11901
  var _el$7 = $8tj43$getNextElement($5175a47d13b7c228$var$_tmpl$2);
11868
11902
  $8tj43$use(element => {
@@ -11887,20 +11921,24 @@ function $5175a47d13b7c228$export$d4994a86c6235f72(_ref) {
11887
11921
  $8tj43$addEventListener(_el$7, "mouseenter", $8tj43$catchify1(() => write_selected_index_([itemIndex_(), index])));
11888
11922
  $8tj43$insert(_el$7, $8tj43$createComponent((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
11889
11923
  class_: "title line-clamp",
11890
- get whole_text_to_display_() {
11891
- return $8tj43$createMemo(() => item().title_);
11892
- },
11924
+ whole_text_to_display_: wholeTextToDisplay,
11893
11925
  searching_for_value_: searching_for_value_
11894
11926
  }));
11895
11927
  $8tj43$effect(_p$ => {
11896
11928
  var _v$ = !!isSelected(),
11897
- _v$2 = href();
11929
+ _v$2 = isSelected(),
11930
+ _v$3 = href(),
11931
+ _v$4 = wholeTextToDisplay();
11898
11932
  _v$ !== _p$.e && _el$7.classList.toggle("selected", _p$.e = _v$);
11899
- _v$2 !== _p$.t && $8tj43$setAttribute(_el$7, "href", _p$.t = _v$2);
11933
+ _v$2 !== _p$.t && $8tj43$setAttribute(_el$7, "aria-selected", _p$.t = _v$2);
11934
+ _v$3 !== _p$.a && $8tj43$setAttribute(_el$7, "href", _p$.a = _v$3);
11935
+ _v$4 !== _p$.o && $8tj43$setAttribute(_el$7, "aria-label", _p$.o = _v$4);
11900
11936
  return _p$;
11901
11937
  }, {
11902
11938
  e: undefined,
11903
- t: undefined
11939
+ t: undefined,
11940
+ a: undefined,
11941
+ o: undefined
11904
11942
  });
11905
11943
  return _el$7;
11906
11944
  })();
@@ -12092,7 +12130,7 @@ var $06fcd2a345efd24d$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class=inst
12092
12130
  $06fcd2a345efd24d$var$_tmpl$4 = /*#__PURE__*/$8tj43$template(`<div class=discover-more><button class=major type=button>`),
12093
12131
  $06fcd2a345efd24d$var$_tmpl$5 = /*#__PURE__*/$8tj43$template(`<b>`),
12094
12132
  $06fcd2a345efd24d$var$_tmpl$6 = /*#__PURE__*/$8tj43$template(`<div class=depict-search-modal-backdrop>`),
12095
- $06fcd2a345efd24d$var$_tmpl$7 = /*#__PURE__*/$8tj43$template(`<div class=depict-search-modal><div class=body><!$><!/><div class=padded></div></div><!$><!/>`),
12133
+ $06fcd2a345efd24d$var$_tmpl$7 = /*#__PURE__*/$8tj43$template(`<div class=depict-search-modal><div class=body role=search aria-label="Search modal with search field, query suggestions and result preview"><!$><!/><div id=depict-suggestions-and-result-preview class=padded></div></div><!$><!/>`),
12096
12134
  $06fcd2a345efd24d$var$_tmpl$8 = /*#__PURE__*/$8tj43$template(`<div class=left>`),
12097
12135
  $06fcd2a345efd24d$var$_tmpl$9 = /*#__PURE__*/$8tj43$template(`<div class=right>`);
12098
12136
  /**
@@ -12342,6 +12380,9 @@ function $06fcd2a345efd24d$var$RawSearchModalV2(_ref) {
12342
12380
  aspectRatio: 1,
12343
12381
  get ["class"]() {
12344
12382
  return props.class_;
12383
+ },
12384
+ imgProps: {
12385
+ alt: "Product image"
12345
12386
  }
12346
12387
  }),
12347
12388
  ...instant_results_options_
@@ -12447,7 +12488,9 @@ function $06fcd2a345efd24d$var$RawSearchModalV2(_ref) {
12447
12488
  const [start, end] = selected_text_range_;
12448
12489
  if (start === null || end === null) return;
12449
12490
  input_el.setSelectionRange(start, end);
12450
- }
12491
+ },
12492
+ setSearchRoleOnContainer_: false,
12493
+ ariaControls: "depict-suggestions-and-result-preview"
12451
12494
  });
12452
12495
  if (setSearchFieldOuterWidth_) {
12453
12496
  const resizeObserver = new ResizeObserver($8tj43$catchify1(records => setSearchFieldOuterWidth_(records.at(-1).contentRect.width)));
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.4";
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, ({
@@ -9534,15 +9534,18 @@ const $6ae613870d3380fc$export$b05c0ae390cf3e06 = ({
9534
9534
  $gVhhF$solidjsweb.effect(_p$ => {
9535
9535
  var _v$ = href(),
9536
9536
  _v$2 = display_.search_result_id,
9537
- _v$3 = !!isSelected?.();
9537
+ _v$3 = !!isSelected?.(),
9538
+ _v$4 = isSelected?.();
9538
9539
  _v$ !== _p$.e && $gVhhF$solidjsweb.setAttribute(_el$4, "href", _p$.e = _v$);
9539
9540
  _v$2 !== _p$.t && $gVhhF$solidjsweb.setAttribute(_el$4, "data-search-result-id", _p$.t = _v$2);
9540
9541
  _v$3 !== _p$.a && _el$4.classList.toggle("selected", _p$.a = _v$3);
9542
+ _v$4 !== _p$.o && $gVhhF$solidjsweb.setAttribute(_el$4, "aria-selected", _p$.o = _v$4);
9541
9543
  return _p$;
9542
9544
  }, {
9543
9545
  e: undefined,
9544
9546
  t: undefined,
9545
- a: undefined
9547
+ a: undefined,
9548
+ o: undefined
9546
9549
  });
9547
9550
  $gVhhF$solidjsweb.runHydrationEvents();
9548
9551
  return _el$4;
@@ -10480,7 +10483,7 @@ var $66b8b9a9613c141d$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<but
10480
10483
  $66b8b9a9613c141d$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button type=button class=clear>`),
10481
10484
  $66b8b9a9613c141d$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=spacer>`),
10482
10485
  $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><!$><!/><!$><!/>`);
10486
+ $66b8b9a9613c141d$var$_tmpl$5 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div><!$><!/><!$><!/><div class=field><!$><!/><input class=query tabindex=0 enterkeyhint=search><!$><!/></div><!$><!/><!$><!/>`);
10484
10487
  function $66b8b9a9613c141d$export$b94867ecbd698f21({
10485
10488
  search_field_value_: [searchFieldValue, setSearchFieldValue],
10486
10489
  input_field_ref_: input_field_ref_,
@@ -10494,7 +10497,9 @@ function $66b8b9a9613c141d$export$b94867ecbd698f21({
10494
10497
  after_focusing_: after_focusing_,
10495
10498
  BackIcon_: BackIcon_,
10496
10499
  buttonInFieldRef_: buttonInFieldRef_,
10497
- class_: class_
10500
+ class_: class_,
10501
+ setSearchRoleOnContainer_ = true,
10502
+ ariaControls: ariaControls
10498
10503
  }) {
10499
10504
  let input_element;
10500
10505
  // This is the div where we recommend (and ourselves do) attach the event listener to that opens the search modal.
@@ -10590,6 +10595,13 @@ function $66b8b9a9613c141d$export$b94867ecbd698f21({
10590
10595
  [_el$17, _co$5] = $gVhhF$solidjsweb.getNextMarker(_el$16.nextSibling),
10591
10596
  _el$18 = _el$17.nextSibling,
10592
10597
  [_el$19, _co$6] = $gVhhF$solidjsweb.getNextMarker(_el$18.nextSibling);
10598
+ $gVhhF$solidjsweb.spread(_el$3, $gVhhF$solidjsweb.mergeProps({
10599
+ get ["class"]() {
10600
+ return `search-field${on_back_ ? " in-modal" : ""}${class_?.() ? ` ${class_()}` : ""}`;
10601
+ }
10602
+ }, setSearchRoleOnContainer_ && {
10603
+ role: "search"
10604
+ }), false, true);
10593
10605
  $gVhhF$solidjsweb.insert(_el$3, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
10594
10606
  get when() {
10595
10607
  return getBackButtonWidth() !== undefined && on_back_;
@@ -10630,59 +10642,83 @@ function $66b8b9a9613c141d$export$b94867ecbd698f21({
10630
10642
  }
10631
10643
  }), true);
10632
10644
  $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
10645
  var _ref$2 = $gVhhF$depictaiutilishared.catchify(el => {
10681
10646
  input_element = el;
10682
10647
  input_field_ref_?.(el);
10683
10648
  });
10684
10649
  typeof _ref$2 === "function" && $gVhhF$solidjsweb.use(_ref$2, _el$6);
10685
10650
  _el$6.classList.toggle("has-adjacent-back-button", !!!!on_back_);
10651
+ $gVhhF$solidjsweb.spread(_el$6, $gVhhF$solidjsweb.mergeProps(() => setSearchRoleOnContainer_ ? {
10652
+ "aria-label": i18n_.search_field_field_aria_label_()
10653
+ } :
10654
+ // Searchbox announces basically the same as our aria-label, we could explore always using searchbox in the future
10655
+ {
10656
+ role: "searchbox"
10657
+ }, {
10658
+ get value() {
10659
+ return searchFieldValue();
10660
+ },
10661
+ get onKeyDown() {
10662
+ return $gVhhF$depictaiutilishared.catchify(e => {
10663
+ if (disabled_) {
10664
+ if (e.key !== "Tab" && e.key !== "Shift")
10665
+ // 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
10666
+ input_element.click();
10667
+ } else if (e.key === "Enter") {
10668
+ const dont_submit = override_on_enter_?.(e);
10669
+ if (!dont_submit) submit_query_();
10670
+ }
10671
+ });
10672
+ },
10673
+ get onInput() {
10674
+ return $gVhhF$depictaiutilishared.catchify(() => {
10675
+ const {
10676
+ value: value
10677
+ } = input_element;
10678
+ if (!disabled_ && !value.length) clear_filters_(false); // if the user clears the whole field, reset filters on next submit
10679
+ setSearchFieldValue(value);
10680
+ });
10681
+ },
10682
+ get onSelect() {
10683
+ return $gVhhF$depictaiutilishared.catchify(() => {
10684
+ if (disabled_)
10685
+ // 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
10686
+ return;
10687
+ if (input_element.selectionStart === 0 && input_element.selectionEnd === input_element.value.length)
10688
+ // everything was selected, clear filters on next submit on next input
10689
+ input_element.addEventListener("input", $gVhhF$depictaiutilishared.catchify(() => clear_filters_(false)),
10690
+ // We don't count this as user triggered since it wasn't explicit
10691
+ {
10692
+ once: true
10693
+ });
10694
+ });
10695
+ },
10696
+ "onPointerDown": ({
10697
+ pointerType: pointerType
10698
+ }) => {
10699
+ // 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).
10700
+ if (pointerType === "mouse") {
10701
+ const handler = $gVhhF$depictaiutilishared.catchify(({
10702
+ pointerType: pointerType,
10703
+ target: target
10704
+ }) => {
10705
+ if (pointerType !== "mouse" || !(target instanceof Node) || target === field_div || field_div.contains(target)) return;
10706
+ input_element.click();
10707
+ });
10708
+ window.addEventListener("pointerup", handler, {
10709
+ once: true
10710
+ });
10711
+ $gVhhF$solidjs.runWithOwner(owner_of_field_element, () => $gVhhF$solidjs.onCleanup(() => window.removeEventListener("pointerup", handler)));
10712
+ }
10713
+ },
10714
+ get placeholder() {
10715
+ return i18n_.placeholder_text_();
10716
+ },
10717
+ "aria-autocomplete": "list",
10718
+ "aria-haspopup": "dialog"
10719
+ }, ariaControls && {
10720
+ "aria-controls": ariaControls
10721
+ }), false, false);
10686
10722
  $gVhhF$solidjsweb.insert(_el$5, !isNewModal && $gVhhF$solidjsweb.createComponent(ClearButton, {}), _el$10, _co$2);
10687
10723
  $gVhhF$solidjsweb.insert(_el$3, isNewModal && $gVhhF$solidjsweb.createComponent(BackButton, {}), _el$17, _co$5);
10688
10724
  $gVhhF$solidjsweb.insert(_el$3, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
@@ -10696,25 +10732,11 @@ function $66b8b9a9613c141d$export$b94867ecbd698f21({
10696
10732
  return _el$11;
10697
10733
  }
10698
10734
  }), _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
10735
  $gVhhF$solidjsweb.runHydrationEvents();
10714
10736
  return _el$3;
10715
10737
  })();
10716
10738
  }
10717
- $gVhhF$solidjsweb.delegateEvents(["click", "keydown", "input", "pointerdown"]);
10739
+ $gVhhF$solidjsweb.delegateEvents(["click"]);
10718
10740
  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
10741
  function $610b584d4f54699e$export$8d8893ffd8aca39a() {
10720
10742
  return $gVhhF$solidjsweb.getNextElement($610b584d4f54699e$var$_tmpl$);
@@ -10744,8 +10766,8 @@ function $eb3039a27db40508$export$93d9bfd0c9c1a5b8(close_modal, search_query_url
10744
10766
  }
10745
10767
  var $44f0b2e312a9b710$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=discover-more><button class=major type=button>`),
10746
10768
  $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><!$><!/>`),
10748
- $44f0b2e312a9b710$var$_tmpl$4 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="depict plp search"><div class=depict-search-modal-backdrop></div><!$><!/>`);
10769
+ $44f0b2e312a9b710$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=depict-search-modal><div class=body role=search aria-label="Search modal with search field, query suggestions and result preview"><!$><!/><div id=depict-suggestions-and-result-preview class=padded><!$><!/><!$><!/><!$><!/></div><!$><!/></div><!$><!/>`),
10770
+ $44f0b2e312a9b710$var$_tmpl$4 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="depict plp search"role=dialog><div class=depict-search-modal-backdrop></div><!$><!/>`);
10749
10771
  /**
10750
10772
  * First generation (classic) search modal - the solid component that gets added to <body> when the search modal is opened
10751
10773
  */
@@ -10887,7 +10909,9 @@ function $44f0b2e312a9b710$var$RawClassicSearchModal({
10887
10909
  const [start, end] = selected_text_range_;
10888
10910
  if (start === null || end === null) return;
10889
10911
  input_el.setSelectionRange(start, end);
10890
- }
10912
+ },
10913
+ setSearchRoleOnContainer_: false,
10914
+ ariaControls: "depict-suggestions-and-result-preview"
10891
10915
  });
10892
10916
  const modal_element = (() => {
10893
10917
  var _el$4 = $gVhhF$solidjsweb.getNextElement($44f0b2e312a9b710$var$_tmpl$3),
@@ -11128,7 +11152,16 @@ function $1f3b5fa875714dea$export$67152d26d4f56ee8({
11128
11152
  });
11129
11153
  }
11130
11154
  }));
11131
- $gVhhF$solidjsweb.effect(() => _el$2.classList.toggle("selected", !!isSelected()));
11155
+ $gVhhF$solidjsweb.effect(_p$ => {
11156
+ var _v$ = !!isSelected(),
11157
+ _v$2 = isSelected();
11158
+ _v$ !== _p$.e && _el$2.classList.toggle("selected", _p$.e = _v$);
11159
+ _v$2 !== _p$.t && $gVhhF$solidjsweb.setAttribute(_el$2, "aria-selected", _p$.t = _v$2);
11160
+ return _p$;
11161
+ }, {
11162
+ e: undefined,
11163
+ t: undefined
11164
+ });
11132
11165
  $gVhhF$solidjsweb.runHydrationEvents();
11133
11166
  return _el$2;
11134
11167
  })();
@@ -11323,6 +11356,7 @@ function $a13dbcf80d79229c$export$d4994a86c6235f72({
11323
11356
  return urlObject.href;
11324
11357
  });
11325
11358
  const [isSelected, selectedDueToKeyboardNavigation] = $f144ea315d9e4caa$export$fb40a80c530e5f2b(read_selected_index_, itemIndex_, () => index);
11359
+ const wholeTextToDisplay = $gVhhF$solidjs.createMemo(() => item().title_);
11326
11360
  return (() => {
11327
11361
  var _el$7 = $gVhhF$solidjsweb.getNextElement($a13dbcf80d79229c$var$_tmpl$2);
11328
11362
  $gVhhF$solidjsweb.use(element => {
@@ -11347,20 +11381,24 @@ function $a13dbcf80d79229c$export$d4994a86c6235f72({
11347
11381
  $gVhhF$solidjsweb.addEventListener(_el$7, "mouseenter", $gVhhF$depictaiutilishared.catchify(() => write_selected_index_([itemIndex_(), index])));
11348
11382
  $gVhhF$solidjsweb.insert(_el$7, $gVhhF$solidjsweb.createComponent((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
11349
11383
  class_: "title line-clamp",
11350
- get whole_text_to_display_() {
11351
- return $gVhhF$solidjs.createMemo(() => item().title_);
11352
- },
11384
+ whole_text_to_display_: wholeTextToDisplay,
11353
11385
  searching_for_value_: searching_for_value_
11354
11386
  }));
11355
11387
  $gVhhF$solidjsweb.effect(_p$ => {
11356
11388
  var _v$ = !!isSelected(),
11357
- _v$2 = href();
11389
+ _v$2 = isSelected(),
11390
+ _v$3 = href(),
11391
+ _v$4 = wholeTextToDisplay();
11358
11392
  _v$ !== _p$.e && _el$7.classList.toggle("selected", _p$.e = _v$);
11359
- _v$2 !== _p$.t && $gVhhF$solidjsweb.setAttribute(_el$7, "href", _p$.t = _v$2);
11393
+ _v$2 !== _p$.t && $gVhhF$solidjsweb.setAttribute(_el$7, "aria-selected", _p$.t = _v$2);
11394
+ _v$3 !== _p$.a && $gVhhF$solidjsweb.setAttribute(_el$7, "href", _p$.a = _v$3);
11395
+ _v$4 !== _p$.o && $gVhhF$solidjsweb.setAttribute(_el$7, "aria-label", _p$.o = _v$4);
11360
11396
  return _p$;
11361
11397
  }, {
11362
11398
  e: undefined,
11363
- t: undefined
11399
+ t: undefined,
11400
+ a: undefined,
11401
+ o: undefined
11364
11402
  });
11365
11403
  return _el$7;
11366
11404
  })();
@@ -11548,7 +11586,7 @@ var $11597ae03e703a47$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div
11548
11586
  $11597ae03e703a47$var$_tmpl$4 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=discover-more><button class=major type=button>`),
11549
11587
  $11597ae03e703a47$var$_tmpl$5 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<b>`),
11550
11588
  $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><!$><!/>`),
11589
+ $11597ae03e703a47$var$_tmpl$7 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=depict-search-modal><div class=body role=search aria-label="Search modal with search field, query suggestions and result preview"><!$><!/><div id=depict-suggestions-and-result-preview class=padded></div></div><!$><!/>`),
11552
11590
  $11597ae03e703a47$var$_tmpl$8 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=left>`),
11553
11591
  $11597ae03e703a47$var$_tmpl$9 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=right>`);
11554
11592
  /**
@@ -11790,6 +11828,9 @@ function $11597ae03e703a47$var$RawSearchModalV2({
11790
11828
  aspectRatio: 1,
11791
11829
  get ["class"]() {
11792
11830
  return props.class_;
11831
+ },
11832
+ imgProps: {
11833
+ alt: "Product image"
11793
11834
  }
11794
11835
  }),
11795
11836
  ...instant_results_options_
@@ -11892,7 +11933,9 @@ function $11597ae03e703a47$var$RawSearchModalV2({
11892
11933
  const [start, end] = selected_text_range_;
11893
11934
  if (start === null || end === null) return;
11894
11935
  input_el.setSelectionRange(start, end);
11895
- }
11936
+ },
11937
+ setSearchRoleOnContainer_: false,
11938
+ ariaControls: "depict-suggestions-and-result-preview"
11896
11939
  });
11897
11940
  if (setSearchFieldOuterWidth_) {
11898
11941
  const resizeObserver = new ResizeObserver($gVhhF$depictaiutilishared.catchify(records => setSearchFieldOuterWidth_(records.at(-1).contentRect.width)));