@depict-ai/ui 4.10.12 → 4.10.14

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.cjs CHANGED
@@ -115,7 +115,7 @@ $parcel$export(module.exports, "BreadCrumbs", () => $335c02c1241a9ca8$export$5b7
115
115
  $parcel$export(module.exports, "QuickLinks", () => $335c02c1241a9ca8$export$de035477d6fef996);
116
116
  $parcel$export(module.exports, "CategoryPage", () => $c10e33c4681f8c9b$export$e2bf8ce7779e827e);
117
117
  /*! Depict.ai search and product listing SDK */
118
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.10.12";
118
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.10.14";
119
119
  function $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query) {
120
120
  const signal = $52FdA$solidjs.createSignal(false);
121
121
  $52FdA$solidjs.onCleanup($52FdA$depictaiutilishared.javascript_media_query(media_query, _ref => {
@@ -2825,20 +2825,57 @@ var $b0477e4d832f090e$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<but
2825
2825
  function $b0477e4d832f090e$export$ca21a16d65b3dd8(_ref) {
2826
2826
  let {
2827
2827
  show_extras_: [get_show_extras, set_show_extras],
2828
- i18n_: i18n_
2828
+ i18n_: i18n_,
2829
+ expanding_container_element_: expanding_container_element_
2829
2830
  } = _ref;
2831
+ let button;
2830
2832
  return (() => {
2831
2833
  var _el$ = $52FdA$solidjsweb.getNextElement($b0477e4d832f090e$var$_tmpl$),
2832
2834
  _el$3 = _el$.firstChild,
2833
2835
  [_el$4, _co$] = $52FdA$solidjsweb.getNextMarker(_el$3.nextSibling),
2834
2836
  _el$2 = _el$4.nextSibling;
2835
- $52FdA$solidjsweb.addEventListener(_el$, "click", $52FdA$depictaiutilishared.catchify(() => set_show_extras(p => !p)), true);
2837
+ $52FdA$solidjsweb.addEventListener(_el$, "click", $52FdA$depictaiutilishared.catchify(event => {
2838
+ const container = expanding_container_element_;
2839
+ const will_expand = !get_show_extras();
2840
+ // A click from Enter/Space on the button reports `detail === 0`; a real pointer click reports >= 1.
2841
+ // Only hijack focus for keyboard activation - mouse users can see the revealed options and don't need it
2842
+ // (and would otherwise get the viewport scrolled and an unexpected focus ring).
2843
+ const keyboard_activated = event.detail === 0;
2844
+ const had_focus_inside = !!container && container.contains(document.activeElement);
2845
+ set_show_extras(will_expand);
2846
+ if (will_expand) {
2847
+ if (!keyboard_activated) return;
2848
+ // The container's `expand()` (run from the consumer's effect after this handler) clears `inert`/`visibility`;
2849
+ // focus the first revealed option on the next frame so Tab continues through the newly shown options.
2850
+ // `preventScroll` so moving focus never yanks the viewport down to the first checkbox.
2851
+ requestAnimationFrame($52FdA$depictaiutilishared.catchify(() => {
2852
+ var _container$querySelec;
2853
+ return container === null || container === void 0 ? void 0 : (_container$querySelec = container.querySelector("input:not(:disabled)")) === null || _container$querySelec === void 0 ? void 0 : _container$querySelec.focus({
2854
+ preventScroll: true
2855
+ });
2856
+ }));
2857
+ } else if (had_focus_inside)
2858
+ // Keep focus on the toggle when collapsing, otherwise making the container `inert` dumps focus to <body>
2859
+ // (Safari doesn't focus buttons on mouse click, so focus can still be inside the container here).
2860
+ button.focus();
2861
+ }), true);
2862
+ var _ref$ = button;
2863
+ typeof _ref$ === "function" ? $52FdA$solidjsweb.use(_ref$, _el$) : button = _el$;
2836
2864
  $52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $a904ccf883f60231$export$f21ab0717a89c77f), {}), _el$4, _co$);
2837
2865
  $52FdA$solidjsweb.insert(_el$2, (() => {
2838
2866
  var _c$ = $52FdA$solidjsweb.memo(() => !!get_show_extras());
2839
2867
  return () => _c$() ? i18n_.view_less_() : i18n_.view_more_();
2840
2868
  })());
2841
- $52FdA$solidjsweb.effect(() => _el$.classList.toggle("expanded", !!get_show_extras()));
2869
+ $52FdA$solidjsweb.effect(_p$ => {
2870
+ var _v$ = get_show_extras(),
2871
+ _v$2 = !!get_show_extras();
2872
+ _v$ !== _p$.e && $52FdA$solidjsweb.setAttribute(_el$, "aria-expanded", _p$.e = _v$);
2873
+ _v$2 !== _p$.t && _el$.classList.toggle("expanded", _p$.t = _v$2);
2874
+ return _p$;
2875
+ }, {
2876
+ e: undefined,
2877
+ t: undefined
2878
+ });
2842
2879
  $52FdA$solidjsweb.runHydrationEvents();
2843
2880
  return _el$;
2844
2881
  })();
@@ -3022,7 +3059,8 @@ function $9b54b9c5381716eb$export$dd948f91abc3a1c4(_ref) {
3022
3059
  $52FdA$solidjs.createRenderEffect(() => {
3023
3060
  set_view_more_button_below_group_(togglable_rest() ? $52FdA$solidjsweb.createComponent((0, $b0477e4d832f090e$export$ca21a16d65b3dd8), {
3024
3061
  show_extras_: show_extras_signal,
3025
- i18n_: i18n_
3062
+ i18n_: i18n_,
3063
+ expanding_container_element_: expanding_container_els
3026
3064
  }) : []);
3027
3065
  });
3028
3066
  $52FdA$solidjs.onCleanup(() => set_view_more_button_below_group_());
@@ -3181,7 +3219,7 @@ function $d9239dad9a9d899b$export$430444115f70a734(_ref) {
3181
3219
  return _el$;
3182
3220
  })();
3183
3221
  }
3184
- var $0257c760a99bfacb$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=range><div class=input-group><div class=field><input type=number></div><div class=separator>-</div><div class=field><input type=number></div></div><!$><!/><div class=value-text><span class=min><!$><!/><!$><!/><!$><!/></span><span class=max><!$><!/><!$><!/><!$><!/>`),
3222
+ var $0257c760a99bfacb$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=range><div class=input-group><div class=field><input type=number></div><div class=separator aria-hidden=true>-</div><div class=field><input type=number></div></div><!$><!/><div class=value-text><span class=min><!$><!/><!$><!/><!$><!/></span><span class=max><!$><!/><!$><!/><!$><!/>`),
3185
3223
  $0257c760a99bfacb$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=slider><div class=progress>`),
3186
3224
  $0257c760a99bfacb$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=range-group><input type=range step=any><input type=range step=any>`);
3187
3225
  function $0257c760a99bfacb$export$e0d834a0ad870cda(_ref) {
@@ -3323,7 +3361,8 @@ function $0257c760a99bfacb$var$RangeSelector(_ref3) {
3323
3361
  min_: min_,
3324
3362
  current_range_: current_range_,
3325
3363
  i18n_: i18n_,
3326
- should_be_disabled_: should_be_disabled_
3364
+ should_be_disabled_: should_be_disabled_,
3365
+ priceFormatting_: price_formatting_
3327
3366
  }), _el$24, _co$7);
3328
3367
  $52FdA$solidjsweb.insert(_el$9, pre_price, _el$11, _co$);
3329
3368
  $52FdA$solidjsweb.insert(_el$9, $52FdA$solidjsweb.createComponent((0, $f38f2e64ebe2da86$export$a71e92cfbb498adc), {
@@ -3388,7 +3427,8 @@ function $0257c760a99bfacb$var$ExponentialSlider(_ref6) {
3388
3427
  min_: min_,
3389
3428
  i18n_: i18n_,
3390
3429
  max_: max_,
3391
- should_be_disabled_: should_be_disabled_
3430
+ should_be_disabled_: should_be_disabled_,
3431
+ priceFormatting_: priceFormatting_
3392
3432
  } = _ref6;
3393
3433
  // inspired by https://observablehq.com/@mbostock/nonlinear-slider
3394
3434
  const transform_linear_to_nonlinear = _ref7 => {
@@ -3425,7 +3465,8 @@ function $0257c760a99bfacb$var$ExponentialSlider(_ref6) {
3425
3465
  max_: modified_max,
3426
3466
  offset_value_calculator_: offset_value_calculator_,
3427
3467
  i18n_: i18n_,
3428
- should_be_disabled_: should_be_disabled_
3468
+ should_be_disabled_: should_be_disabled_,
3469
+ priceFormatting_: priceFormatting_
3429
3470
  });
3430
3471
  }
3431
3472
  function $0257c760a99bfacb$var$LinearSlider(_ref8) {
@@ -3435,12 +3476,17 @@ function $0257c760a99bfacb$var$LinearSlider(_ref8) {
3435
3476
  current_range_: current_range_,
3436
3477
  offset_value_calculator_: offset_value_calculator_,
3437
3478
  i18n_: i18n_,
3438
- should_be_disabled_: should_be_disabled_
3479
+ should_be_disabled_: should_be_disabled_,
3480
+ priceFormatting_: priceFormatting_
3439
3481
  } = _ref8;
3440
3482
  let range_input_1;
3441
3483
  let range_input_2;
3442
3484
  let clickable_slider;
3443
3485
  const [get_current_range, set_current_range] = current_range_;
3486
+ const formatRealPrice = value => {
3487
+ const priceFormatting = priceFormatting_();
3488
+ return priceFormatting.pre_ + $52FdA$depictaiutilishared.standard_price_format(value, priceFormatting.places_after_comma_, priceFormatting.decimal_places_delimiter_, priceFormatting.thousands_delimiter_) + priceFormatting.post_;
3489
+ };
3444
3490
  const progress_styling = $52FdA$solidjs.createMemo(() => {
3445
3491
  const min = min_();
3446
3492
  const span = max_() - min;
@@ -3497,20 +3543,24 @@ function $0257c760a99bfacb$var$LinearSlider(_ref8) {
3497
3543
  $52FdA$solidjsweb.effect(_p$ => {
3498
3544
  var _v$10 = should_be_disabled_(),
3499
3545
  _v$11 = i18n_.range_filter_low_point_aria_label_(),
3500
- _v$12 = min_(),
3501
- _v$13 = max_(),
3502
- _v$14 = should_be_disabled_(),
3503
- _v$15 = i18n_.range_filter_high_point_aria_label_(),
3504
- _v$16 = min_(),
3505
- _v$17 = max_();
3546
+ _v$12 = formatRealPrice(get_current_range()[0]),
3547
+ _v$13 = min_(),
3548
+ _v$14 = max_(),
3549
+ _v$15 = should_be_disabled_(),
3550
+ _v$16 = i18n_.range_filter_high_point_aria_label_(),
3551
+ _v$17 = formatRealPrice(get_current_range()[1]),
3552
+ _v$18 = min_(),
3553
+ _v$19 = max_();
3506
3554
  _v$10 !== _p$.e && $52FdA$solidjsweb.setProperty(_el$28, "disabled", _p$.e = _v$10);
3507
3555
  _v$11 !== _p$.t && $52FdA$solidjsweb.setAttribute(_el$28, "aria-label", _p$.t = _v$11);
3508
- _v$12 !== _p$.a && $52FdA$solidjsweb.setAttribute(_el$28, "min", _p$.a = _v$12);
3509
- _v$13 !== _p$.o && $52FdA$solidjsweb.setAttribute(_el$28, "max", _p$.o = _v$13);
3510
- _v$14 !== _p$.i && $52FdA$solidjsweb.setProperty(_el$29, "disabled", _p$.i = _v$14);
3511
- _v$15 !== _p$.n && $52FdA$solidjsweb.setAttribute(_el$29, "aria-label", _p$.n = _v$15);
3512
- _v$16 !== _p$.s && $52FdA$solidjsweb.setAttribute(_el$29, "min", _p$.s = _v$16);
3513
- _v$17 !== _p$.h && $52FdA$solidjsweb.setAttribute(_el$29, "max", _p$.h = _v$17);
3556
+ _v$12 !== _p$.a && $52FdA$solidjsweb.setAttribute(_el$28, "aria-valuetext", _p$.a = _v$12);
3557
+ _v$13 !== _p$.o && $52FdA$solidjsweb.setAttribute(_el$28, "min", _p$.o = _v$13);
3558
+ _v$14 !== _p$.i && $52FdA$solidjsweb.setAttribute(_el$28, "max", _p$.i = _v$14);
3559
+ _v$15 !== _p$.n && $52FdA$solidjsweb.setProperty(_el$29, "disabled", _p$.n = _v$15);
3560
+ _v$16 !== _p$.s && $52FdA$solidjsweb.setAttribute(_el$29, "aria-label", _p$.s = _v$16);
3561
+ _v$17 !== _p$.h && $52FdA$solidjsweb.setAttribute(_el$29, "aria-valuetext", _p$.h = _v$17);
3562
+ _v$18 !== _p$.r && $52FdA$solidjsweb.setAttribute(_el$29, "min", _p$.r = _v$18);
3563
+ _v$19 !== _p$.d && $52FdA$solidjsweb.setAttribute(_el$29, "max", _p$.d = _v$19);
3514
3564
  return _p$;
3515
3565
  }, {
3516
3566
  e: undefined,
@@ -3520,7 +3570,9 @@ function $0257c760a99bfacb$var$LinearSlider(_ref8) {
3520
3570
  i: undefined,
3521
3571
  n: undefined,
3522
3572
  s: undefined,
3523
- h: undefined
3573
+ h: undefined,
3574
+ r: undefined,
3575
+ d: undefined
3524
3576
  });
3525
3577
  $52FdA$solidjsweb.effect(() => $52FdA$solidjsweb.setProperty(_el$28, "value", $52FdA$solidjs.createMemo(() => {
3526
3578
  min_();
@@ -3985,7 +4037,8 @@ function $9c1d49181fb3002a$export$a32086fa6616eafd(_ref) {
3985
4037
  $52FdA$solidjs.createRenderEffect(() => {
3986
4038
  set_view_more_button_below_group(some_top_level_are_hidden() ? $52FdA$solidjsweb.createComponent((0, $b0477e4d832f090e$export$ca21a16d65b3dd8), {
3987
4039
  show_extras_: show_extras,
3988
- i18n_: i18n_
4040
+ i18n_: i18n_,
4041
+ expanding_container_element_: expanding_container_els
3989
4042
  }) : []);
3990
4043
  });
3991
4044
  $52FdA$solidjs.onCleanup(() => set_view_more_button_below_group());
@@ -4479,6 +4532,13 @@ const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
4479
4532
  _el$7 = _el$6.nextSibling,
4480
4533
  [_el$8, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$7.nextSibling);
4481
4534
  $52FdA$solidjsweb.spread(_el$2, $52FdA$solidjsweb.mergeProps(attributes, {
4535
+ "type": "button",
4536
+ get ["aria-pressed"]() {
4537
+ return is_selected();
4538
+ },
4539
+ get ["aria-label"]() {
4540
+ return $52FdA$solidjsweb.memo(() => value().count_ != undefined)() ? "".concat(label(), ", ").concat(value().count_) : label();
4541
+ },
4482
4542
  get disabled() {
4483
4543
  return $52FdA$solidjsweb.memo(() => !!count_zero())() && !is_selected();
4484
4544
  },
@@ -4690,7 +4750,14 @@ function $476a3dc36afc1938$export$82ed4b28ecb67608(_ref) {
4690
4750
  return !!(data !== null && data !== void 0 && data.some(item => $e2d74bb03cc5252e$export$325f75597868c4f0(item) === value));
4691
4751
  });
4692
4752
  const value = $52FdA$solidjs.createMemo(() => checkbox().value_);
4693
- const label_text = $52FdA$solidjs.createMemo(() => checkbox().name_ || value() + "");
4753
+ const label_text = $52FdA$solidjs.createMemo(() => {
4754
+ const name = checkbox().name_;
4755
+ if (name) return name;
4756
+ const value_string = value() + "";
4757
+ if (backendFilterV2()) return value_string;
4758
+ // Legacy values are "Name;#hex" - split is used to get the name so that screen readers don't announce the hex code
4759
+ return value_string.split(";")[0] || value_string;
4760
+ });
4694
4761
  const count = $52FdA$solidjs.createMemo(() => checkbox().count_);
4695
4762
  const colorNameDatasetValue = $52FdA$solidjs.createMemo(() => {
4696
4763
  var _split2;
@@ -4778,7 +4845,8 @@ function $476a3dc36afc1938$export$82ed4b28ecb67608(_ref) {
4778
4845
  $52FdA$solidjs.createRenderEffect(() => {
4779
4846
  set_view_more_button_below_group_(togglable_rest() ? $52FdA$solidjsweb.createComponent((0, $b0477e4d832f090e$export$ca21a16d65b3dd8), {
4780
4847
  show_extras_: show_extras_signal,
4781
- i18n_: i18n_
4848
+ i18n_: i18n_,
4849
+ expanding_container_element_: expanding_container_els
4782
4850
  }) : []);
4783
4851
  });
4784
4852
  $52FdA$solidjs.onCleanup(() => set_view_more_button_below_group_());
@@ -5185,7 +5253,7 @@ $52FdA$solidjsweb.delegateEvents(["input", "click"]);
5185
5253
  var $164d474fea221d77$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=filter-collapsible>`),
5186
5254
  $164d474fea221d77$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<button class=clear-group><!$><!/><span>`),
5187
5255
  $164d474fea221d77$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=view-more-clear><!$><!/><!$><!/>`),
5188
- $164d474fea221d77$var$_tmpl$4 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=filter-collapsible-body><div class=filter-part><!$><!/><!$><!/></div><!$><!/>`),
5256
+ $164d474fea221d77$var$_tmpl$4 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=filter-collapsible-body><fieldset class=filter-part><!$><!/><!$><!/></fieldset><!$><!/>`),
5189
5257
  $164d474fea221d77$var$_tmpl$5 = /*#__PURE__*/$52FdA$solidjsweb.template(`<details class=filter-collapsible>`),
5190
5258
  $164d474fea221d77$var$_tmpl$6 = /*#__PURE__*/$52FdA$solidjsweb.template(`<summary class=filter-group-summary><div class=summary><span></span><div class=selected-w-sign><!$><!/><!$><!/>`),
5191
5259
  $164d474fea221d77$var$_tmpl$7 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=ungrouped>`),
@@ -5288,6 +5356,7 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
5288
5356
  var _get_details_width;
5289
5357
  return get_details_width === null || get_details_width === void 0 ? void 0 : (_get_details_width = get_details_width()) === null || _get_details_width === void 0 ? void 0 : _get_details_width();
5290
5358
  });
5359
+ const title_id = $52FdA$depictaiutilishared.make_random_classname();
5291
5360
  return $52FdA$solidjsweb.createComponent((0, $4cfe8400ed3f92c4$export$6c6d7a51fa9aa15d), {
5292
5361
  is_open_: is_open,
5293
5362
  get details_() {
@@ -5308,6 +5377,7 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
5308
5377
  [_el$25, _co$7] = $52FdA$solidjsweb.getNextMarker(_el$24.nextSibling),
5309
5378
  _el$26 = _el$25.nextSibling,
5310
5379
  [_el$27, _co$8] = $52FdA$solidjsweb.getNextMarker(_el$26.nextSibling);
5380
+ $52FdA$solidjsweb.setAttribute(_el$22, "id", title_id);
5311
5381
  $52FdA$solidjsweb.insert(_el$22, section_);
5312
5382
  $52FdA$solidjsweb.insert(_el$23, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
5313
5383
  get when() {
@@ -5342,6 +5412,7 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
5342
5412
  [_el$7, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$6.nextSibling),
5343
5413
  _el$17 = _el$3.nextSibling,
5344
5414
  [_el$18, _co$6] = $52FdA$solidjsweb.getNextMarker(_el$17.nextSibling);
5415
+ $52FdA$solidjsweb.setAttribute(_el$3, "aria-labelledby", title_id);
5345
5416
  $52FdA$solidjsweb.insert(_el$3, $52FdA$solidjsweb.createComponent(SearchThisFilterGroup_, {}), _el$5, _co$);
5346
5417
  $52FdA$solidjsweb.insert(_el$3, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Index), {
5347
5418
  get each() {
@@ -6266,8 +6337,8 @@ var $ae261a5687fe84f4$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<svg
6266
6337
  function $ae261a5687fe84f4$export$cb808a3c41736d8e() {
6267
6338
  return $52FdA$solidjsweb.getNextElement($ae261a5687fe84f4$var$_tmpl$);
6268
6339
  }
6269
- var $f70cc6dfcadf0fd5$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=filters><div class=body>`),
6270
- $f70cc6dfcadf0fd5$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=sorting><div class=body>`),
6340
+ var $f70cc6dfcadf0fd5$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<section class=filters tabindex=-1><div class=body>`),
6341
+ $f70cc6dfcadf0fd5$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<section class=sorting tabindex=-1><div class=body>`),
6271
6342
  $f70cc6dfcadf0fd5$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=sort-and-filter-buttons><div class=outer><div class=inner><!$><!/><!$><!/><!$><!/>`),
6272
6343
  $f70cc6dfcadf0fd5$var$_tmpl$4 = /*#__PURE__*/$52FdA$solidjsweb.template(`<span class=num-filters>`),
6273
6344
  $f70cc6dfcadf0fd5$var$_tmpl$5 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=open-filters-button-container><!$><!/><button type=button><!$><!/><span>`),
@@ -6344,6 +6415,27 @@ function $f70cc6dfcadf0fd5$export$d7841e452f2e59a8(_ref) {
6344
6415
  available_sortings_: available_sortings_,
6345
6416
  meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
6346
6417
  };
6418
+ // Keyboard accessibility for the desktop panels (rendered after the product grid in the DOM): when the user
6419
+ // opens a panel we move focus into it, and restore focus to the toggle button on close. Intent is tracked with
6420
+ // a plain flag set in the buttons' click handlers - `filters_open`/`sorting_open` also change programmatically
6421
+ // (undo toast, history-state restore, SDK consumers), and those must not steal focus.
6422
+ let user_opened_panel = false;
6423
+ let filter_toggle_button;
6424
+ let sort_toggle_button;
6425
+ let current_panel;
6426
+ let current_panel_toggle_button;
6427
+ const focus_panel_when_in_dom = panel => $52FdA$depictaiutilishared.catchify(async () => {
6428
+ // Bounded wait: if the panel never lands in the DOM (e.g. it's superseded by a rapid re-render before
6429
+ // insertion), the timeout lets this promise resolve instead of keeping `panel` - and the observer
6430
+ // listener it registers - referenced forever.
6431
+ await (0, $52FdA$depictaiutilishared.observer).wait_for_element(panel, 4000);
6432
+ if (panel.isConnected) panel.focus();
6433
+ })();
6434
+ const register_desktop_panel = (el, toggle_button, should_focus) => {
6435
+ current_panel = el;
6436
+ current_panel_toggle_button = toggle_button;
6437
+ if (should_focus) focus_panel_when_in_dom(el);
6438
+ };
6347
6439
  const make_open_filters_button = function () {
6348
6440
  let adhere_to_width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
6349
6441
  let is_tabbable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
@@ -6354,7 +6446,9 @@ function $f70cc6dfcadf0fd5$export$d7841e452f2e59a8(_ref) {
6354
6446
  search_sorting_open_: search_sorting_open_,
6355
6447
  number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_,
6356
6448
  filter_button_width_: adhere_to_width ? filter_button_width_ : undefined,
6357
- hide_button_: hide_filters
6449
+ hide_button_: hide_filters,
6450
+ on_user_open_: () => user_opened_panel = true,
6451
+ button_ref_: is_tabbable ? el => filter_toggle_button = el : undefined
6358
6452
  });
6359
6453
  };
6360
6454
  const make_open_sorting_button = function () {
@@ -6368,7 +6462,9 @@ function $f70cc6dfcadf0fd5$export$d7841e452f2e59a8(_ref) {
6368
6462
  search_sorting_open_: search_sorting_open_,
6369
6463
  available_sortings_: available_sortings_,
6370
6464
  sort_button_width_: adhere_to_width ? sort_button_width_ : undefined,
6371
- meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
6465
+ meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_,
6466
+ on_user_open_: () => user_opened_panel = true,
6467
+ button_ref_: is_tabbable ? el => sort_toggle_button = el : undefined
6372
6468
  });
6373
6469
  };
6374
6470
  let open_modal_;
@@ -6388,10 +6484,47 @@ function $f70cc6dfcadf0fd5$export$d7841e452f2e59a8(_ref) {
6388
6484
  grid_is_in_original_state = true;
6389
6485
  }
6390
6486
  });
6487
+ // Restore focus to the relevant toggle button when a desktop panel is torn down while focus is still inside it.
6488
+ const restore_focus_to_toggle_on_close = () => {
6489
+ const button_to_restore = current_panel_toggle_button;
6490
+ const focus_was_in_panel = !!current_panel && current_panel.contains(document.activeElement);
6491
+ current_panel = undefined;
6492
+ current_panel_toggle_button = undefined;
6493
+ if (focus_was_in_panel) button_to_restore === null || button_to_restore === void 0 || button_to_restore.focus();
6494
+ };
6495
+ // `<section>` + `aria-label` so the panel announces itself ("Filters"/"Sort") when we move focus to it; the bare
6496
+ // tabindex=-1 container would otherwise give screen readers nothing to read on focus. A semantic <section> avoids
6497
+ // an ARIA role and the UA styling pitfalls of <fieldset>; the existing CSS targets the `.filters`/`.sorting` class.
6498
+ const FiltersPanel = should_focus => $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
6499
+ get when() {
6500
+ return !hide_filters();
6501
+ },
6502
+ get children() {
6503
+ var _el$ = $52FdA$solidjsweb.getNextElement($f70cc6dfcadf0fd5$var$_tmpl$),
6504
+ _el$2 = _el$.firstChild;
6505
+ $52FdA$solidjsweb.use(el => register_desktop_panel(el, filter_toggle_button, should_focus), _el$);
6506
+ $52FdA$solidjsweb.insert(_el$2, $52FdA$solidjsweb.createComponent((0, $164d474fea221d77$export$3f1a388cc0d8fed7), filter_options));
6507
+ $52FdA$solidjsweb.effect(() => $52FdA$solidjsweb.setAttribute(_el$, "aria-label", i18n_.filters_()));
6508
+ return _el$;
6509
+ }
6510
+ });
6511
+ const SortingPanel = should_focus => (() => {
6512
+ var _el$3 = $52FdA$solidjsweb.getNextElement($f70cc6dfcadf0fd5$var$_tmpl$2),
6513
+ _el$4 = _el$3.firstChild;
6514
+ $52FdA$solidjsweb.use(el => register_desktop_panel(el, sort_toggle_button, should_focus), _el$3);
6515
+ $52FdA$solidjsweb.insert(_el$4, $52FdA$solidjsweb.createComponent((0, $3bd211c857f81dfd$export$1f1775a58da589b5), sorting_options));
6516
+ $52FdA$solidjsweb.effect(() => $52FdA$solidjsweb.setAttribute(_el$3, "aria-label", i18n_.sorting_text_()));
6517
+ return _el$3;
6518
+ })();
6391
6519
  $52FdA$solidjs.createEffect(() => {
6520
+ // Consume the user-intent flag once per run, in every branch, so a stale flag can't leak into a later
6521
+ // resize-triggered re-render and steal focus.
6522
+ const should_focus_panel = user_opened_panel;
6523
+ user_opened_panel = false;
6392
6524
  if (!filters_open() && !sorting_open()) {
6393
6525
  var _close_modal_;
6394
6526
  (_close_modal_ = close_modal_) === null || _close_modal_ === void 0 || _close_modal_();
6527
+ restore_focus_to_toggle_on_close();
6395
6528
  set_extra_els_in_results_container_("");
6396
6529
  } else if (isSmall()()) {
6397
6530
  var _open_modal_;
@@ -6401,27 +6534,15 @@ function $f70cc6dfcadf0fd5$export$d7841e452f2e59a8(_ref) {
6401
6534
  set_sorting_open(false);
6402
6535
  return;
6403
6536
  }
6537
+ // The modal manages its own focus; just drop the desktop panel reference.
6538
+ current_panel = undefined;
6539
+ current_panel_toggle_button = undefined;
6404
6540
  (_open_modal_ = open_modal_) === null || _open_modal_ === void 0 || _open_modal_();
6405
6541
  set_extra_els_in_results_container_("");
6406
6542
  } else {
6407
6543
  var _close_modal_2;
6408
6544
  (_close_modal_2 = close_modal_) === null || _close_modal_2 === void 0 || _close_modal_2();
6409
- if (filters_open()) set_extra_els_in_results_container_(() => $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
6410
- get when() {
6411
- return !hide_filters();
6412
- },
6413
- get children() {
6414
- var _el$ = $52FdA$solidjsweb.getNextElement($f70cc6dfcadf0fd5$var$_tmpl$),
6415
- _el$2 = _el$.firstChild;
6416
- $52FdA$solidjsweb.insert(_el$2, $52FdA$solidjsweb.createComponent((0, $164d474fea221d77$export$3f1a388cc0d8fed7), filter_options));
6417
- return _el$;
6418
- }
6419
- }));else set_extra_els_in_results_container_((() => {
6420
- var _el$3 = $52FdA$solidjsweb.getNextElement($f70cc6dfcadf0fd5$var$_tmpl$2),
6421
- _el$4 = _el$3.firstChild;
6422
- $52FdA$solidjsweb.insert(_el$4, $52FdA$solidjsweb.createComponent((0, $3bd211c857f81dfd$export$1f1775a58da589b5), sorting_options));
6423
- return _el$3;
6424
- })());
6545
+ if (filters_open()) set_extra_els_in_results_container_(() => FiltersPanel(should_focus_panel));else set_extra_els_in_results_container_(SortingPanel(should_focus_panel));
6425
6546
  }
6426
6547
  });
6427
6548
  $52FdA$depictaiutilishared.catchify(async () => {
@@ -6486,7 +6607,9 @@ function $f70cc6dfcadf0fd5$var$OpenFiltersButton(_ref3) {
6486
6607
  filter_button_width_: filter_button_width_,
6487
6608
  tabindex_: tabindex_,
6488
6609
  number_of_rendered_selected_filters_items_: [num_selected_filters],
6489
- hide_button_: hide_button_
6610
+ hide_button_: hide_button_,
6611
+ on_user_open_: on_user_open_,
6612
+ button_ref_: button_ref_
6490
6613
  } = _ref3;
6491
6614
  const filters_closed = $52FdA$solidjs.createMemo(() => !search_filters_open_[0]());
6492
6615
  // We assume in embedded_num_products that this is a single HTMLElement so pls change there if you change it here
@@ -6514,9 +6637,12 @@ function $f70cc6dfcadf0fd5$var$OpenFiltersButton(_ref3) {
6514
6637
  search_filters_open_[1](false);
6515
6638
  return;
6516
6639
  }
6640
+ on_user_open_ === null || on_user_open_ === void 0 || on_user_open_();
6517
6641
  search_filters_open_[1](true);
6518
6642
  search_sorting_open_[1](false);
6519
6643
  })), true);
6644
+ var _ref$2 = button_ref_;
6645
+ typeof _ref$2 === "function" ? $52FdA$solidjsweb.use(_ref$2, _el$16) : button_ref_ = _el$16;
6520
6646
  $52FdA$solidjsweb.setAttribute(_el$16, "tabindex", tabindex_);
6521
6647
  $52FdA$solidjsweb.className(_el$16, "filter toggle-button major-minor-transition" + ((0, $52FdA$solidjsweb.isServer) ? " minor" : ""));
6522
6648
  $52FdA$solidjsweb.insert(_el$16, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
@@ -6538,21 +6664,24 @@ function $f70cc6dfcadf0fd5$var$OpenFiltersButton(_ref3) {
6538
6664
  _v$2 = !filters_closed(),
6539
6665
  _v$3 = !!filters_closed(),
6540
6666
  _v$4 = (filters_closed() ? i18n_.open_filters_ : i18n_.close_filters_)(),
6541
- _v$5 = filter_button_width_ !== null && filter_button_width_ !== void 0 && filter_button_width_() ? {
6667
+ _v$5 = !filters_closed(),
6668
+ _v$6 = filter_button_width_ !== null && filter_button_width_ !== void 0 && filter_button_width_() ? {
6542
6669
  width: filter_button_width_() + "px"
6543
6670
  } : {};
6544
6671
  _p$.e = $52FdA$solidjsweb.style(_el$14, _v$, _p$.e);
6545
6672
  _v$2 !== _p$.t && _el$16.classList.toggle("major", _p$.t = _v$2);
6546
6673
  _v$3 !== _p$.a && _el$16.classList.toggle("minor", _p$.a = _v$3);
6547
6674
  _v$4 !== _p$.o && $52FdA$solidjsweb.setAttribute(_el$16, "aria-label", _p$.o = _v$4);
6548
- _p$.i = $52FdA$solidjsweb.style(_el$16, _v$5, _p$.i);
6675
+ _v$5 !== _p$.i && $52FdA$solidjsweb.setAttribute(_el$16, "aria-expanded", _p$.i = _v$5);
6676
+ _p$.n = $52FdA$solidjsweb.style(_el$16, _v$6, _p$.n);
6549
6677
  return _p$;
6550
6678
  }, {
6551
6679
  e: undefined,
6552
6680
  t: undefined,
6553
6681
  a: undefined,
6554
6682
  o: undefined,
6555
- i: undefined
6683
+ i: undefined,
6684
+ n: undefined
6556
6685
  });
6557
6686
  $52FdA$solidjsweb.runHydrationEvents();
6558
6687
  return _el$14;
@@ -6567,7 +6696,9 @@ function $f70cc6dfcadf0fd5$var$OpenSortingButton(_ref4) {
6567
6696
  search_sorting_open_: search_sorting_open_,
6568
6697
  sort_button_width_: sort_button_width_,
6569
6698
  tabindex_: tabindex_,
6570
- meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
6699
+ meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_,
6700
+ on_user_open_: on_user_open_,
6701
+ button_ref_: button_ref_
6571
6702
  } = _ref4;
6572
6703
  const sorting_closed = $52FdA$solidjs.createMemo(() => !search_sorting_open_[0]());
6573
6704
  // We assume in embedded_num_products that this is a single HTMLElement so pls change there if you change it here
@@ -6581,9 +6712,12 @@ function $f70cc6dfcadf0fd5$var$OpenSortingButton(_ref4) {
6581
6712
  search_sorting_open_[1](false);
6582
6713
  return;
6583
6714
  }
6715
+ on_user_open_ === null || on_user_open_ === void 0 || on_user_open_();
6584
6716
  search_filters_open_[1](false);
6585
6717
  search_sorting_open_[1](true);
6586
6718
  })), true);
6719
+ var _ref$3 = button_ref_;
6720
+ typeof _ref$3 === "function" ? $52FdA$solidjsweb.use(_ref$3, _el$22) : button_ref_ = _el$22;
6587
6721
  $52FdA$solidjsweb.setAttribute(_el$22, "tabindex", tabindex_);
6588
6722
  $52FdA$solidjsweb.insert(_el$23, (() => {
6589
6723
  var _c$ = $52FdA$solidjsweb.memo(() => !!sorting_closed());
@@ -6612,22 +6746,25 @@ function $f70cc6dfcadf0fd5$var$OpenSortingButton(_ref4) {
6612
6746
  }
6613
6747
  }), _el$25, _co$6);
6614
6748
  $52FdA$solidjsweb.effect(_p$ => {
6615
- var _v$6 = !sorting_closed(),
6616
- _v$7 = !!sorting_closed(),
6617
- _v$8 = (sorting_closed() ? i18n_.open_sorting_ : i18n_.close_sorting_)(),
6618
- _v$9 = sort_button_width_ !== null && sort_button_width_ !== void 0 && sort_button_width_() ? {
6749
+ var _v$7 = !sorting_closed(),
6750
+ _v$8 = !!sorting_closed(),
6751
+ _v$9 = (sorting_closed() ? i18n_.open_sorting_ : i18n_.close_sorting_)(),
6752
+ _v$10 = !sorting_closed(),
6753
+ _v$11 = sort_button_width_ !== null && sort_button_width_ !== void 0 && sort_button_width_() ? {
6619
6754
  width: sort_button_width_() + "px"
6620
6755
  } : {};
6621
- _v$6 !== _p$.e && _el$22.classList.toggle("major", _p$.e = _v$6);
6622
- _v$7 !== _p$.t && _el$22.classList.toggle("minor", _p$.t = _v$7);
6623
- _v$8 !== _p$.a && $52FdA$solidjsweb.setAttribute(_el$22, "aria-label", _p$.a = _v$8);
6624
- _p$.o = $52FdA$solidjsweb.style(_el$22, _v$9, _p$.o);
6756
+ _v$7 !== _p$.e && _el$22.classList.toggle("major", _p$.e = _v$7);
6757
+ _v$8 !== _p$.t && _el$22.classList.toggle("minor", _p$.t = _v$8);
6758
+ _v$9 !== _p$.a && $52FdA$solidjsweb.setAttribute(_el$22, "aria-label", _p$.a = _v$9);
6759
+ _v$10 !== _p$.o && $52FdA$solidjsweb.setAttribute(_el$22, "aria-expanded", _p$.o = _v$10);
6760
+ _p$.i = $52FdA$solidjsweb.style(_el$22, _v$11, _p$.i);
6625
6761
  return _p$;
6626
6762
  }, {
6627
6763
  e: undefined,
6628
6764
  t: undefined,
6629
6765
  a: undefined,
6630
- o: undefined
6766
+ o: undefined,
6767
+ i: undefined
6631
6768
  });
6632
6769
  $52FdA$solidjsweb.runHydrationEvents();
6633
6770
  return _el$22;
package/ES10/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.10.12";
14
+ export const version = "4.10.14";
15
15
  /**
16
16
  * Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
17
17
  */