@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 +198 -61
- package/ES10/index.d.ts +1 -1
- package/ES10/index.js +198 -61
- package/latest/index.cjs +195 -61
- package/latest/index.d.ts +1 -1
- package/latest/index.js +195 -61
- package/package.json +4 -4
- package/server/ES10/index.cjs +113 -35
- package/server/ES10/index.d.ts +1 -1
- package/server/ES10/index.js +113 -35
- package/server/latest/index.cjs +113 -35
- package/server/latest/index.d.ts +1 -1
- package/server/latest/index.js +113 -35
package/server/latest/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { createStore as $i7OB2$createStore, reconcile as $i7OB2$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.
|
|
10
|
+
const $ec291e0010116877$export$83d89fbfd8236492 = "4.10.14";
|
|
11
11
|
function $dc9262ef6f786812$export$d9f36cf74e24d595(media_query) {
|
|
12
12
|
const signal = $i7OB2$createSignal(false);
|
|
13
13
|
$i7OB2$onCleanup($i7OB2$javascript_media_query(media_query, ({
|
|
@@ -2108,12 +2108,14 @@ function $f8a56ba74eedd0c6$export$f21ab0717a89c77f(props) {
|
|
|
2108
2108
|
height: "12"
|
|
2109
2109
|
}), () => $i7OB2$ssr($f8a56ba74eedd0c6$var$_tmpl$), true);
|
|
2110
2110
|
}
|
|
2111
|
-
var $67b173f9db427028$var$_tmpl$ = ["<button", ' type="button" class="', '"
|
|
2111
|
+
var $67b173f9db427028$var$_tmpl$ = ["<button", ' type="button" class="', '"', "><!--$-->", "<!--/--><span>", "</span></button>"];
|
|
2112
2112
|
function $67b173f9db427028$export$ca21a16d65b3dd8({
|
|
2113
2113
|
show_extras_: [get_show_extras, set_show_extras],
|
|
2114
|
-
i18n_: i18n_
|
|
2114
|
+
i18n_: i18n_,
|
|
2115
|
+
expanding_container_element_: expanding_container_element_
|
|
2115
2116
|
}) {
|
|
2116
|
-
|
|
2117
|
+
let button;
|
|
2118
|
+
return $i7OB2$ssr($67b173f9db427028$var$_tmpl$, $i7OB2$ssrHydrationKey(), `expand-filter ${get_show_extras() ? "expanded" : ""}`, $i7OB2$ssrAttribute("aria-expanded", $i7OB2$escape(get_show_extras(), true), false), $i7OB2$escape($i7OB2$createComponent((0, $f8a56ba74eedd0c6$export$f21ab0717a89c77f), {})), get_show_extras() ? $i7OB2$escape(i18n_.view_less_()) : $i7OB2$escape(i18n_.view_more_()));
|
|
2117
2119
|
}
|
|
2118
2120
|
var $f3213c0640246d58$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"],
|
|
2119
2121
|
$f3213c0640246d58$var$_tmpl$2 = ["<span", ' class="', '"', ">", "</span>"];
|
|
@@ -2265,7 +2267,8 @@ function $a4601e6bea3ed1e6$export$dd948f91abc3a1c4({
|
|
|
2265
2267
|
$i7OB2$createRenderEffect(() => {
|
|
2266
2268
|
set_view_more_button_below_group_(togglable_rest() ? $i7OB2$createComponent((0, $67b173f9db427028$export$ca21a16d65b3dd8), {
|
|
2267
2269
|
show_extras_: show_extras_signal,
|
|
2268
|
-
i18n_: i18n_
|
|
2270
|
+
i18n_: i18n_,
|
|
2271
|
+
expanding_container_element_: expanding_container_els
|
|
2269
2272
|
}) : []);
|
|
2270
2273
|
});
|
|
2271
2274
|
$i7OB2$onCleanup(() => set_view_more_button_below_group_());
|
|
@@ -2344,7 +2347,7 @@ function $eb8d9bf3b5700c26$export$430444115f70a734({
|
|
|
2344
2347
|
}
|
|
2345
2348
|
})));
|
|
2346
2349
|
}
|
|
2347
|
-
var $a6b08770e164eced$var$_tmpl$ = ["<div", ' class="', '"><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"><!--$-->', "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--></span></div></div>"],
|
|
2350
|
+
var $a6b08770e164eced$var$_tmpl$ = ["<div", ' class="', '"><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"><!--$-->', "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--></span></div></div>"],
|
|
2348
2351
|
$a6b08770e164eced$var$_tmpl$2 = ["<div", ' class="slider"><div class="progress" style="', '"></div></div>'],
|
|
2349
2352
|
$a6b08770e164eced$var$_tmpl$3 = ["<div", ' class="range-group"><input', ' type="range"', ' step="any"><input', ' type="range"', ' step="any"></div>'];
|
|
2350
2353
|
function $a6b08770e164eced$export$e0d834a0ad870cda({
|
|
@@ -2437,7 +2440,8 @@ function $a6b08770e164eced$var$RangeSelector({
|
|
|
2437
2440
|
min_: min_,
|
|
2438
2441
|
current_range_: current_range_,
|
|
2439
2442
|
i18n_: i18n_,
|
|
2440
|
-
should_be_disabled_: should_be_disabled_
|
|
2443
|
+
should_be_disabled_: should_be_disabled_,
|
|
2444
|
+
priceFormatting_: price_formatting_
|
|
2441
2445
|
})), $i7OB2$escape(pre_price()), $i7OB2$escape($i7OB2$createComponent((0, $8c0f86cb3e266eeb$export$a71e92cfbb498adc), {
|
|
2442
2446
|
get price_() {
|
|
2443
2447
|
return min_();
|
|
@@ -2459,7 +2463,8 @@ function $a6b08770e164eced$var$ExponentialSlider({
|
|
|
2459
2463
|
min_: min_,
|
|
2460
2464
|
i18n_: i18n_,
|
|
2461
2465
|
max_: max_,
|
|
2462
|
-
should_be_disabled_: should_be_disabled_
|
|
2466
|
+
should_be_disabled_: should_be_disabled_,
|
|
2467
|
+
priceFormatting_: priceFormatting_
|
|
2463
2468
|
}) {
|
|
2464
2469
|
// inspired by https://observablehq.com/@mbostock/nonlinear-slider
|
|
2465
2470
|
const transform_linear_to_nonlinear = ([smaller, larger]) => [Math.sqrt(smaller), Math.sqrt(larger)];
|
|
@@ -2493,7 +2498,8 @@ function $a6b08770e164eced$var$ExponentialSlider({
|
|
|
2493
2498
|
max_: modified_max,
|
|
2494
2499
|
offset_value_calculator_: offset_value_calculator_,
|
|
2495
2500
|
i18n_: i18n_,
|
|
2496
|
-
should_be_disabled_: should_be_disabled_
|
|
2501
|
+
should_be_disabled_: should_be_disabled_,
|
|
2502
|
+
priceFormatting_: priceFormatting_
|
|
2497
2503
|
});
|
|
2498
2504
|
}
|
|
2499
2505
|
function $a6b08770e164eced$var$LinearSlider({
|
|
@@ -2502,12 +2508,17 @@ function $a6b08770e164eced$var$LinearSlider({
|
|
|
2502
2508
|
current_range_: current_range_,
|
|
2503
2509
|
offset_value_calculator_: offset_value_calculator_,
|
|
2504
2510
|
i18n_: i18n_,
|
|
2505
|
-
should_be_disabled_: should_be_disabled_
|
|
2511
|
+
should_be_disabled_: should_be_disabled_,
|
|
2512
|
+
priceFormatting_: priceFormatting_
|
|
2506
2513
|
}) {
|
|
2507
2514
|
let range_input_1;
|
|
2508
2515
|
let range_input_2;
|
|
2509
2516
|
let clickable_slider;
|
|
2510
2517
|
const [get_current_range, set_current_range] = current_range_;
|
|
2518
|
+
const formatRealPrice = value => {
|
|
2519
|
+
const priceFormatting = priceFormatting_();
|
|
2520
|
+
return priceFormatting.pre_ + $i7OB2$standard_price_format(value, priceFormatting.places_after_comma_, priceFormatting.decimal_places_delimiter_, priceFormatting.thousands_delimiter_) + priceFormatting.post_;
|
|
2521
|
+
};
|
|
2511
2522
|
const progress_styling = $i7OB2$createMemo(() => {
|
|
2512
2523
|
const min = min_();
|
|
2513
2524
|
const span = max_() - min;
|
|
@@ -2526,13 +2537,13 @@ function $a6b08770e164eced$var$LinearSlider({
|
|
|
2526
2537
|
el.value = get_current_range()[index];
|
|
2527
2538
|
});
|
|
2528
2539
|
};
|
|
2529
|
-
return [$i7OB2$ssr($a6b08770e164eced$var$_tmpl$2, $i7OB2$ssrHydrationKey(), $i7OB2$ssrStyle(progress_styling())), $i7OB2$ssr($a6b08770e164eced$var$_tmpl$3, $i7OB2$ssrHydrationKey(), $i7OB2$ssrAttribute("disabled", should_be_disabled_(), true), $i7OB2$ssrAttribute("aria-label", $i7OB2$escape(i18n_.range_filter_low_point_aria_label_(), true), false) + $i7OB2$ssrAttribute("min", $i7OB2$escape(min_(), true), false) + $i7OB2$ssrAttribute("max", $i7OB2$escape(max_(), true), false) + $i7OB2$ssrAttribute("value", $i7OB2$escape($i7OB2$createMemo(() => {
|
|
2540
|
+
return [$i7OB2$ssr($a6b08770e164eced$var$_tmpl$2, $i7OB2$ssrHydrationKey(), $i7OB2$ssrStyle(progress_styling())), $i7OB2$ssr($a6b08770e164eced$var$_tmpl$3, $i7OB2$ssrHydrationKey(), $i7OB2$ssrAttribute("disabled", should_be_disabled_(), true), $i7OB2$ssrAttribute("aria-label", $i7OB2$escape(i18n_.range_filter_low_point_aria_label_(), true), false) + $i7OB2$ssrAttribute("aria-valuetext", $i7OB2$escape(formatRealPrice(get_current_range()[0]), true), false) + $i7OB2$ssrAttribute("min", $i7OB2$escape(min_(), true), false) + $i7OB2$ssrAttribute("max", $i7OB2$escape(max_(), true), false) + $i7OB2$ssrAttribute("value", $i7OB2$escape($i7OB2$createMemo(() => {
|
|
2530
2541
|
min_();
|
|
2531
2542
|
max_();
|
|
2532
2543
|
return get_current_range()[0];
|
|
2533
2544
|
}, undefined, {
|
|
2534
2545
|
equals: false
|
|
2535
|
-
})(), true), false), $i7OB2$ssrAttribute("disabled", should_be_disabled_(), true) + $i7OB2$ssrAttribute("aria-label", $i7OB2$escape(i18n_.range_filter_high_point_aria_label_(), true), false), $i7OB2$ssrAttribute("min", $i7OB2$escape(min_(), true), false) + $i7OB2$ssrAttribute("max", $i7OB2$escape(max_(), true), false))];
|
|
2546
|
+
})(), true), false), $i7OB2$ssrAttribute("disabled", should_be_disabled_(), true) + $i7OB2$ssrAttribute("aria-label", $i7OB2$escape(i18n_.range_filter_high_point_aria_label_(), true), false) + $i7OB2$ssrAttribute("aria-valuetext", $i7OB2$escape(formatRealPrice(get_current_range()[1]), true), false), $i7OB2$ssrAttribute("min", $i7OB2$escape(min_(), true), false) + $i7OB2$ssrAttribute("max", $i7OB2$escape(max_(), true), false))];
|
|
2536
2547
|
}
|
|
2537
2548
|
function $a6b08770e164eced$var$set_range_with_sanitation(min_, max_, current_range_signal, index, target_el, get_offset_value = (value, how_many) => value + how_many) {
|
|
2538
2549
|
let value_as_number = +target_el.value;
|
|
@@ -2934,7 +2945,8 @@ function $1c8cac76cb67e9af$export$a32086fa6616eafd({
|
|
|
2934
2945
|
$i7OB2$createRenderEffect(() => {
|
|
2935
2946
|
set_view_more_button_below_group(some_top_level_are_hidden() ? $i7OB2$createComponent((0, $67b173f9db427028$export$ca21a16d65b3dd8), {
|
|
2936
2947
|
show_extras_: show_extras,
|
|
2937
|
-
i18n_: i18n_
|
|
2948
|
+
i18n_: i18n_,
|
|
2949
|
+
expanding_container_element_: expanding_container_els
|
|
2938
2950
|
}) : []);
|
|
2939
2951
|
});
|
|
2940
2952
|
$i7OB2$onCleanup(() => set_view_more_button_below_group());
|
|
@@ -3328,6 +3340,13 @@ const $93716a9ad0dea854$export$414f6a19d38e655c = ({
|
|
|
3328
3340
|
const label = $i7OB2$createMemo(() => value().name_ || value().value_ + "");
|
|
3329
3341
|
const count_zero = $i7OB2$createMemo(() => value().count_ === 0);
|
|
3330
3342
|
return $i7OB2$ssrElement("button", $i7OB2$mergeProps1(attributes, {
|
|
3343
|
+
type: "button",
|
|
3344
|
+
get ["aria-pressed"]() {
|
|
3345
|
+
return is_selected();
|
|
3346
|
+
},
|
|
3347
|
+
get ["aria-label"]() {
|
|
3348
|
+
return value().count_ != undefined ? `${label()}, ${value().count_}` : label();
|
|
3349
|
+
},
|
|
3331
3350
|
get disabled() {
|
|
3332
3351
|
return count_zero() && !is_selected();
|
|
3333
3352
|
},
|
|
@@ -3498,7 +3517,14 @@ function $e731d52d97444b7c$export$82ed4b28ecb67608({
|
|
|
3498
3517
|
return !!data?.some(item => $91aa8ee9f431800d$export$325f75597868c4f0(item) === value);
|
|
3499
3518
|
});
|
|
3500
3519
|
const value = $i7OB2$createMemo(() => checkbox().value_);
|
|
3501
|
-
const label_text = $i7OB2$createMemo(() =>
|
|
3520
|
+
const label_text = $i7OB2$createMemo(() => {
|
|
3521
|
+
const name = checkbox().name_;
|
|
3522
|
+
if (name) return name;
|
|
3523
|
+
const value_string = value() + "";
|
|
3524
|
+
if (backendFilterV2()) return value_string;
|
|
3525
|
+
// Legacy values are "Name;#hex" - split is used to get the name so that screen readers don't announce the hex code
|
|
3526
|
+
return value_string.split(";")[0] || value_string;
|
|
3527
|
+
});
|
|
3502
3528
|
const count = $i7OB2$createMemo(() => checkbox().count_);
|
|
3503
3529
|
const colorNameDatasetValue = $i7OB2$createMemo(() => {
|
|
3504
3530
|
if (backendFilterV2()) return label_text();
|
|
@@ -3585,7 +3611,8 @@ function $e731d52d97444b7c$export$82ed4b28ecb67608({
|
|
|
3585
3611
|
$i7OB2$createRenderEffect(() => {
|
|
3586
3612
|
set_view_more_button_below_group_(togglable_rest() ? $i7OB2$createComponent((0, $67b173f9db427028$export$ca21a16d65b3dd8), {
|
|
3587
3613
|
show_extras_: show_extras_signal,
|
|
3588
|
-
i18n_: i18n_
|
|
3614
|
+
i18n_: i18n_,
|
|
3615
|
+
expanding_container_element_: expanding_container_els
|
|
3589
3616
|
}) : []);
|
|
3590
3617
|
});
|
|
3591
3618
|
$i7OB2$onCleanup(() => set_view_more_button_below_group_());
|
|
@@ -3909,9 +3936,9 @@ function $e01b34f289b61435$var$find_str_arr_in_str_arr_arr(operation, haystack,
|
|
|
3909
3936
|
var $fab07f52c9861732$var$_tmpl$ = ["<div", ' class="filter-collapsible">', "</div>"],
|
|
3910
3937
|
$fab07f52c9861732$var$_tmpl$2 = ["<button", ' class="clear-group"><!--$-->', "<!--/--><span>", "</span></button>"],
|
|
3911
3938
|
$fab07f52c9861732$var$_tmpl$3 = ["<div", ' class="view-more-clear"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"],
|
|
3912
|
-
$fab07f52c9861732$var$_tmpl$4 = ["<div", ' class="filter-collapsible-body"><
|
|
3939
|
+
$fab07f52c9861732$var$_tmpl$4 = ["<div", ' class="filter-collapsible-body"><fieldset class="filter-part"', "><!--$-->", "<!--/--><!--$-->", "<!--/--></fieldset><!--$-->", "<!--/--></div>"],
|
|
3913
3940
|
$fab07f52c9861732$var$_tmpl$5 = ["<details", ' class="filter-collapsible"', "></details>"],
|
|
3914
|
-
$fab07f52c9861732$var$_tmpl$6 = ["<summary", ' class="filter-group-summary"><div class="summary"><span
|
|
3941
|
+
$fab07f52c9861732$var$_tmpl$6 = ["<summary", ' class="filter-group-summary"><div class="summary"><span', ">", '</span><div class="selected-w-sign"><!--$-->', "<!--/--><!--$-->", "<!--/--></div></div></summary>"],
|
|
3915
3942
|
$fab07f52c9861732$var$_tmpl$7 = ["<div", ' class="ungrouped">', "</div>"],
|
|
3916
3943
|
$fab07f52c9861732$var$_tmpl$8 = ["<button", ' class="clear-all-filters major">', "</button>"];
|
|
3917
3944
|
function $fab07f52c9861732$export$3f1a388cc0d8fed7(props) {
|
|
@@ -3995,13 +4022,14 @@ function $fab07f52c9861732$var$ActualFilterBody(props) {
|
|
|
3995
4022
|
const a_filter_is_selected = $i7OB2$createMemo(() => selected_filters_in_group().size);
|
|
3996
4023
|
const [get_details_width, set_get_details_width] = $i7OB2$createSignal();
|
|
3997
4024
|
const details_element_width_ = $i7OB2$createMemo(() => get_details_width?.()?.());
|
|
4025
|
+
const title_id = $i7OB2$make_random_classname();
|
|
3998
4026
|
return $i7OB2$createComponent((0, $6bb0a0c563dff4bb$export$6c6d7a51fa9aa15d), {
|
|
3999
4027
|
is_open_: is_open,
|
|
4000
4028
|
get details_() {
|
|
4001
4029
|
return $i7OB2$ssr($fab07f52c9861732$var$_tmpl$5, $i7OB2$ssrHydrationKey(), $i7OB2$ssrAttribute("data-group-title", $i7OB2$escape(section_, true), false));
|
|
4002
4030
|
},
|
|
4003
4031
|
get summary_() {
|
|
4004
|
-
return $i7OB2$ssr($fab07f52c9861732$var$_tmpl$6, $i7OB2$ssrHydrationKey(), $i7OB2$escape(section_), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Show), {
|
|
4032
|
+
return $i7OB2$ssr($fab07f52c9861732$var$_tmpl$6, $i7OB2$ssrHydrationKey(), $i7OB2$ssrAttribute("id", $i7OB2$escape(title_id, true), false), $i7OB2$escape(section_), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Show), {
|
|
4005
4033
|
get when() {
|
|
4006
4034
|
return a_filter_is_selected();
|
|
4007
4035
|
},
|
|
@@ -4023,7 +4051,7 @@ function $fab07f52c9861732$var$ActualFilterBody(props) {
|
|
|
4023
4051
|
})));
|
|
4024
4052
|
},
|
|
4025
4053
|
get children() {
|
|
4026
|
-
return $i7OB2$ssr($fab07f52c9861732$var$_tmpl$4, $i7OB2$ssrHydrationKey(), $i7OB2$escape($i7OB2$createComponent(SearchThisFilterGroup_, {})), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Index), {
|
|
4054
|
+
return $i7OB2$ssr($fab07f52c9861732$var$_tmpl$4, $i7OB2$ssrHydrationKey(), $i7OB2$ssrAttribute("aria-labelledby", $i7OB2$escape(title_id, true), false), $i7OB2$escape($i7OB2$createComponent(SearchThisFilterGroup_, {})), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Index), {
|
|
4027
4055
|
get each() {
|
|
4028
4056
|
return searched_filter_array_();
|
|
4029
4057
|
},
|
|
@@ -4583,8 +4611,8 @@ var $11d594c749b76228$var$_tmpl$ = ["<svg", ' xmlns="http://www.w3.org/2000/svg"
|
|
|
4583
4611
|
function $11d594c749b76228$export$cb808a3c41736d8e() {
|
|
4584
4612
|
return $i7OB2$ssr($11d594c749b76228$var$_tmpl$, $i7OB2$ssrHydrationKey());
|
|
4585
4613
|
}
|
|
4586
|
-
var $cdea4cf8c5c071ef$var$_tmpl$ = ["<
|
|
4587
|
-
$cdea4cf8c5c071ef$var$_tmpl$2 = ["<
|
|
4614
|
+
var $cdea4cf8c5c071ef$var$_tmpl$ = ["<section", ' class="filters"', '><div class="body">', "</div></section>"],
|
|
4615
|
+
$cdea4cf8c5c071ef$var$_tmpl$2 = ["<section", ' class="sorting"', '><div class="body">', "</div></section>"],
|
|
4588
4616
|
$cdea4cf8c5c071ef$var$_tmpl$3 = ["<div", ' class="sort-and-filter-buttons"><div class="outer"><div class="inner"><!--$-->', "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--></div></div></div>"],
|
|
4589
4617
|
$cdea4cf8c5c071ef$var$_tmpl$4 = ["<span", ' class="num-filters" style="', '">', "</span>"],
|
|
4590
4618
|
$cdea4cf8c5c071ef$var$_tmpl$5 = ["<div", ' class="open-filters-button-container" style="', '"><!--$-->', "<!--/--><button", ' class="', '" type="button"', ' style="', '"><!--$-->', "<!--/--><span>", "</span></button></div>"],
|
|
@@ -4653,6 +4681,27 @@ function $cdea4cf8c5c071ef$export$d7841e452f2e59a8({
|
|
|
4653
4681
|
available_sortings_: available_sortings_,
|
|
4654
4682
|
meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
|
|
4655
4683
|
};
|
|
4684
|
+
// Keyboard accessibility for the desktop panels (rendered after the product grid in the DOM): when the user
|
|
4685
|
+
// opens a panel we move focus into it, and restore focus to the toggle button on close. Intent is tracked with
|
|
4686
|
+
// a plain flag set in the buttons' click handlers - `filters_open`/`sorting_open` also change programmatically
|
|
4687
|
+
// (undo toast, history-state restore, SDK consumers), and those must not steal focus.
|
|
4688
|
+
let user_opened_panel = false;
|
|
4689
|
+
let filter_toggle_button;
|
|
4690
|
+
let sort_toggle_button;
|
|
4691
|
+
let current_panel;
|
|
4692
|
+
let current_panel_toggle_button;
|
|
4693
|
+
const focus_panel_when_in_dom = panel => $i7OB2$catchify1(async () => {
|
|
4694
|
+
// Bounded wait: if the panel never lands in the DOM (e.g. it's superseded by a rapid re-render before
|
|
4695
|
+
// insertion), the timeout lets this promise resolve instead of keeping `panel` - and the observer
|
|
4696
|
+
// listener it registers - referenced forever.
|
|
4697
|
+
await (0, $i7OB2$observer).wait_for_element(panel, 4000);
|
|
4698
|
+
if (panel.isConnected) panel.focus();
|
|
4699
|
+
})();
|
|
4700
|
+
const register_desktop_panel = (el, toggle_button, should_focus) => {
|
|
4701
|
+
current_panel = el;
|
|
4702
|
+
current_panel_toggle_button = toggle_button;
|
|
4703
|
+
if (should_focus) focus_panel_when_in_dom(el);
|
|
4704
|
+
};
|
|
4656
4705
|
const make_open_filters_button = (adhere_to_width = false, is_tabbable = false) => $i7OB2$createComponent($cdea4cf8c5c071ef$var$OpenFiltersButton, {
|
|
4657
4706
|
tabindex_: is_tabbable ? 0 : -1,
|
|
4658
4707
|
i18n_: i18n_,
|
|
@@ -4660,7 +4709,9 @@ function $cdea4cf8c5c071ef$export$d7841e452f2e59a8({
|
|
|
4660
4709
|
search_sorting_open_: search_sorting_open_,
|
|
4661
4710
|
number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_,
|
|
4662
4711
|
filter_button_width_: adhere_to_width ? filter_button_width_ : undefined,
|
|
4663
|
-
hide_button_: hide_filters
|
|
4712
|
+
hide_button_: hide_filters,
|
|
4713
|
+
on_user_open_: () => user_opened_panel = true,
|
|
4714
|
+
button_ref_: is_tabbable ? el => filter_toggle_button = el : undefined
|
|
4664
4715
|
});
|
|
4665
4716
|
const make_open_sorting_button = (adhere_to_width = false, is_tabbable = false) => $i7OB2$createComponent($cdea4cf8c5c071ef$var$OpenSortingButton, {
|
|
4666
4717
|
tabindex_: is_tabbable ? 0 : -1,
|
|
@@ -4670,7 +4721,9 @@ function $cdea4cf8c5c071ef$export$d7841e452f2e59a8({
|
|
|
4670
4721
|
search_sorting_open_: search_sorting_open_,
|
|
4671
4722
|
available_sortings_: available_sortings_,
|
|
4672
4723
|
sort_button_width_: adhere_to_width ? sort_button_width_ : undefined,
|
|
4673
|
-
meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
|
|
4724
|
+
meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_,
|
|
4725
|
+
on_user_open_: () => user_opened_panel = true,
|
|
4726
|
+
button_ref_: is_tabbable ? el => sort_toggle_button = el : undefined
|
|
4674
4727
|
});
|
|
4675
4728
|
let open_modal_;
|
|
4676
4729
|
let close_modal_;
|
|
@@ -4689,9 +4742,34 @@ function $cdea4cf8c5c071ef$export$d7841e452f2e59a8({
|
|
|
4689
4742
|
grid_is_in_original_state = true;
|
|
4690
4743
|
}
|
|
4691
4744
|
});
|
|
4745
|
+
// Restore focus to the relevant toggle button when a desktop panel is torn down while focus is still inside it.
|
|
4746
|
+
const restore_focus_to_toggle_on_close = () => {
|
|
4747
|
+
const button_to_restore = current_panel_toggle_button;
|
|
4748
|
+
const focus_was_in_panel = !!current_panel && current_panel.contains(document.activeElement);
|
|
4749
|
+
current_panel = undefined;
|
|
4750
|
+
current_panel_toggle_button = undefined;
|
|
4751
|
+
if (focus_was_in_panel) button_to_restore?.focus();
|
|
4752
|
+
};
|
|
4753
|
+
// `<section>` + `aria-label` so the panel announces itself ("Filters"/"Sort") when we move focus to it; the bare
|
|
4754
|
+
// tabindex=-1 container would otherwise give screen readers nothing to read on focus. A semantic <section> avoids
|
|
4755
|
+
// an ARIA role and the UA styling pitfalls of <fieldset>; the existing CSS targets the `.filters`/`.sorting` class.
|
|
4756
|
+
const FiltersPanel = should_focus => $i7OB2$createComponent((0, $i7OB2$Show), {
|
|
4757
|
+
get when() {
|
|
4758
|
+
return !hide_filters();
|
|
4759
|
+
},
|
|
4760
|
+
get children() {
|
|
4761
|
+
return $i7OB2$ssr($cdea4cf8c5c071ef$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$ssrAttribute("tabindex", -1, false) + $i7OB2$ssrAttribute("aria-label", $i7OB2$escape(i18n_.filters_(), true), false), $i7OB2$escape($i7OB2$createComponent((0, $fab07f52c9861732$export$3f1a388cc0d8fed7), filter_options)));
|
|
4762
|
+
}
|
|
4763
|
+
});
|
|
4764
|
+
const SortingPanel = should_focus => $i7OB2$ssr($cdea4cf8c5c071ef$var$_tmpl$2, $i7OB2$ssrHydrationKey(), $i7OB2$ssrAttribute("tabindex", -1, false) + $i7OB2$ssrAttribute("aria-label", $i7OB2$escape(i18n_.sorting_text_(), true), false), $i7OB2$escape($i7OB2$createComponent((0, $68a258a92b88f02f$export$1f1775a58da589b5), sorting_options)));
|
|
4692
4765
|
$i7OB2$createEffect(() => {
|
|
4766
|
+
// Consume the user-intent flag once per run, in every branch, so a stale flag can't leak into a later
|
|
4767
|
+
// resize-triggered re-render and steal focus.
|
|
4768
|
+
const should_focus_panel = user_opened_panel;
|
|
4769
|
+
user_opened_panel = false;
|
|
4693
4770
|
if (!filters_open() && !sorting_open()) {
|
|
4694
4771
|
close_modal_?.();
|
|
4772
|
+
restore_focus_to_toggle_on_close();
|
|
4695
4773
|
set_extra_els_in_results_container_("");
|
|
4696
4774
|
} else if (isSmall()()) {
|
|
4697
4775
|
if ($i7OB2$untrack(() => input_modal_open_?.())) {
|
|
@@ -4700,18 +4778,14 @@ function $cdea4cf8c5c071ef$export$d7841e452f2e59a8({
|
|
|
4700
4778
|
set_sorting_open(false);
|
|
4701
4779
|
return;
|
|
4702
4780
|
}
|
|
4781
|
+
// The modal manages its own focus; just drop the desktop panel reference.
|
|
4782
|
+
current_panel = undefined;
|
|
4783
|
+
current_panel_toggle_button = undefined;
|
|
4703
4784
|
open_modal_?.();
|
|
4704
4785
|
set_extra_els_in_results_container_("");
|
|
4705
4786
|
} else {
|
|
4706
4787
|
close_modal_?.();
|
|
4707
|
-
if (filters_open()) set_extra_els_in_results_container_(() =>
|
|
4708
|
-
get when() {
|
|
4709
|
-
return !hide_filters();
|
|
4710
|
-
},
|
|
4711
|
-
get children() {
|
|
4712
|
-
return $i7OB2$ssr($cdea4cf8c5c071ef$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape($i7OB2$createComponent((0, $fab07f52c9861732$export$3f1a388cc0d8fed7), filter_options)));
|
|
4713
|
-
}
|
|
4714
|
-
}));else set_extra_els_in_results_container_($i7OB2$ssr($cdea4cf8c5c071ef$var$_tmpl$2, $i7OB2$ssrHydrationKey(), $i7OB2$escape($i7OB2$createComponent((0, $68a258a92b88f02f$export$1f1775a58da589b5), sorting_options))));
|
|
4788
|
+
if (filters_open()) set_extra_els_in_results_container_(() => FiltersPanel(should_focus_panel));else set_extra_els_in_results_container_(SortingPanel(should_focus_panel));
|
|
4715
4789
|
}
|
|
4716
4790
|
});
|
|
4717
4791
|
$i7OB2$catchify1(async () => {
|
|
@@ -4761,7 +4835,9 @@ function $cdea4cf8c5c071ef$var$OpenFiltersButton({
|
|
|
4761
4835
|
filter_button_width_: filter_button_width_,
|
|
4762
4836
|
tabindex_: tabindex_,
|
|
4763
4837
|
number_of_rendered_selected_filters_items_: [num_selected_filters],
|
|
4764
|
-
hide_button_: hide_button_
|
|
4838
|
+
hide_button_: hide_button_,
|
|
4839
|
+
on_user_open_: on_user_open_,
|
|
4840
|
+
button_ref_: button_ref_
|
|
4765
4841
|
}) {
|
|
4766
4842
|
const filters_closed = $i7OB2$createMemo(() => !search_filters_open_[0]());
|
|
4767
4843
|
// We assume in embedded_num_products that this is a single HTMLElement so pls change there if you change it here
|
|
@@ -4774,7 +4850,7 @@ function $cdea4cf8c5c071ef$var$OpenFiltersButton({
|
|
|
4774
4850
|
get children() {
|
|
4775
4851
|
return $i7OB2$ssr($cdea4cf8c5c071ef$var$_tmpl$4, $i7OB2$ssrHydrationKey(), $i7OB2$ssrStyle(filters_closed() ? `` : `opacity:0`), $i7OB2$escape(num_selected_filters()));
|
|
4776
4852
|
}
|
|
4777
|
-
})), $i7OB2$ssrAttribute("tabindex", $i7OB2$escape(tabindex_, true), false), `${!filters_closed() ? "major" : ""} ${filters_closed() ? "minor" : ""} ${"filter toggle-button major-minor-transition" + ((0, $i7OB2$isServer) ? " minor" : "")}`, $i7OB2$ssrAttribute("aria-label", $i7OB2$escape((filters_closed() ? i18n_.open_filters_ : i18n_.close_filters_)(), true), false), $i7OB2$ssrStyle(filter_button_width_?.() ? {
|
|
4853
|
+
})), $i7OB2$ssrAttribute("tabindex", $i7OB2$escape(tabindex_, true), false), `${!filters_closed() ? "major" : ""} ${filters_closed() ? "minor" : ""} ${"filter toggle-button major-minor-transition" + ((0, $i7OB2$isServer) ? " minor" : "")}`, $i7OB2$ssrAttribute("aria-label", $i7OB2$escape((filters_closed() ? i18n_.open_filters_ : i18n_.close_filters_)(), true), false) + $i7OB2$ssrAttribute("aria-expanded", !filters_closed(), false), $i7OB2$ssrStyle(filter_button_width_?.() ? {
|
|
4778
4854
|
width: filter_button_width_() + "px"
|
|
4779
4855
|
} : {}), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Show), {
|
|
4780
4856
|
get when() {
|
|
@@ -4796,11 +4872,13 @@ function $cdea4cf8c5c071ef$var$OpenSortingButton({
|
|
|
4796
4872
|
search_sorting_open_: search_sorting_open_,
|
|
4797
4873
|
sort_button_width_: sort_button_width_,
|
|
4798
4874
|
tabindex_: tabindex_,
|
|
4799
|
-
meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
|
|
4875
|
+
meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_,
|
|
4876
|
+
on_user_open_: on_user_open_,
|
|
4877
|
+
button_ref_: button_ref_
|
|
4800
4878
|
}) {
|
|
4801
4879
|
const sorting_closed = $i7OB2$createMemo(() => !search_sorting_open_[0]());
|
|
4802
4880
|
// We assume in embedded_num_products that this is a single HTMLElement so pls change there if you change it here
|
|
4803
|
-
return $i7OB2$ssr($cdea4cf8c5c071ef$var$_tmpl$6, $i7OB2$ssrHydrationKey(), `${!sorting_closed() ? "major" : ""} ${sorting_closed() ? "minor" : ""} toggle-button for-sorting major-minor-transition`, $i7OB2$ssrAttribute("tabindex", $i7OB2$escape(tabindex_, true), false) + $i7OB2$ssrAttribute("aria-label", $i7OB2$escape((sorting_closed() ? i18n_.open_sorting_ : i18n_.close_sorting_)(), true), false), $i7OB2$ssrStyle(sort_button_width_?.() ? {
|
|
4881
|
+
return $i7OB2$ssr($cdea4cf8c5c071ef$var$_tmpl$6, $i7OB2$ssrHydrationKey(), `${!sorting_closed() ? "major" : ""} ${sorting_closed() ? "minor" : ""} toggle-button for-sorting major-minor-transition`, $i7OB2$ssrAttribute("tabindex", $i7OB2$escape(tabindex_, true), false) + $i7OB2$ssrAttribute("aria-label", $i7OB2$escape((sorting_closed() ? i18n_.open_sorting_ : i18n_.close_sorting_)(), true), false) + $i7OB2$ssrAttribute("aria-expanded", !sorting_closed(), false), $i7OB2$ssrStyle(sort_button_width_?.() ? {
|
|
4804
4882
|
width: sort_button_width_() + "px"
|
|
4805
4883
|
} : {}),
|
|
4806
4884
|
// Show the title of the currently selected sorting when the sorting is closed, if there's currently a sorting selected
|