@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.js CHANGED
@@ -7,7 +7,7 @@ import { createStore as $9HbP8$createStore, reconcile as $9HbP8$reconcile } from
7
7
  /*! Depict.ai search and product listing SDK */
8
8
  import { register_es_version } from "../multi_import_deduplicator.mjs";
9
9
  register_es_version("ui", "latest");
10
- const $ec291e0010116877$export$83d89fbfd8236492 = "4.10.12";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "4.10.14";
11
11
  function $dc9262ef6f786812$export$d9f36cf74e24d595(media_query) {
12
12
  const signal = $9HbP8$createSignal(false);
13
13
  $9HbP8$onCleanup($9HbP8$javascript_media_query(media_query, ({
@@ -2599,20 +2599,54 @@ function $f8a56ba74eedd0c6$export$f21ab0717a89c77f(props) {
2599
2599
  var $67b173f9db427028$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<button type=button class=expand-filter><!$><!/><span>`);
2600
2600
  function $67b173f9db427028$export$ca21a16d65b3dd8({
2601
2601
  show_extras_: [get_show_extras, set_show_extras],
2602
- i18n_: i18n_
2602
+ i18n_: i18n_,
2603
+ expanding_container_element_: expanding_container_element_
2603
2604
  }) {
2605
+ let button;
2604
2606
  return (() => {
2605
2607
  var _el$ = $9HbP8$getNextElement($67b173f9db427028$var$_tmpl$),
2606
2608
  _el$3 = _el$.firstChild,
2607
2609
  [_el$4, _co$] = $9HbP8$getNextMarker(_el$3.nextSibling),
2608
2610
  _el$2 = _el$4.nextSibling;
2609
- $9HbP8$addEventListener(_el$, "click", $9HbP8$catchify1(() => set_show_extras(p => !p)), true);
2611
+ $9HbP8$addEventListener(_el$, "click", $9HbP8$catchify1(event => {
2612
+ const container = expanding_container_element_;
2613
+ const will_expand = !get_show_extras();
2614
+ // A click from Enter/Space on the button reports `detail === 0`; a real pointer click reports >= 1.
2615
+ // Only hijack focus for keyboard activation - mouse users can see the revealed options and don't need it
2616
+ // (and would otherwise get the viewport scrolled and an unexpected focus ring).
2617
+ const keyboard_activated = event.detail === 0;
2618
+ const had_focus_inside = !!container && container.contains(document.activeElement);
2619
+ set_show_extras(will_expand);
2620
+ if (will_expand) {
2621
+ if (!keyboard_activated) return;
2622
+ // The container's `expand()` (run from the consumer's effect after this handler) clears `inert`/`visibility`;
2623
+ // focus the first revealed option on the next frame so Tab continues through the newly shown options.
2624
+ // `preventScroll` so moving focus never yanks the viewport down to the first checkbox.
2625
+ requestAnimationFrame($9HbP8$catchify1(() => container?.querySelector("input:not(:disabled)")?.focus({
2626
+ preventScroll: true
2627
+ })));
2628
+ } else if (had_focus_inside)
2629
+ // Keep focus on the toggle when collapsing, otherwise making the container `inert` dumps focus to <body>
2630
+ // (Safari doesn't focus buttons on mouse click, so focus can still be inside the container here).
2631
+ button.focus();
2632
+ }), true);
2633
+ var _ref$ = button;
2634
+ typeof _ref$ === "function" ? $9HbP8$use(_ref$, _el$) : button = _el$;
2610
2635
  $9HbP8$insert(_el$, $9HbP8$createComponent((0, $f8a56ba74eedd0c6$export$f21ab0717a89c77f), {}), _el$4, _co$);
2611
2636
  $9HbP8$insert(_el$2, (() => {
2612
2637
  var _c$ = $9HbP8$memo(() => !!get_show_extras());
2613
2638
  return () => _c$() ? i18n_.view_less_() : i18n_.view_more_();
2614
2639
  })());
2615
- $9HbP8$effect(() => _el$.classList.toggle("expanded", !!get_show_extras()));
2640
+ $9HbP8$effect(_p$ => {
2641
+ var _v$ = get_show_extras(),
2642
+ _v$2 = !!get_show_extras();
2643
+ _v$ !== _p$.e && $9HbP8$setAttribute(_el$, "aria-expanded", _p$.e = _v$);
2644
+ _v$2 !== _p$.t && _el$.classList.toggle("expanded", _p$.t = _v$2);
2645
+ return _p$;
2646
+ }, {
2647
+ e: undefined,
2648
+ t: undefined
2649
+ });
2616
2650
  $9HbP8$runHydrationEvents();
2617
2651
  return _el$;
2618
2652
  })();
@@ -2787,7 +2821,8 @@ function $a4601e6bea3ed1e6$export$dd948f91abc3a1c4({
2787
2821
  $9HbP8$createRenderEffect(() => {
2788
2822
  set_view_more_button_below_group_(togglable_rest() ? $9HbP8$createComponent((0, $67b173f9db427028$export$ca21a16d65b3dd8), {
2789
2823
  show_extras_: show_extras_signal,
2790
- i18n_: i18n_
2824
+ i18n_: i18n_,
2825
+ expanding_container_element_: expanding_container_els
2791
2826
  }) : []);
2792
2827
  });
2793
2828
  $9HbP8$onCleanup(() => set_view_more_button_below_group_());
@@ -2931,7 +2966,7 @@ function $eb8d9bf3b5700c26$export$430444115f70a734({
2931
2966
  return _el$;
2932
2967
  })();
2933
2968
  }
2934
- var $a6b08770e164eced$var$_tmpl$ = /*#__PURE__*/$9HbP8$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><!$><!/><!$><!/><!$><!/>`),
2969
+ var $a6b08770e164eced$var$_tmpl$ = /*#__PURE__*/$9HbP8$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><!$><!/><!$><!/><!$><!/>`),
2935
2970
  $a6b08770e164eced$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<div class=slider><div class=progress>`),
2936
2971
  $a6b08770e164eced$var$_tmpl$3 = /*#__PURE__*/$9HbP8$template(`<div class=range-group><input type=range step=any><input type=range step=any>`);
2937
2972
  function $a6b08770e164eced$export$e0d834a0ad870cda({
@@ -3065,7 +3100,8 @@ function $a6b08770e164eced$var$RangeSelector({
3065
3100
  min_: min_,
3066
3101
  current_range_: current_range_,
3067
3102
  i18n_: i18n_,
3068
- should_be_disabled_: should_be_disabled_
3103
+ should_be_disabled_: should_be_disabled_,
3104
+ priceFormatting_: price_formatting_
3069
3105
  }), _el$24, _co$7);
3070
3106
  $9HbP8$insert(_el$9, pre_price, _el$11, _co$);
3071
3107
  $9HbP8$insert(_el$9, $9HbP8$createComponent((0, $8c0f86cb3e266eeb$export$a71e92cfbb498adc), {
@@ -3129,7 +3165,8 @@ function $a6b08770e164eced$var$ExponentialSlider({
3129
3165
  min_: min_,
3130
3166
  i18n_: i18n_,
3131
3167
  max_: max_,
3132
- should_be_disabled_: should_be_disabled_
3168
+ should_be_disabled_: should_be_disabled_,
3169
+ priceFormatting_: priceFormatting_
3133
3170
  }) {
3134
3171
  // inspired by https://observablehq.com/@mbostock/nonlinear-slider
3135
3172
  const transform_linear_to_nonlinear = ([smaller, larger]) => [Math.sqrt(smaller), Math.sqrt(larger)];
@@ -3163,7 +3200,8 @@ function $a6b08770e164eced$var$ExponentialSlider({
3163
3200
  max_: modified_max,
3164
3201
  offset_value_calculator_: offset_value_calculator_,
3165
3202
  i18n_: i18n_,
3166
- should_be_disabled_: should_be_disabled_
3203
+ should_be_disabled_: should_be_disabled_,
3204
+ priceFormatting_: priceFormatting_
3167
3205
  });
3168
3206
  }
3169
3207
  function $a6b08770e164eced$var$LinearSlider({
@@ -3172,12 +3210,17 @@ function $a6b08770e164eced$var$LinearSlider({
3172
3210
  current_range_: current_range_,
3173
3211
  offset_value_calculator_: offset_value_calculator_,
3174
3212
  i18n_: i18n_,
3175
- should_be_disabled_: should_be_disabled_
3213
+ should_be_disabled_: should_be_disabled_,
3214
+ priceFormatting_: priceFormatting_
3176
3215
  }) {
3177
3216
  let range_input_1;
3178
3217
  let range_input_2;
3179
3218
  let clickable_slider;
3180
3219
  const [get_current_range, set_current_range] = current_range_;
3220
+ const formatRealPrice = value => {
3221
+ const priceFormatting = priceFormatting_();
3222
+ return priceFormatting.pre_ + $9HbP8$standard_price_format(value, priceFormatting.places_after_comma_, priceFormatting.decimal_places_delimiter_, priceFormatting.thousands_delimiter_) + priceFormatting.post_;
3223
+ };
3181
3224
  const progress_styling = $9HbP8$createMemo(() => {
3182
3225
  const min = min_();
3183
3226
  const span = max_() - min;
@@ -3234,20 +3277,24 @@ function $a6b08770e164eced$var$LinearSlider({
3234
3277
  $9HbP8$effect(_p$ => {
3235
3278
  var _v$10 = should_be_disabled_(),
3236
3279
  _v$11 = i18n_.range_filter_low_point_aria_label_(),
3237
- _v$12 = min_(),
3238
- _v$13 = max_(),
3239
- _v$14 = should_be_disabled_(),
3240
- _v$15 = i18n_.range_filter_high_point_aria_label_(),
3241
- _v$16 = min_(),
3242
- _v$17 = max_();
3280
+ _v$12 = formatRealPrice(get_current_range()[0]),
3281
+ _v$13 = min_(),
3282
+ _v$14 = max_(),
3283
+ _v$15 = should_be_disabled_(),
3284
+ _v$16 = i18n_.range_filter_high_point_aria_label_(),
3285
+ _v$17 = formatRealPrice(get_current_range()[1]),
3286
+ _v$18 = min_(),
3287
+ _v$19 = max_();
3243
3288
  _v$10 !== _p$.e && $9HbP8$setProperty(_el$28, "disabled", _p$.e = _v$10);
3244
3289
  _v$11 !== _p$.t && $9HbP8$setAttribute(_el$28, "aria-label", _p$.t = _v$11);
3245
- _v$12 !== _p$.a && $9HbP8$setAttribute(_el$28, "min", _p$.a = _v$12);
3246
- _v$13 !== _p$.o && $9HbP8$setAttribute(_el$28, "max", _p$.o = _v$13);
3247
- _v$14 !== _p$.i && $9HbP8$setProperty(_el$29, "disabled", _p$.i = _v$14);
3248
- _v$15 !== _p$.n && $9HbP8$setAttribute(_el$29, "aria-label", _p$.n = _v$15);
3249
- _v$16 !== _p$.s && $9HbP8$setAttribute(_el$29, "min", _p$.s = _v$16);
3250
- _v$17 !== _p$.h && $9HbP8$setAttribute(_el$29, "max", _p$.h = _v$17);
3290
+ _v$12 !== _p$.a && $9HbP8$setAttribute(_el$28, "aria-valuetext", _p$.a = _v$12);
3291
+ _v$13 !== _p$.o && $9HbP8$setAttribute(_el$28, "min", _p$.o = _v$13);
3292
+ _v$14 !== _p$.i && $9HbP8$setAttribute(_el$28, "max", _p$.i = _v$14);
3293
+ _v$15 !== _p$.n && $9HbP8$setProperty(_el$29, "disabled", _p$.n = _v$15);
3294
+ _v$16 !== _p$.s && $9HbP8$setAttribute(_el$29, "aria-label", _p$.s = _v$16);
3295
+ _v$17 !== _p$.h && $9HbP8$setAttribute(_el$29, "aria-valuetext", _p$.h = _v$17);
3296
+ _v$18 !== _p$.r && $9HbP8$setAttribute(_el$29, "min", _p$.r = _v$18);
3297
+ _v$19 !== _p$.d && $9HbP8$setAttribute(_el$29, "max", _p$.d = _v$19);
3251
3298
  return _p$;
3252
3299
  }, {
3253
3300
  e: undefined,
@@ -3257,7 +3304,9 @@ function $a6b08770e164eced$var$LinearSlider({
3257
3304
  i: undefined,
3258
3305
  n: undefined,
3259
3306
  s: undefined,
3260
- h: undefined
3307
+ h: undefined,
3308
+ r: undefined,
3309
+ d: undefined
3261
3310
  });
3262
3311
  $9HbP8$effect(() => $9HbP8$setProperty(_el$28, "value", $9HbP8$createMemo(() => {
3263
3312
  min_();
@@ -3702,7 +3751,8 @@ function $1c8cac76cb67e9af$export$a32086fa6616eafd({
3702
3751
  $9HbP8$createRenderEffect(() => {
3703
3752
  set_view_more_button_below_group(some_top_level_are_hidden() ? $9HbP8$createComponent((0, $67b173f9db427028$export$ca21a16d65b3dd8), {
3704
3753
  show_extras_: show_extras,
3705
- i18n_: i18n_
3754
+ i18n_: i18n_,
3755
+ expanding_container_element_: expanding_container_els
3706
3756
  }) : []);
3707
3757
  });
3708
3758
  $9HbP8$onCleanup(() => set_view_more_button_below_group());
@@ -4139,6 +4189,13 @@ const $93716a9ad0dea854$export$414f6a19d38e655c = ({
4139
4189
  _el$7 = _el$6.nextSibling,
4140
4190
  [_el$8, _co$2] = $9HbP8$getNextMarker(_el$7.nextSibling);
4141
4191
  $9HbP8$spread(_el$2, $9HbP8$mergeProps1(attributes, {
4192
+ "type": "button",
4193
+ get ["aria-pressed"]() {
4194
+ return is_selected();
4195
+ },
4196
+ get ["aria-label"]() {
4197
+ return $9HbP8$memo(() => value().count_ != undefined)() ? `${label()}, ${value().count_}` : label();
4198
+ },
4142
4199
  get disabled() {
4143
4200
  return $9HbP8$memo(() => !!count_zero())() && !is_selected();
4144
4201
  },
@@ -4342,7 +4399,14 @@ function $e731d52d97444b7c$export$82ed4b28ecb67608({
4342
4399
  return !!data?.some(item => $91aa8ee9f431800d$export$325f75597868c4f0(item) === value);
4343
4400
  });
4344
4401
  const value = $9HbP8$createMemo(() => checkbox().value_);
4345
- const label_text = $9HbP8$createMemo(() => checkbox().name_ || value() + "");
4402
+ const label_text = $9HbP8$createMemo(() => {
4403
+ const name = checkbox().name_;
4404
+ if (name) return name;
4405
+ const value_string = value() + "";
4406
+ if (backendFilterV2()) return value_string;
4407
+ // Legacy values are "Name;#hex" - split is used to get the name so that screen readers don't announce the hex code
4408
+ return value_string.split(";")[0] || value_string;
4409
+ });
4346
4410
  const count = $9HbP8$createMemo(() => checkbox().count_);
4347
4411
  const colorNameDatasetValue = $9HbP8$createMemo(() => {
4348
4412
  if (backendFilterV2()) return label_text();
@@ -4429,7 +4493,8 @@ function $e731d52d97444b7c$export$82ed4b28ecb67608({
4429
4493
  $9HbP8$createRenderEffect(() => {
4430
4494
  set_view_more_button_below_group_(togglable_rest() ? $9HbP8$createComponent((0, $67b173f9db427028$export$ca21a16d65b3dd8), {
4431
4495
  show_extras_: show_extras_signal,
4432
- i18n_: i18n_
4496
+ i18n_: i18n_,
4497
+ expanding_container_element_: expanding_container_els
4433
4498
  }) : []);
4434
4499
  });
4435
4500
  $9HbP8$onCleanup(() => set_view_more_button_below_group_());
@@ -4814,7 +4879,7 @@ $9HbP8$delegateEvents(["input", "click"]);
4814
4879
  var $fab07f52c9861732$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class=filter-collapsible>`),
4815
4880
  $fab07f52c9861732$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<button class=clear-group><!$><!/><span>`),
4816
4881
  $fab07f52c9861732$var$_tmpl$3 = /*#__PURE__*/$9HbP8$template(`<div class=view-more-clear><!$><!/><!$><!/>`),
4817
- $fab07f52c9861732$var$_tmpl$4 = /*#__PURE__*/$9HbP8$template(`<div class=filter-collapsible-body><div class=filter-part><!$><!/><!$><!/></div><!$><!/>`),
4882
+ $fab07f52c9861732$var$_tmpl$4 = /*#__PURE__*/$9HbP8$template(`<div class=filter-collapsible-body><fieldset class=filter-part><!$><!/><!$><!/></fieldset><!$><!/>`),
4818
4883
  $fab07f52c9861732$var$_tmpl$5 = /*#__PURE__*/$9HbP8$template(`<details class=filter-collapsible>`),
4819
4884
  $fab07f52c9861732$var$_tmpl$6 = /*#__PURE__*/$9HbP8$template(`<summary class=filter-group-summary><div class=summary><span></span><div class=selected-w-sign><!$><!/><!$><!/>`),
4820
4885
  $fab07f52c9861732$var$_tmpl$7 = /*#__PURE__*/$9HbP8$template(`<div class=ungrouped>`),
@@ -4904,6 +4969,7 @@ function $fab07f52c9861732$var$ActualFilterBody(props) {
4904
4969
  const a_filter_is_selected = $9HbP8$createMemo(() => selected_filters_in_group().size);
4905
4970
  const [get_details_width, set_get_details_width] = $9HbP8$createSignal();
4906
4971
  const details_element_width_ = $9HbP8$createMemo(() => get_details_width?.()?.());
4972
+ const title_id = $9HbP8$make_random_classname();
4907
4973
  return $9HbP8$createComponent((0, $6bb0a0c563dff4bb$export$6c6d7a51fa9aa15d), {
4908
4974
  is_open_: is_open,
4909
4975
  get details_() {
@@ -4924,6 +4990,7 @@ function $fab07f52c9861732$var$ActualFilterBody(props) {
4924
4990
  [_el$25, _co$7] = $9HbP8$getNextMarker(_el$24.nextSibling),
4925
4991
  _el$26 = _el$25.nextSibling,
4926
4992
  [_el$27, _co$8] = $9HbP8$getNextMarker(_el$26.nextSibling);
4993
+ $9HbP8$setAttribute(_el$22, "id", title_id);
4927
4994
  $9HbP8$insert(_el$22, section_);
4928
4995
  $9HbP8$insert(_el$23, $9HbP8$createComponent((0, $9HbP8$Show), {
4929
4996
  get when() {
@@ -4958,6 +5025,7 @@ function $fab07f52c9861732$var$ActualFilterBody(props) {
4958
5025
  [_el$7, _co$2] = $9HbP8$getNextMarker(_el$6.nextSibling),
4959
5026
  _el$17 = _el$3.nextSibling,
4960
5027
  [_el$18, _co$6] = $9HbP8$getNextMarker(_el$17.nextSibling);
5028
+ $9HbP8$setAttribute(_el$3, "aria-labelledby", title_id);
4961
5029
  $9HbP8$insert(_el$3, $9HbP8$createComponent(SearchThisFilterGroup_, {}), _el$5, _co$);
4962
5030
  $9HbP8$insert(_el$3, $9HbP8$createComponent((0, $9HbP8$Index), {
4963
5031
  get each() {
@@ -5819,8 +5887,8 @@ var $11d594c749b76228$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<svg xmlns=http
5819
5887
  function $11d594c749b76228$export$cb808a3c41736d8e() {
5820
5888
  return $9HbP8$getNextElement($11d594c749b76228$var$_tmpl$);
5821
5889
  }
5822
- var $cdea4cf8c5c071ef$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class=filters><div class=body>`),
5823
- $cdea4cf8c5c071ef$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<div class=sorting><div class=body>`),
5890
+ var $cdea4cf8c5c071ef$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<section class=filters tabindex=-1><div class=body>`),
5891
+ $cdea4cf8c5c071ef$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<section class=sorting tabindex=-1><div class=body>`),
5824
5892
  $cdea4cf8c5c071ef$var$_tmpl$3 = /*#__PURE__*/$9HbP8$template(`<div class=sort-and-filter-buttons><div class=outer><div class=inner><!$><!/><!$><!/><!$><!/>`),
5825
5893
  $cdea4cf8c5c071ef$var$_tmpl$4 = /*#__PURE__*/$9HbP8$template(`<span class=num-filters>`),
5826
5894
  $cdea4cf8c5c071ef$var$_tmpl$5 = /*#__PURE__*/$9HbP8$template(`<div class=open-filters-button-container><!$><!/><button type=button><!$><!/><span>`),
@@ -5889,6 +5957,27 @@ function $cdea4cf8c5c071ef$export$d7841e452f2e59a8({
5889
5957
  available_sortings_: available_sortings_,
5890
5958
  meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
5891
5959
  };
5960
+ // Keyboard accessibility for the desktop panels (rendered after the product grid in the DOM): when the user
5961
+ // opens a panel we move focus into it, and restore focus to the toggle button on close. Intent is tracked with
5962
+ // a plain flag set in the buttons' click handlers - `filters_open`/`sorting_open` also change programmatically
5963
+ // (undo toast, history-state restore, SDK consumers), and those must not steal focus.
5964
+ let user_opened_panel = false;
5965
+ let filter_toggle_button;
5966
+ let sort_toggle_button;
5967
+ let current_panel;
5968
+ let current_panel_toggle_button;
5969
+ const focus_panel_when_in_dom = panel => $9HbP8$catchify1(async () => {
5970
+ // Bounded wait: if the panel never lands in the DOM (e.g. it's superseded by a rapid re-render before
5971
+ // insertion), the timeout lets this promise resolve instead of keeping `panel` - and the observer
5972
+ // listener it registers - referenced forever.
5973
+ await (0, $9HbP8$observer).wait_for_element(panel, 4000);
5974
+ if (panel.isConnected) panel.focus();
5975
+ })();
5976
+ const register_desktop_panel = (el, toggle_button, should_focus) => {
5977
+ current_panel = el;
5978
+ current_panel_toggle_button = toggle_button;
5979
+ if (should_focus) focus_panel_when_in_dom(el);
5980
+ };
5892
5981
  const make_open_filters_button = (adhere_to_width = false, is_tabbable = false) => $9HbP8$createComponent($cdea4cf8c5c071ef$var$OpenFiltersButton, {
5893
5982
  tabindex_: is_tabbable ? 0 : -1,
5894
5983
  i18n_: i18n_,
@@ -5896,7 +5985,9 @@ function $cdea4cf8c5c071ef$export$d7841e452f2e59a8({
5896
5985
  search_sorting_open_: search_sorting_open_,
5897
5986
  number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_,
5898
5987
  filter_button_width_: adhere_to_width ? filter_button_width_ : undefined,
5899
- hide_button_: hide_filters
5988
+ hide_button_: hide_filters,
5989
+ on_user_open_: () => user_opened_panel = true,
5990
+ button_ref_: is_tabbable ? el => filter_toggle_button = el : undefined
5900
5991
  });
5901
5992
  const make_open_sorting_button = (adhere_to_width = false, is_tabbable = false) => $9HbP8$createComponent($cdea4cf8c5c071ef$var$OpenSortingButton, {
5902
5993
  tabindex_: is_tabbable ? 0 : -1,
@@ -5906,7 +5997,9 @@ function $cdea4cf8c5c071ef$export$d7841e452f2e59a8({
5906
5997
  search_sorting_open_: search_sorting_open_,
5907
5998
  available_sortings_: available_sortings_,
5908
5999
  sort_button_width_: adhere_to_width ? sort_button_width_ : undefined,
5909
- meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
6000
+ meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_,
6001
+ on_user_open_: () => user_opened_panel = true,
6002
+ button_ref_: is_tabbable ? el => sort_toggle_button = el : undefined
5910
6003
  });
5911
6004
  let open_modal_;
5912
6005
  let close_modal_;
@@ -5925,9 +6018,46 @@ function $cdea4cf8c5c071ef$export$d7841e452f2e59a8({
5925
6018
  grid_is_in_original_state = true;
5926
6019
  }
5927
6020
  });
6021
+ // Restore focus to the relevant toggle button when a desktop panel is torn down while focus is still inside it.
6022
+ const restore_focus_to_toggle_on_close = () => {
6023
+ const button_to_restore = current_panel_toggle_button;
6024
+ const focus_was_in_panel = !!current_panel && current_panel.contains(document.activeElement);
6025
+ current_panel = undefined;
6026
+ current_panel_toggle_button = undefined;
6027
+ if (focus_was_in_panel) button_to_restore?.focus();
6028
+ };
6029
+ // `<section>` + `aria-label` so the panel announces itself ("Filters"/"Sort") when we move focus to it; the bare
6030
+ // tabindex=-1 container would otherwise give screen readers nothing to read on focus. A semantic <section> avoids
6031
+ // an ARIA role and the UA styling pitfalls of <fieldset>; the existing CSS targets the `.filters`/`.sorting` class.
6032
+ const FiltersPanel = should_focus => $9HbP8$createComponent((0, $9HbP8$Show), {
6033
+ get when() {
6034
+ return !hide_filters();
6035
+ },
6036
+ get children() {
6037
+ var _el$ = $9HbP8$getNextElement($cdea4cf8c5c071ef$var$_tmpl$),
6038
+ _el$2 = _el$.firstChild;
6039
+ $9HbP8$use(el => register_desktop_panel(el, filter_toggle_button, should_focus), _el$);
6040
+ $9HbP8$insert(_el$2, $9HbP8$createComponent((0, $fab07f52c9861732$export$3f1a388cc0d8fed7), filter_options));
6041
+ $9HbP8$effect(() => $9HbP8$setAttribute(_el$, "aria-label", i18n_.filters_()));
6042
+ return _el$;
6043
+ }
6044
+ });
6045
+ const SortingPanel = should_focus => (() => {
6046
+ var _el$3 = $9HbP8$getNextElement($cdea4cf8c5c071ef$var$_tmpl$2),
6047
+ _el$4 = _el$3.firstChild;
6048
+ $9HbP8$use(el => register_desktop_panel(el, sort_toggle_button, should_focus), _el$3);
6049
+ $9HbP8$insert(_el$4, $9HbP8$createComponent((0, $68a258a92b88f02f$export$1f1775a58da589b5), sorting_options));
6050
+ $9HbP8$effect(() => $9HbP8$setAttribute(_el$3, "aria-label", i18n_.sorting_text_()));
6051
+ return _el$3;
6052
+ })();
5928
6053
  $9HbP8$createEffect(() => {
6054
+ // Consume the user-intent flag once per run, in every branch, so a stale flag can't leak into a later
6055
+ // resize-triggered re-render and steal focus.
6056
+ const should_focus_panel = user_opened_panel;
6057
+ user_opened_panel = false;
5929
6058
  if (!filters_open() && !sorting_open()) {
5930
6059
  close_modal_?.();
6060
+ restore_focus_to_toggle_on_close();
5931
6061
  set_extra_els_in_results_container_("");
5932
6062
  } else if (isSmall()()) {
5933
6063
  if ($9HbP8$untrack(() => input_modal_open_?.())) {
@@ -5936,26 +6066,14 @@ function $cdea4cf8c5c071ef$export$d7841e452f2e59a8({
5936
6066
  set_sorting_open(false);
5937
6067
  return;
5938
6068
  }
6069
+ // The modal manages its own focus; just drop the desktop panel reference.
6070
+ current_panel = undefined;
6071
+ current_panel_toggle_button = undefined;
5939
6072
  open_modal_?.();
5940
6073
  set_extra_els_in_results_container_("");
5941
6074
  } else {
5942
6075
  close_modal_?.();
5943
- if (filters_open()) set_extra_els_in_results_container_(() => $9HbP8$createComponent((0, $9HbP8$Show), {
5944
- get when() {
5945
- return !hide_filters();
5946
- },
5947
- get children() {
5948
- var _el$ = $9HbP8$getNextElement($cdea4cf8c5c071ef$var$_tmpl$),
5949
- _el$2 = _el$.firstChild;
5950
- $9HbP8$insert(_el$2, $9HbP8$createComponent((0, $fab07f52c9861732$export$3f1a388cc0d8fed7), filter_options));
5951
- return _el$;
5952
- }
5953
- }));else set_extra_els_in_results_container_((() => {
5954
- var _el$3 = $9HbP8$getNextElement($cdea4cf8c5c071ef$var$_tmpl$2),
5955
- _el$4 = _el$3.firstChild;
5956
- $9HbP8$insert(_el$4, $9HbP8$createComponent((0, $68a258a92b88f02f$export$1f1775a58da589b5), sorting_options));
5957
- return _el$3;
5958
- })());
6076
+ if (filters_open()) set_extra_els_in_results_container_(() => FiltersPanel(should_focus_panel));else set_extra_els_in_results_container_(SortingPanel(should_focus_panel));
5959
6077
  }
5960
6078
  });
5961
6079
  $9HbP8$catchify1(async () => {
@@ -6019,7 +6137,9 @@ function $cdea4cf8c5c071ef$var$OpenFiltersButton({
6019
6137
  filter_button_width_: filter_button_width_,
6020
6138
  tabindex_: tabindex_,
6021
6139
  number_of_rendered_selected_filters_items_: [num_selected_filters],
6022
- hide_button_: hide_button_
6140
+ hide_button_: hide_button_,
6141
+ on_user_open_: on_user_open_,
6142
+ button_ref_: button_ref_
6023
6143
  }) {
6024
6144
  const filters_closed = $9HbP8$createMemo(() => !search_filters_open_[0]());
6025
6145
  // We assume in embedded_num_products that this is a single HTMLElement so pls change there if you change it here
@@ -6047,9 +6167,12 @@ function $cdea4cf8c5c071ef$var$OpenFiltersButton({
6047
6167
  search_filters_open_[1](false);
6048
6168
  return;
6049
6169
  }
6170
+ on_user_open_?.();
6050
6171
  search_filters_open_[1](true);
6051
6172
  search_sorting_open_[1](false);
6052
6173
  })), true);
6174
+ var _ref$2 = button_ref_;
6175
+ typeof _ref$2 === "function" ? $9HbP8$use(_ref$2, _el$16) : button_ref_ = _el$16;
6053
6176
  $9HbP8$setAttribute(_el$16, "tabindex", tabindex_);
6054
6177
  $9HbP8$className(_el$16, "filter toggle-button major-minor-transition" + ((0, $9HbP8$isServer) ? " minor" : ""));
6055
6178
  $9HbP8$insert(_el$16, $9HbP8$createComponent((0, $9HbP8$Show), {
@@ -6071,21 +6194,24 @@ function $cdea4cf8c5c071ef$var$OpenFiltersButton({
6071
6194
  _v$2 = !filters_closed(),
6072
6195
  _v$3 = !!filters_closed(),
6073
6196
  _v$4 = (filters_closed() ? i18n_.open_filters_ : i18n_.close_filters_)(),
6074
- _v$5 = filter_button_width_?.() ? {
6197
+ _v$5 = !filters_closed(),
6198
+ _v$6 = filter_button_width_?.() ? {
6075
6199
  width: filter_button_width_() + "px"
6076
6200
  } : {};
6077
6201
  _p$.e = $9HbP8$style(_el$14, _v$, _p$.e);
6078
6202
  _v$2 !== _p$.t && _el$16.classList.toggle("major", _p$.t = _v$2);
6079
6203
  _v$3 !== _p$.a && _el$16.classList.toggle("minor", _p$.a = _v$3);
6080
6204
  _v$4 !== _p$.o && $9HbP8$setAttribute(_el$16, "aria-label", _p$.o = _v$4);
6081
- _p$.i = $9HbP8$style(_el$16, _v$5, _p$.i);
6205
+ _v$5 !== _p$.i && $9HbP8$setAttribute(_el$16, "aria-expanded", _p$.i = _v$5);
6206
+ _p$.n = $9HbP8$style(_el$16, _v$6, _p$.n);
6082
6207
  return _p$;
6083
6208
  }, {
6084
6209
  e: undefined,
6085
6210
  t: undefined,
6086
6211
  a: undefined,
6087
6212
  o: undefined,
6088
- i: undefined
6213
+ i: undefined,
6214
+ n: undefined
6089
6215
  });
6090
6216
  $9HbP8$runHydrationEvents();
6091
6217
  return _el$14;
@@ -6099,7 +6225,9 @@ function $cdea4cf8c5c071ef$var$OpenSortingButton({
6099
6225
  search_sorting_open_: search_sorting_open_,
6100
6226
  sort_button_width_: sort_button_width_,
6101
6227
  tabindex_: tabindex_,
6102
- meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
6228
+ meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_,
6229
+ on_user_open_: on_user_open_,
6230
+ button_ref_: button_ref_
6103
6231
  }) {
6104
6232
  const sorting_closed = $9HbP8$createMemo(() => !search_sorting_open_[0]());
6105
6233
  // We assume in embedded_num_products that this is a single HTMLElement so pls change there if you change it here
@@ -6113,9 +6241,12 @@ function $cdea4cf8c5c071ef$var$OpenSortingButton({
6113
6241
  search_sorting_open_[1](false);
6114
6242
  return;
6115
6243
  }
6244
+ on_user_open_?.();
6116
6245
  search_filters_open_[1](false);
6117
6246
  search_sorting_open_[1](true);
6118
6247
  })), true);
6248
+ var _ref$3 = button_ref_;
6249
+ typeof _ref$3 === "function" ? $9HbP8$use(_ref$3, _el$22) : button_ref_ = _el$22;
6119
6250
  $9HbP8$setAttribute(_el$22, "tabindex", tabindex_);
6120
6251
  $9HbP8$insert(_el$23, (() => {
6121
6252
  var _c$ = $9HbP8$memo(() => !!sorting_closed());
@@ -6137,22 +6268,25 @@ function $cdea4cf8c5c071ef$var$OpenSortingButton({
6137
6268
  }
6138
6269
  }), _el$25, _co$6);
6139
6270
  $9HbP8$effect(_p$ => {
6140
- var _v$6 = !sorting_closed(),
6141
- _v$7 = !!sorting_closed(),
6142
- _v$8 = (sorting_closed() ? i18n_.open_sorting_ : i18n_.close_sorting_)(),
6143
- _v$9 = sort_button_width_?.() ? {
6271
+ var _v$7 = !sorting_closed(),
6272
+ _v$8 = !!sorting_closed(),
6273
+ _v$9 = (sorting_closed() ? i18n_.open_sorting_ : i18n_.close_sorting_)(),
6274
+ _v$10 = !sorting_closed(),
6275
+ _v$11 = sort_button_width_?.() ? {
6144
6276
  width: sort_button_width_() + "px"
6145
6277
  } : {};
6146
- _v$6 !== _p$.e && _el$22.classList.toggle("major", _p$.e = _v$6);
6147
- _v$7 !== _p$.t && _el$22.classList.toggle("minor", _p$.t = _v$7);
6148
- _v$8 !== _p$.a && $9HbP8$setAttribute(_el$22, "aria-label", _p$.a = _v$8);
6149
- _p$.o = $9HbP8$style(_el$22, _v$9, _p$.o);
6278
+ _v$7 !== _p$.e && _el$22.classList.toggle("major", _p$.e = _v$7);
6279
+ _v$8 !== _p$.t && _el$22.classList.toggle("minor", _p$.t = _v$8);
6280
+ _v$9 !== _p$.a && $9HbP8$setAttribute(_el$22, "aria-label", _p$.a = _v$9);
6281
+ _v$10 !== _p$.o && $9HbP8$setAttribute(_el$22, "aria-expanded", _p$.o = _v$10);
6282
+ _p$.i = $9HbP8$style(_el$22, _v$11, _p$.i);
6150
6283
  return _p$;
6151
6284
  }, {
6152
6285
  e: undefined,
6153
6286
  t: undefined,
6154
6287
  a: undefined,
6155
- o: undefined
6288
+ o: undefined,
6289
+ i: undefined
6156
6290
  });
6157
6291
  $9HbP8$runHydrationEvents();
6158
6292
  return _el$22;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/ui",
3
- "version": "4.10.12",
3
+ "version": "4.10.14",
4
4
  "description": "Base package containing the actual UI of Depict UI along with translations, with a not-simplified API. We recommend using @depict-ai/js-ui or @depict-ai/react-ui instead.",
5
5
  "packageManager": "yarn@3.2.2",
6
6
  "sass": "styles.scss",
@@ -236,9 +236,9 @@
236
236
  "@babel/plugin-transform-typescript": "^7.22.9",
237
237
  "@babel/runtime": "latest",
238
238
  "@babel/runtime-corejs3": "^7.22.6",
239
- "@depict-ai/plp-styling": "^4.6.4",
240
- "@depict-ai/types": "^5.6.2",
241
- "@depict-ai/utilishared": "^2.6.2",
239
+ "@depict-ai/plp-styling": "^4.6.6",
240
+ "@depict-ai/types": "^5.6.4",
241
+ "@depict-ai/utilishared": "^2.6.4",
242
242
  "solid-js": "^1.9.10"
243
243
  },
244
244
  "type": "module",