@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/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.10.12";
112
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "4.10.14";
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, ({
@@ -2701,20 +2701,54 @@ function $cc43b6428000c4bf$export$f21ab0717a89c77f(props) {
2701
2701
  var $0fe1e7efdf4200d6$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button type=button class=expand-filter><!$><!/><span>`);
2702
2702
  function $0fe1e7efdf4200d6$export$ca21a16d65b3dd8({
2703
2703
  show_extras_: [get_show_extras, set_show_extras],
2704
- i18n_: i18n_
2704
+ i18n_: i18n_,
2705
+ expanding_container_element_: expanding_container_element_
2705
2706
  }) {
2707
+ let button;
2706
2708
  return (() => {
2707
2709
  var _el$ = $gVhhF$solidjsweb.getNextElement($0fe1e7efdf4200d6$var$_tmpl$),
2708
2710
  _el$3 = _el$.firstChild,
2709
2711
  [_el$4, _co$] = $gVhhF$solidjsweb.getNextMarker(_el$3.nextSibling),
2710
2712
  _el$2 = _el$4.nextSibling;
2711
- $gVhhF$solidjsweb.addEventListener(_el$, "click", $gVhhF$depictaiutilishared.catchify(() => set_show_extras(p => !p)), true);
2713
+ $gVhhF$solidjsweb.addEventListener(_el$, "click", $gVhhF$depictaiutilishared.catchify(event => {
2714
+ const container = expanding_container_element_;
2715
+ const will_expand = !get_show_extras();
2716
+ // A click from Enter/Space on the button reports `detail === 0`; a real pointer click reports >= 1.
2717
+ // Only hijack focus for keyboard activation - mouse users can see the revealed options and don't need it
2718
+ // (and would otherwise get the viewport scrolled and an unexpected focus ring).
2719
+ const keyboard_activated = event.detail === 0;
2720
+ const had_focus_inside = !!container && container.contains(document.activeElement);
2721
+ set_show_extras(will_expand);
2722
+ if (will_expand) {
2723
+ if (!keyboard_activated) return;
2724
+ // The container's `expand()` (run from the consumer's effect after this handler) clears `inert`/`visibility`;
2725
+ // focus the first revealed option on the next frame so Tab continues through the newly shown options.
2726
+ // `preventScroll` so moving focus never yanks the viewport down to the first checkbox.
2727
+ requestAnimationFrame($gVhhF$depictaiutilishared.catchify(() => container?.querySelector("input:not(:disabled)")?.focus({
2728
+ preventScroll: true
2729
+ })));
2730
+ } else if (had_focus_inside)
2731
+ // Keep focus on the toggle when collapsing, otherwise making the container `inert` dumps focus to <body>
2732
+ // (Safari doesn't focus buttons on mouse click, so focus can still be inside the container here).
2733
+ button.focus();
2734
+ }), true);
2735
+ var _ref$ = button;
2736
+ typeof _ref$ === "function" ? $gVhhF$solidjsweb.use(_ref$, _el$) : button = _el$;
2712
2737
  $gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $cc43b6428000c4bf$export$f21ab0717a89c77f), {}), _el$4, _co$);
2713
2738
  $gVhhF$solidjsweb.insert(_el$2, (() => {
2714
2739
  var _c$ = $gVhhF$solidjsweb.memo(() => !!get_show_extras());
2715
2740
  return () => _c$() ? i18n_.view_less_() : i18n_.view_more_();
2716
2741
  })());
2717
- $gVhhF$solidjsweb.effect(() => _el$.classList.toggle("expanded", !!get_show_extras()));
2742
+ $gVhhF$solidjsweb.effect(_p$ => {
2743
+ var _v$ = get_show_extras(),
2744
+ _v$2 = !!get_show_extras();
2745
+ _v$ !== _p$.e && $gVhhF$solidjsweb.setAttribute(_el$, "aria-expanded", _p$.e = _v$);
2746
+ _v$2 !== _p$.t && _el$.classList.toggle("expanded", _p$.t = _v$2);
2747
+ return _p$;
2748
+ }, {
2749
+ e: undefined,
2750
+ t: undefined
2751
+ });
2718
2752
  $gVhhF$solidjsweb.runHydrationEvents();
2719
2753
  return _el$;
2720
2754
  })();
@@ -2889,7 +2923,8 @@ function $d94869c80e337a3d$export$dd948f91abc3a1c4({
2889
2923
  $gVhhF$solidjs.createRenderEffect(() => {
2890
2924
  set_view_more_button_below_group_(togglable_rest() ? $gVhhF$solidjsweb.createComponent((0, $0fe1e7efdf4200d6$export$ca21a16d65b3dd8), {
2891
2925
  show_extras_: show_extras_signal,
2892
- i18n_: i18n_
2926
+ i18n_: i18n_,
2927
+ expanding_container_element_: expanding_container_els
2893
2928
  }) : []);
2894
2929
  });
2895
2930
  $gVhhF$solidjs.onCleanup(() => set_view_more_button_below_group_());
@@ -3033,7 +3068,7 @@ function $c1dc1554c1b94233$export$430444115f70a734({
3033
3068
  return _el$;
3034
3069
  })();
3035
3070
  }
3036
- var $0b7222ba8a8bb72f$var$_tmpl$ = /*#__PURE__*/$gVhhF$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><!$><!/><!$><!/><!$><!/>`),
3071
+ var $0b7222ba8a8bb72f$var$_tmpl$ = /*#__PURE__*/$gVhhF$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><!$><!/><!$><!/><!$><!/>`),
3037
3072
  $0b7222ba8a8bb72f$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=slider><div class=progress>`),
3038
3073
  $0b7222ba8a8bb72f$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=range-group><input type=range step=any><input type=range step=any>`);
3039
3074
  function $0b7222ba8a8bb72f$export$e0d834a0ad870cda({
@@ -3167,7 +3202,8 @@ function $0b7222ba8a8bb72f$var$RangeSelector({
3167
3202
  min_: min_,
3168
3203
  current_range_: current_range_,
3169
3204
  i18n_: i18n_,
3170
- should_be_disabled_: should_be_disabled_
3205
+ should_be_disabled_: should_be_disabled_,
3206
+ priceFormatting_: price_formatting_
3171
3207
  }), _el$24, _co$7);
3172
3208
  $gVhhF$solidjsweb.insert(_el$9, pre_price, _el$11, _co$);
3173
3209
  $gVhhF$solidjsweb.insert(_el$9, $gVhhF$solidjsweb.createComponent((0, $d659702496cb72ea$export$a71e92cfbb498adc), {
@@ -3231,7 +3267,8 @@ function $0b7222ba8a8bb72f$var$ExponentialSlider({
3231
3267
  min_: min_,
3232
3268
  i18n_: i18n_,
3233
3269
  max_: max_,
3234
- should_be_disabled_: should_be_disabled_
3270
+ should_be_disabled_: should_be_disabled_,
3271
+ priceFormatting_: priceFormatting_
3235
3272
  }) {
3236
3273
  // inspired by https://observablehq.com/@mbostock/nonlinear-slider
3237
3274
  const transform_linear_to_nonlinear = ([smaller, larger]) => [Math.sqrt(smaller), Math.sqrt(larger)];
@@ -3265,7 +3302,8 @@ function $0b7222ba8a8bb72f$var$ExponentialSlider({
3265
3302
  max_: modified_max,
3266
3303
  offset_value_calculator_: offset_value_calculator_,
3267
3304
  i18n_: i18n_,
3268
- should_be_disabled_: should_be_disabled_
3305
+ should_be_disabled_: should_be_disabled_,
3306
+ priceFormatting_: priceFormatting_
3269
3307
  });
3270
3308
  }
3271
3309
  function $0b7222ba8a8bb72f$var$LinearSlider({
@@ -3274,12 +3312,17 @@ function $0b7222ba8a8bb72f$var$LinearSlider({
3274
3312
  current_range_: current_range_,
3275
3313
  offset_value_calculator_: offset_value_calculator_,
3276
3314
  i18n_: i18n_,
3277
- should_be_disabled_: should_be_disabled_
3315
+ should_be_disabled_: should_be_disabled_,
3316
+ priceFormatting_: priceFormatting_
3278
3317
  }) {
3279
3318
  let range_input_1;
3280
3319
  let range_input_2;
3281
3320
  let clickable_slider;
3282
3321
  const [get_current_range, set_current_range] = current_range_;
3322
+ const formatRealPrice = value => {
3323
+ const priceFormatting = priceFormatting_();
3324
+ return priceFormatting.pre_ + $gVhhF$depictaiutilishared.standard_price_format(value, priceFormatting.places_after_comma_, priceFormatting.decimal_places_delimiter_, priceFormatting.thousands_delimiter_) + priceFormatting.post_;
3325
+ };
3283
3326
  const progress_styling = $gVhhF$solidjs.createMemo(() => {
3284
3327
  const min = min_();
3285
3328
  const span = max_() - min;
@@ -3336,20 +3379,24 @@ function $0b7222ba8a8bb72f$var$LinearSlider({
3336
3379
  $gVhhF$solidjsweb.effect(_p$ => {
3337
3380
  var _v$10 = should_be_disabled_(),
3338
3381
  _v$11 = i18n_.range_filter_low_point_aria_label_(),
3339
- _v$12 = min_(),
3340
- _v$13 = max_(),
3341
- _v$14 = should_be_disabled_(),
3342
- _v$15 = i18n_.range_filter_high_point_aria_label_(),
3343
- _v$16 = min_(),
3344
- _v$17 = max_();
3382
+ _v$12 = formatRealPrice(get_current_range()[0]),
3383
+ _v$13 = min_(),
3384
+ _v$14 = max_(),
3385
+ _v$15 = should_be_disabled_(),
3386
+ _v$16 = i18n_.range_filter_high_point_aria_label_(),
3387
+ _v$17 = formatRealPrice(get_current_range()[1]),
3388
+ _v$18 = min_(),
3389
+ _v$19 = max_();
3345
3390
  _v$10 !== _p$.e && $gVhhF$solidjsweb.setProperty(_el$28, "disabled", _p$.e = _v$10);
3346
3391
  _v$11 !== _p$.t && $gVhhF$solidjsweb.setAttribute(_el$28, "aria-label", _p$.t = _v$11);
3347
- _v$12 !== _p$.a && $gVhhF$solidjsweb.setAttribute(_el$28, "min", _p$.a = _v$12);
3348
- _v$13 !== _p$.o && $gVhhF$solidjsweb.setAttribute(_el$28, "max", _p$.o = _v$13);
3349
- _v$14 !== _p$.i && $gVhhF$solidjsweb.setProperty(_el$29, "disabled", _p$.i = _v$14);
3350
- _v$15 !== _p$.n && $gVhhF$solidjsweb.setAttribute(_el$29, "aria-label", _p$.n = _v$15);
3351
- _v$16 !== _p$.s && $gVhhF$solidjsweb.setAttribute(_el$29, "min", _p$.s = _v$16);
3352
- _v$17 !== _p$.h && $gVhhF$solidjsweb.setAttribute(_el$29, "max", _p$.h = _v$17);
3392
+ _v$12 !== _p$.a && $gVhhF$solidjsweb.setAttribute(_el$28, "aria-valuetext", _p$.a = _v$12);
3393
+ _v$13 !== _p$.o && $gVhhF$solidjsweb.setAttribute(_el$28, "min", _p$.o = _v$13);
3394
+ _v$14 !== _p$.i && $gVhhF$solidjsweb.setAttribute(_el$28, "max", _p$.i = _v$14);
3395
+ _v$15 !== _p$.n && $gVhhF$solidjsweb.setProperty(_el$29, "disabled", _p$.n = _v$15);
3396
+ _v$16 !== _p$.s && $gVhhF$solidjsweb.setAttribute(_el$29, "aria-label", _p$.s = _v$16);
3397
+ _v$17 !== _p$.h && $gVhhF$solidjsweb.setAttribute(_el$29, "aria-valuetext", _p$.h = _v$17);
3398
+ _v$18 !== _p$.r && $gVhhF$solidjsweb.setAttribute(_el$29, "min", _p$.r = _v$18);
3399
+ _v$19 !== _p$.d && $gVhhF$solidjsweb.setAttribute(_el$29, "max", _p$.d = _v$19);
3353
3400
  return _p$;
3354
3401
  }, {
3355
3402
  e: undefined,
@@ -3359,7 +3406,9 @@ function $0b7222ba8a8bb72f$var$LinearSlider({
3359
3406
  i: undefined,
3360
3407
  n: undefined,
3361
3408
  s: undefined,
3362
- h: undefined
3409
+ h: undefined,
3410
+ r: undefined,
3411
+ d: undefined
3363
3412
  });
3364
3413
  $gVhhF$solidjsweb.effect(() => $gVhhF$solidjsweb.setProperty(_el$28, "value", $gVhhF$solidjs.createMemo(() => {
3365
3414
  min_();
@@ -3804,7 +3853,8 @@ function $3bdc00a1353c1150$export$a32086fa6616eafd({
3804
3853
  $gVhhF$solidjs.createRenderEffect(() => {
3805
3854
  set_view_more_button_below_group(some_top_level_are_hidden() ? $gVhhF$solidjsweb.createComponent((0, $0fe1e7efdf4200d6$export$ca21a16d65b3dd8), {
3806
3855
  show_extras_: show_extras,
3807
- i18n_: i18n_
3856
+ i18n_: i18n_,
3857
+ expanding_container_element_: expanding_container_els
3808
3858
  }) : []);
3809
3859
  });
3810
3860
  $gVhhF$solidjs.onCleanup(() => set_view_more_button_below_group());
@@ -4241,6 +4291,13 @@ const $0ef1681699140f1a$export$414f6a19d38e655c = ({
4241
4291
  _el$7 = _el$6.nextSibling,
4242
4292
  [_el$8, _co$2] = $gVhhF$solidjsweb.getNextMarker(_el$7.nextSibling);
4243
4293
  $gVhhF$solidjsweb.spread(_el$2, $gVhhF$solidjsweb.mergeProps(attributes, {
4294
+ "type": "button",
4295
+ get ["aria-pressed"]() {
4296
+ return is_selected();
4297
+ },
4298
+ get ["aria-label"]() {
4299
+ return $gVhhF$solidjsweb.memo(() => value().count_ != undefined)() ? `${label()}, ${value().count_}` : label();
4300
+ },
4244
4301
  get disabled() {
4245
4302
  return $gVhhF$solidjsweb.memo(() => !!count_zero())() && !is_selected();
4246
4303
  },
@@ -4444,7 +4501,14 @@ function $b51a2b8b9355e66c$export$82ed4b28ecb67608({
4444
4501
  return !!data?.some(item => $daa394359b026187$export$325f75597868c4f0(item) === value);
4445
4502
  });
4446
4503
  const value = $gVhhF$solidjs.createMemo(() => checkbox().value_);
4447
- const label_text = $gVhhF$solidjs.createMemo(() => checkbox().name_ || value() + "");
4504
+ const label_text = $gVhhF$solidjs.createMemo(() => {
4505
+ const name = checkbox().name_;
4506
+ if (name) return name;
4507
+ const value_string = value() + "";
4508
+ if (backendFilterV2()) return value_string;
4509
+ // Legacy values are "Name;#hex" - split is used to get the name so that screen readers don't announce the hex code
4510
+ return value_string.split(";")[0] || value_string;
4511
+ });
4448
4512
  const count = $gVhhF$solidjs.createMemo(() => checkbox().count_);
4449
4513
  const colorNameDatasetValue = $gVhhF$solidjs.createMemo(() => {
4450
4514
  if (backendFilterV2()) return label_text();
@@ -4531,7 +4595,8 @@ function $b51a2b8b9355e66c$export$82ed4b28ecb67608({
4531
4595
  $gVhhF$solidjs.createRenderEffect(() => {
4532
4596
  set_view_more_button_below_group_(togglable_rest() ? $gVhhF$solidjsweb.createComponent((0, $0fe1e7efdf4200d6$export$ca21a16d65b3dd8), {
4533
4597
  show_extras_: show_extras_signal,
4534
- i18n_: i18n_
4598
+ i18n_: i18n_,
4599
+ expanding_container_element_: expanding_container_els
4535
4600
  }) : []);
4536
4601
  });
4537
4602
  $gVhhF$solidjs.onCleanup(() => set_view_more_button_below_group_());
@@ -4916,7 +4981,7 @@ $gVhhF$solidjsweb.delegateEvents(["input", "click"]);
4916
4981
  var $aff9a96d30ed3563$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=filter-collapsible>`),
4917
4982
  $aff9a96d30ed3563$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button class=clear-group><!$><!/><span>`),
4918
4983
  $aff9a96d30ed3563$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=view-more-clear><!$><!/><!$><!/>`),
4919
- $aff9a96d30ed3563$var$_tmpl$4 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=filter-collapsible-body><div class=filter-part><!$><!/><!$><!/></div><!$><!/>`),
4984
+ $aff9a96d30ed3563$var$_tmpl$4 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=filter-collapsible-body><fieldset class=filter-part><!$><!/><!$><!/></fieldset><!$><!/>`),
4920
4985
  $aff9a96d30ed3563$var$_tmpl$5 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<details class=filter-collapsible>`),
4921
4986
  $aff9a96d30ed3563$var$_tmpl$6 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<summary class=filter-group-summary><div class=summary><span></span><div class=selected-w-sign><!$><!/><!$><!/>`),
4922
4987
  $aff9a96d30ed3563$var$_tmpl$7 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=ungrouped>`),
@@ -5006,6 +5071,7 @@ function $aff9a96d30ed3563$var$ActualFilterBody(props) {
5006
5071
  const a_filter_is_selected = $gVhhF$solidjs.createMemo(() => selected_filters_in_group().size);
5007
5072
  const [get_details_width, set_get_details_width] = $gVhhF$solidjs.createSignal();
5008
5073
  const details_element_width_ = $gVhhF$solidjs.createMemo(() => get_details_width?.()?.());
5074
+ const title_id = $gVhhF$depictaiutilishared.make_random_classname();
5009
5075
  return $gVhhF$solidjsweb.createComponent((0, $a69e505a12a77874$export$6c6d7a51fa9aa15d), {
5010
5076
  is_open_: is_open,
5011
5077
  get details_() {
@@ -5026,6 +5092,7 @@ function $aff9a96d30ed3563$var$ActualFilterBody(props) {
5026
5092
  [_el$25, _co$7] = $gVhhF$solidjsweb.getNextMarker(_el$24.nextSibling),
5027
5093
  _el$26 = _el$25.nextSibling,
5028
5094
  [_el$27, _co$8] = $gVhhF$solidjsweb.getNextMarker(_el$26.nextSibling);
5095
+ $gVhhF$solidjsweb.setAttribute(_el$22, "id", title_id);
5029
5096
  $gVhhF$solidjsweb.insert(_el$22, section_);
5030
5097
  $gVhhF$solidjsweb.insert(_el$23, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
5031
5098
  get when() {
@@ -5060,6 +5127,7 @@ function $aff9a96d30ed3563$var$ActualFilterBody(props) {
5060
5127
  [_el$7, _co$2] = $gVhhF$solidjsweb.getNextMarker(_el$6.nextSibling),
5061
5128
  _el$17 = _el$3.nextSibling,
5062
5129
  [_el$18, _co$6] = $gVhhF$solidjsweb.getNextMarker(_el$17.nextSibling);
5130
+ $gVhhF$solidjsweb.setAttribute(_el$3, "aria-labelledby", title_id);
5063
5131
  $gVhhF$solidjsweb.insert(_el$3, $gVhhF$solidjsweb.createComponent(SearchThisFilterGroup_, {}), _el$5, _co$);
5064
5132
  $gVhhF$solidjsweb.insert(_el$3, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Index), {
5065
5133
  get each() {
@@ -5921,8 +5989,8 @@ var $f49857214f7675b1$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<svg
5921
5989
  function $f49857214f7675b1$export$cb808a3c41736d8e() {
5922
5990
  return $gVhhF$solidjsweb.getNextElement($f49857214f7675b1$var$_tmpl$);
5923
5991
  }
5924
- var $f8f64d05c525825b$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=filters><div class=body>`),
5925
- $f8f64d05c525825b$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=sorting><div class=body>`),
5992
+ var $f8f64d05c525825b$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<section class=filters tabindex=-1><div class=body>`),
5993
+ $f8f64d05c525825b$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<section class=sorting tabindex=-1><div class=body>`),
5926
5994
  $f8f64d05c525825b$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=sort-and-filter-buttons><div class=outer><div class=inner><!$><!/><!$><!/><!$><!/>`),
5927
5995
  $f8f64d05c525825b$var$_tmpl$4 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<span class=num-filters>`),
5928
5996
  $f8f64d05c525825b$var$_tmpl$5 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=open-filters-button-container><!$><!/><button type=button><!$><!/><span>`),
@@ -5991,6 +6059,27 @@ function $f8f64d05c525825b$export$d7841e452f2e59a8({
5991
6059
  available_sortings_: available_sortings_,
5992
6060
  meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
5993
6061
  };
6062
+ // Keyboard accessibility for the desktop panels (rendered after the product grid in the DOM): when the user
6063
+ // opens a panel we move focus into it, and restore focus to the toggle button on close. Intent is tracked with
6064
+ // a plain flag set in the buttons' click handlers - `filters_open`/`sorting_open` also change programmatically
6065
+ // (undo toast, history-state restore, SDK consumers), and those must not steal focus.
6066
+ let user_opened_panel = false;
6067
+ let filter_toggle_button;
6068
+ let sort_toggle_button;
6069
+ let current_panel;
6070
+ let current_panel_toggle_button;
6071
+ const focus_panel_when_in_dom = panel => $gVhhF$depictaiutilishared.catchify(async () => {
6072
+ // Bounded wait: if the panel never lands in the DOM (e.g. it's superseded by a rapid re-render before
6073
+ // insertion), the timeout lets this promise resolve instead of keeping `panel` - and the observer
6074
+ // listener it registers - referenced forever.
6075
+ await (0, $gVhhF$depictaiutilishared.observer).wait_for_element(panel, 4000);
6076
+ if (panel.isConnected) panel.focus();
6077
+ })();
6078
+ const register_desktop_panel = (el, toggle_button, should_focus) => {
6079
+ current_panel = el;
6080
+ current_panel_toggle_button = toggle_button;
6081
+ if (should_focus) focus_panel_when_in_dom(el);
6082
+ };
5994
6083
  const make_open_filters_button = (adhere_to_width = false, is_tabbable = false) => $gVhhF$solidjsweb.createComponent($f8f64d05c525825b$var$OpenFiltersButton, {
5995
6084
  tabindex_: is_tabbable ? 0 : -1,
5996
6085
  i18n_: i18n_,
@@ -5998,7 +6087,9 @@ function $f8f64d05c525825b$export$d7841e452f2e59a8({
5998
6087
  search_sorting_open_: search_sorting_open_,
5999
6088
  number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_,
6000
6089
  filter_button_width_: adhere_to_width ? filter_button_width_ : undefined,
6001
- hide_button_: hide_filters
6090
+ hide_button_: hide_filters,
6091
+ on_user_open_: () => user_opened_panel = true,
6092
+ button_ref_: is_tabbable ? el => filter_toggle_button = el : undefined
6002
6093
  });
6003
6094
  const make_open_sorting_button = (adhere_to_width = false, is_tabbable = false) => $gVhhF$solidjsweb.createComponent($f8f64d05c525825b$var$OpenSortingButton, {
6004
6095
  tabindex_: is_tabbable ? 0 : -1,
@@ -6008,7 +6099,9 @@ function $f8f64d05c525825b$export$d7841e452f2e59a8({
6008
6099
  search_sorting_open_: search_sorting_open_,
6009
6100
  available_sortings_: available_sortings_,
6010
6101
  sort_button_width_: adhere_to_width ? sort_button_width_ : undefined,
6011
- meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
6102
+ meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_,
6103
+ on_user_open_: () => user_opened_panel = true,
6104
+ button_ref_: is_tabbable ? el => sort_toggle_button = el : undefined
6012
6105
  });
6013
6106
  let open_modal_;
6014
6107
  let close_modal_;
@@ -6027,9 +6120,46 @@ function $f8f64d05c525825b$export$d7841e452f2e59a8({
6027
6120
  grid_is_in_original_state = true;
6028
6121
  }
6029
6122
  });
6123
+ // Restore focus to the relevant toggle button when a desktop panel is torn down while focus is still inside it.
6124
+ const restore_focus_to_toggle_on_close = () => {
6125
+ const button_to_restore = current_panel_toggle_button;
6126
+ const focus_was_in_panel = !!current_panel && current_panel.contains(document.activeElement);
6127
+ current_panel = undefined;
6128
+ current_panel_toggle_button = undefined;
6129
+ if (focus_was_in_panel) button_to_restore?.focus();
6130
+ };
6131
+ // `<section>` + `aria-label` so the panel announces itself ("Filters"/"Sort") when we move focus to it; the bare
6132
+ // tabindex=-1 container would otherwise give screen readers nothing to read on focus. A semantic <section> avoids
6133
+ // an ARIA role and the UA styling pitfalls of <fieldset>; the existing CSS targets the `.filters`/`.sorting` class.
6134
+ const FiltersPanel = should_focus => $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
6135
+ get when() {
6136
+ return !hide_filters();
6137
+ },
6138
+ get children() {
6139
+ var _el$ = $gVhhF$solidjsweb.getNextElement($f8f64d05c525825b$var$_tmpl$),
6140
+ _el$2 = _el$.firstChild;
6141
+ $gVhhF$solidjsweb.use(el => register_desktop_panel(el, filter_toggle_button, should_focus), _el$);
6142
+ $gVhhF$solidjsweb.insert(_el$2, $gVhhF$solidjsweb.createComponent((0, $aff9a96d30ed3563$export$3f1a388cc0d8fed7), filter_options));
6143
+ $gVhhF$solidjsweb.effect(() => $gVhhF$solidjsweb.setAttribute(_el$, "aria-label", i18n_.filters_()));
6144
+ return _el$;
6145
+ }
6146
+ });
6147
+ const SortingPanel = should_focus => (() => {
6148
+ var _el$3 = $gVhhF$solidjsweb.getNextElement($f8f64d05c525825b$var$_tmpl$2),
6149
+ _el$4 = _el$3.firstChild;
6150
+ $gVhhF$solidjsweb.use(el => register_desktop_panel(el, sort_toggle_button, should_focus), _el$3);
6151
+ $gVhhF$solidjsweb.insert(_el$4, $gVhhF$solidjsweb.createComponent((0, $be89be42ce9ea60f$export$1f1775a58da589b5), sorting_options));
6152
+ $gVhhF$solidjsweb.effect(() => $gVhhF$solidjsweb.setAttribute(_el$3, "aria-label", i18n_.sorting_text_()));
6153
+ return _el$3;
6154
+ })();
6030
6155
  $gVhhF$solidjs.createEffect(() => {
6156
+ // Consume the user-intent flag once per run, in every branch, so a stale flag can't leak into a later
6157
+ // resize-triggered re-render and steal focus.
6158
+ const should_focus_panel = user_opened_panel;
6159
+ user_opened_panel = false;
6031
6160
  if (!filters_open() && !sorting_open()) {
6032
6161
  close_modal_?.();
6162
+ restore_focus_to_toggle_on_close();
6033
6163
  set_extra_els_in_results_container_("");
6034
6164
  } else if (isSmall()()) {
6035
6165
  if ($gVhhF$solidjs.untrack(() => input_modal_open_?.())) {
@@ -6038,26 +6168,14 @@ function $f8f64d05c525825b$export$d7841e452f2e59a8({
6038
6168
  set_sorting_open(false);
6039
6169
  return;
6040
6170
  }
6171
+ // The modal manages its own focus; just drop the desktop panel reference.
6172
+ current_panel = undefined;
6173
+ current_panel_toggle_button = undefined;
6041
6174
  open_modal_?.();
6042
6175
  set_extra_els_in_results_container_("");
6043
6176
  } else {
6044
6177
  close_modal_?.();
6045
- if (filters_open()) set_extra_els_in_results_container_(() => $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
6046
- get when() {
6047
- return !hide_filters();
6048
- },
6049
- get children() {
6050
- var _el$ = $gVhhF$solidjsweb.getNextElement($f8f64d05c525825b$var$_tmpl$),
6051
- _el$2 = _el$.firstChild;
6052
- $gVhhF$solidjsweb.insert(_el$2, $gVhhF$solidjsweb.createComponent((0, $aff9a96d30ed3563$export$3f1a388cc0d8fed7), filter_options));
6053
- return _el$;
6054
- }
6055
- }));else set_extra_els_in_results_container_((() => {
6056
- var _el$3 = $gVhhF$solidjsweb.getNextElement($f8f64d05c525825b$var$_tmpl$2),
6057
- _el$4 = _el$3.firstChild;
6058
- $gVhhF$solidjsweb.insert(_el$4, $gVhhF$solidjsweb.createComponent((0, $be89be42ce9ea60f$export$1f1775a58da589b5), sorting_options));
6059
- return _el$3;
6060
- })());
6178
+ if (filters_open()) set_extra_els_in_results_container_(() => FiltersPanel(should_focus_panel));else set_extra_els_in_results_container_(SortingPanel(should_focus_panel));
6061
6179
  }
6062
6180
  });
6063
6181
  $gVhhF$depictaiutilishared.catchify(async () => {
@@ -6121,7 +6239,9 @@ function $f8f64d05c525825b$var$OpenFiltersButton({
6121
6239
  filter_button_width_: filter_button_width_,
6122
6240
  tabindex_: tabindex_,
6123
6241
  number_of_rendered_selected_filters_items_: [num_selected_filters],
6124
- hide_button_: hide_button_
6242
+ hide_button_: hide_button_,
6243
+ on_user_open_: on_user_open_,
6244
+ button_ref_: button_ref_
6125
6245
  }) {
6126
6246
  const filters_closed = $gVhhF$solidjs.createMemo(() => !search_filters_open_[0]());
6127
6247
  // We assume in embedded_num_products that this is a single HTMLElement so pls change there if you change it here
@@ -6149,9 +6269,12 @@ function $f8f64d05c525825b$var$OpenFiltersButton({
6149
6269
  search_filters_open_[1](false);
6150
6270
  return;
6151
6271
  }
6272
+ on_user_open_?.();
6152
6273
  search_filters_open_[1](true);
6153
6274
  search_sorting_open_[1](false);
6154
6275
  })), true);
6276
+ var _ref$2 = button_ref_;
6277
+ typeof _ref$2 === "function" ? $gVhhF$solidjsweb.use(_ref$2, _el$16) : button_ref_ = _el$16;
6155
6278
  $gVhhF$solidjsweb.setAttribute(_el$16, "tabindex", tabindex_);
6156
6279
  $gVhhF$solidjsweb.className(_el$16, "filter toggle-button major-minor-transition" + ((0, $gVhhF$solidjsweb.isServer) ? " minor" : ""));
6157
6280
  $gVhhF$solidjsweb.insert(_el$16, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
@@ -6173,21 +6296,24 @@ function $f8f64d05c525825b$var$OpenFiltersButton({
6173
6296
  _v$2 = !filters_closed(),
6174
6297
  _v$3 = !!filters_closed(),
6175
6298
  _v$4 = (filters_closed() ? i18n_.open_filters_ : i18n_.close_filters_)(),
6176
- _v$5 = filter_button_width_?.() ? {
6299
+ _v$5 = !filters_closed(),
6300
+ _v$6 = filter_button_width_?.() ? {
6177
6301
  width: filter_button_width_() + "px"
6178
6302
  } : {};
6179
6303
  _p$.e = $gVhhF$solidjsweb.style(_el$14, _v$, _p$.e);
6180
6304
  _v$2 !== _p$.t && _el$16.classList.toggle("major", _p$.t = _v$2);
6181
6305
  _v$3 !== _p$.a && _el$16.classList.toggle("minor", _p$.a = _v$3);
6182
6306
  _v$4 !== _p$.o && $gVhhF$solidjsweb.setAttribute(_el$16, "aria-label", _p$.o = _v$4);
6183
- _p$.i = $gVhhF$solidjsweb.style(_el$16, _v$5, _p$.i);
6307
+ _v$5 !== _p$.i && $gVhhF$solidjsweb.setAttribute(_el$16, "aria-expanded", _p$.i = _v$5);
6308
+ _p$.n = $gVhhF$solidjsweb.style(_el$16, _v$6, _p$.n);
6184
6309
  return _p$;
6185
6310
  }, {
6186
6311
  e: undefined,
6187
6312
  t: undefined,
6188
6313
  a: undefined,
6189
6314
  o: undefined,
6190
- i: undefined
6315
+ i: undefined,
6316
+ n: undefined
6191
6317
  });
6192
6318
  $gVhhF$solidjsweb.runHydrationEvents();
6193
6319
  return _el$14;
@@ -6201,7 +6327,9 @@ function $f8f64d05c525825b$var$OpenSortingButton({
6201
6327
  search_sorting_open_: search_sorting_open_,
6202
6328
  sort_button_width_: sort_button_width_,
6203
6329
  tabindex_: tabindex_,
6204
- meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
6330
+ meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_,
6331
+ on_user_open_: on_user_open_,
6332
+ button_ref_: button_ref_
6205
6333
  }) {
6206
6334
  const sorting_closed = $gVhhF$solidjs.createMemo(() => !search_sorting_open_[0]());
6207
6335
  // We assume in embedded_num_products that this is a single HTMLElement so pls change there if you change it here
@@ -6215,9 +6343,12 @@ function $f8f64d05c525825b$var$OpenSortingButton({
6215
6343
  search_sorting_open_[1](false);
6216
6344
  return;
6217
6345
  }
6346
+ on_user_open_?.();
6218
6347
  search_filters_open_[1](false);
6219
6348
  search_sorting_open_[1](true);
6220
6349
  })), true);
6350
+ var _ref$3 = button_ref_;
6351
+ typeof _ref$3 === "function" ? $gVhhF$solidjsweb.use(_ref$3, _el$22) : button_ref_ = _el$22;
6221
6352
  $gVhhF$solidjsweb.setAttribute(_el$22, "tabindex", tabindex_);
6222
6353
  $gVhhF$solidjsweb.insert(_el$23, (() => {
6223
6354
  var _c$ = $gVhhF$solidjsweb.memo(() => !!sorting_closed());
@@ -6239,22 +6370,25 @@ function $f8f64d05c525825b$var$OpenSortingButton({
6239
6370
  }
6240
6371
  }), _el$25, _co$6);
6241
6372
  $gVhhF$solidjsweb.effect(_p$ => {
6242
- var _v$6 = !sorting_closed(),
6243
- _v$7 = !!sorting_closed(),
6244
- _v$8 = (sorting_closed() ? i18n_.open_sorting_ : i18n_.close_sorting_)(),
6245
- _v$9 = sort_button_width_?.() ? {
6373
+ var _v$7 = !sorting_closed(),
6374
+ _v$8 = !!sorting_closed(),
6375
+ _v$9 = (sorting_closed() ? i18n_.open_sorting_ : i18n_.close_sorting_)(),
6376
+ _v$10 = !sorting_closed(),
6377
+ _v$11 = sort_button_width_?.() ? {
6246
6378
  width: sort_button_width_() + "px"
6247
6379
  } : {};
6248
- _v$6 !== _p$.e && _el$22.classList.toggle("major", _p$.e = _v$6);
6249
- _v$7 !== _p$.t && _el$22.classList.toggle("minor", _p$.t = _v$7);
6250
- _v$8 !== _p$.a && $gVhhF$solidjsweb.setAttribute(_el$22, "aria-label", _p$.a = _v$8);
6251
- _p$.o = $gVhhF$solidjsweb.style(_el$22, _v$9, _p$.o);
6380
+ _v$7 !== _p$.e && _el$22.classList.toggle("major", _p$.e = _v$7);
6381
+ _v$8 !== _p$.t && _el$22.classList.toggle("minor", _p$.t = _v$8);
6382
+ _v$9 !== _p$.a && $gVhhF$solidjsweb.setAttribute(_el$22, "aria-label", _p$.a = _v$9);
6383
+ _v$10 !== _p$.o && $gVhhF$solidjsweb.setAttribute(_el$22, "aria-expanded", _p$.o = _v$10);
6384
+ _p$.i = $gVhhF$solidjsweb.style(_el$22, _v$11, _p$.i);
6252
6385
  return _p$;
6253
6386
  }, {
6254
6387
  e: undefined,
6255
6388
  t: undefined,
6256
6389
  a: undefined,
6257
- o: undefined
6390
+ o: undefined,
6391
+ i: undefined
6258
6392
  });
6259
6393
  $gVhhF$solidjsweb.runHydrationEvents();
6260
6394
  return _el$22;
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.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
  */