@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/ES10/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import $b8hua$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpe
|
|
|
10
10
|
/*! Depict.ai search and product listing SDK */
|
|
11
11
|
import { register_es_version } from "../../multi_import_deduplicator.mjs";
|
|
12
12
|
register_es_version("ui", "ES10");
|
|
13
|
-
const $8db9a15135765c11$export$83d89fbfd8236492 = "4.10.
|
|
13
|
+
const $8db9a15135765c11$export$83d89fbfd8236492 = "4.10.14";
|
|
14
14
|
function $00a5b94f0c11efbb$export$d9f36cf74e24d595(media_query) {
|
|
15
15
|
const signal = $b8hua$createSignal(false);
|
|
16
16
|
$b8hua$onCleanup($b8hua$javascript_media_query(media_query, _ref => {
|
|
@@ -2206,13 +2206,15 @@ function $ff3225aef892a467$export$f21ab0717a89c77f(props) {
|
|
|
2206
2206
|
height: "12"
|
|
2207
2207
|
}), () => $b8hua$ssr($ff3225aef892a467$var$_tmpl$), true);
|
|
2208
2208
|
}
|
|
2209
|
-
var $3e850b2f2cca761f$var$_tmpl$ = ["<button", ' type="button" class="', '"
|
|
2209
|
+
var $3e850b2f2cca761f$var$_tmpl$ = ["<button", ' type="button" class="', '"', "><!--$-->", "<!--/--><span>", "</span></button>"];
|
|
2210
2210
|
function $3e850b2f2cca761f$export$ca21a16d65b3dd8(_ref) {
|
|
2211
2211
|
let {
|
|
2212
2212
|
show_extras_: [get_show_extras, set_show_extras],
|
|
2213
|
-
i18n_: i18n_
|
|
2213
|
+
i18n_: i18n_,
|
|
2214
|
+
expanding_container_element_: expanding_container_element_
|
|
2214
2215
|
} = _ref;
|
|
2215
|
-
|
|
2216
|
+
let button;
|
|
2217
|
+
return $b8hua$ssr($3e850b2f2cca761f$var$_tmpl$, $b8hua$ssrHydrationKey(), "expand-filter ".concat(get_show_extras() ? "expanded" : ""), $b8hua$ssrAttribute("aria-expanded", $b8hua$escape(get_show_extras(), true), false), $b8hua$escape($b8hua$createComponent((0, $ff3225aef892a467$export$f21ab0717a89c77f), {})), get_show_extras() ? $b8hua$escape(i18n_.view_less_()) : $b8hua$escape(i18n_.view_more_()));
|
|
2216
2218
|
}
|
|
2217
2219
|
var $02b6641aa50ce528$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"],
|
|
2218
2220
|
$02b6641aa50ce528$var$_tmpl$2 = ["<span", ' class="', '"', ">", "</span>"];
|
|
@@ -2373,7 +2375,8 @@ function $133484ef10e4e954$export$dd948f91abc3a1c4(_ref) {
|
|
|
2373
2375
|
$b8hua$createRenderEffect(() => {
|
|
2374
2376
|
set_view_more_button_below_group_(togglable_rest() ? $b8hua$createComponent((0, $3e850b2f2cca761f$export$ca21a16d65b3dd8), {
|
|
2375
2377
|
show_extras_: show_extras_signal,
|
|
2376
|
-
i18n_: i18n_
|
|
2378
|
+
i18n_: i18n_,
|
|
2379
|
+
expanding_container_element_: expanding_container_els
|
|
2377
2380
|
}) : []);
|
|
2378
2381
|
});
|
|
2379
2382
|
$b8hua$onCleanup(() => set_view_more_button_below_group_());
|
|
@@ -2461,7 +2464,7 @@ function $b54fc842e721c9eb$export$430444115f70a734(_ref) {
|
|
|
2461
2464
|
}
|
|
2462
2465
|
})));
|
|
2463
2466
|
}
|
|
2464
|
-
var $1e7465a8ffa97f6c$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>"],
|
|
2467
|
+
var $1e7465a8ffa97f6c$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>"],
|
|
2465
2468
|
$1e7465a8ffa97f6c$var$_tmpl$2 = ["<div", ' class="slider"><div class="progress" style="', '"></div></div>'],
|
|
2466
2469
|
$1e7465a8ffa97f6c$var$_tmpl$3 = ["<div", ' class="range-group"><input', ' type="range"', ' step="any"><input', ' type="range"', ' step="any"></div>'];
|
|
2467
2470
|
function $1e7465a8ffa97f6c$export$e0d834a0ad870cda(_ref) {
|
|
@@ -2560,7 +2563,8 @@ function $1e7465a8ffa97f6c$var$RangeSelector(_ref3) {
|
|
|
2560
2563
|
min_: min_,
|
|
2561
2564
|
current_range_: current_range_,
|
|
2562
2565
|
i18n_: i18n_,
|
|
2563
|
-
should_be_disabled_: should_be_disabled_
|
|
2566
|
+
should_be_disabled_: should_be_disabled_,
|
|
2567
|
+
priceFormatting_: price_formatting_
|
|
2564
2568
|
})), $b8hua$escape(pre_price()), $b8hua$escape($b8hua$createComponent((0, $60ec7a29849d81db$export$a71e92cfbb498adc), {
|
|
2565
2569
|
get price_() {
|
|
2566
2570
|
return min_();
|
|
@@ -2583,7 +2587,8 @@ function $1e7465a8ffa97f6c$var$ExponentialSlider(_ref4) {
|
|
|
2583
2587
|
min_: min_,
|
|
2584
2588
|
i18n_: i18n_,
|
|
2585
2589
|
max_: max_,
|
|
2586
|
-
should_be_disabled_: should_be_disabled_
|
|
2590
|
+
should_be_disabled_: should_be_disabled_,
|
|
2591
|
+
priceFormatting_: priceFormatting_
|
|
2587
2592
|
} = _ref4;
|
|
2588
2593
|
// inspired by https://observablehq.com/@mbostock/nonlinear-slider
|
|
2589
2594
|
const transform_linear_to_nonlinear = _ref5 => {
|
|
@@ -2620,7 +2625,8 @@ function $1e7465a8ffa97f6c$var$ExponentialSlider(_ref4) {
|
|
|
2620
2625
|
max_: modified_max,
|
|
2621
2626
|
offset_value_calculator_: offset_value_calculator_,
|
|
2622
2627
|
i18n_: i18n_,
|
|
2623
|
-
should_be_disabled_: should_be_disabled_
|
|
2628
|
+
should_be_disabled_: should_be_disabled_,
|
|
2629
|
+
priceFormatting_: priceFormatting_
|
|
2624
2630
|
});
|
|
2625
2631
|
}
|
|
2626
2632
|
function $1e7465a8ffa97f6c$var$LinearSlider(_ref6) {
|
|
@@ -2630,12 +2636,17 @@ function $1e7465a8ffa97f6c$var$LinearSlider(_ref6) {
|
|
|
2630
2636
|
current_range_: current_range_,
|
|
2631
2637
|
offset_value_calculator_: offset_value_calculator_,
|
|
2632
2638
|
i18n_: i18n_,
|
|
2633
|
-
should_be_disabled_: should_be_disabled_
|
|
2639
|
+
should_be_disabled_: should_be_disabled_,
|
|
2640
|
+
priceFormatting_: priceFormatting_
|
|
2634
2641
|
} = _ref6;
|
|
2635
2642
|
let range_input_1;
|
|
2636
2643
|
let range_input_2;
|
|
2637
2644
|
let clickable_slider;
|
|
2638
2645
|
const [get_current_range, set_current_range] = current_range_;
|
|
2646
|
+
const formatRealPrice = value => {
|
|
2647
|
+
const priceFormatting = priceFormatting_();
|
|
2648
|
+
return priceFormatting.pre_ + $b8hua$standard_price_format(value, priceFormatting.places_after_comma_, priceFormatting.decimal_places_delimiter_, priceFormatting.thousands_delimiter_) + priceFormatting.post_;
|
|
2649
|
+
};
|
|
2639
2650
|
const progress_styling = $b8hua$createMemo(() => {
|
|
2640
2651
|
const min = min_();
|
|
2641
2652
|
const span = max_() - min;
|
|
@@ -2654,13 +2665,13 @@ function $1e7465a8ffa97f6c$var$LinearSlider(_ref6) {
|
|
|
2654
2665
|
el.value = get_current_range()[index];
|
|
2655
2666
|
});
|
|
2656
2667
|
};
|
|
2657
|
-
return [$b8hua$ssr($1e7465a8ffa97f6c$var$_tmpl$2, $b8hua$ssrHydrationKey(), $b8hua$ssrStyle(progress_styling())), $b8hua$ssr($1e7465a8ffa97f6c$var$_tmpl$3, $b8hua$ssrHydrationKey(), $b8hua$ssrAttribute("disabled", should_be_disabled_(), true), $b8hua$ssrAttribute("aria-label", $b8hua$escape(i18n_.range_filter_low_point_aria_label_(), true), false) + $b8hua$ssrAttribute("min", $b8hua$escape(min_(), true), false) + $b8hua$ssrAttribute("max", $b8hua$escape(max_(), true), false) + $b8hua$ssrAttribute("value", $b8hua$escape($b8hua$createMemo(() => {
|
|
2668
|
+
return [$b8hua$ssr($1e7465a8ffa97f6c$var$_tmpl$2, $b8hua$ssrHydrationKey(), $b8hua$ssrStyle(progress_styling())), $b8hua$ssr($1e7465a8ffa97f6c$var$_tmpl$3, $b8hua$ssrHydrationKey(), $b8hua$ssrAttribute("disabled", should_be_disabled_(), true), $b8hua$ssrAttribute("aria-label", $b8hua$escape(i18n_.range_filter_low_point_aria_label_(), true), false) + $b8hua$ssrAttribute("aria-valuetext", $b8hua$escape(formatRealPrice(get_current_range()[0]), true), false) + $b8hua$ssrAttribute("min", $b8hua$escape(min_(), true), false) + $b8hua$ssrAttribute("max", $b8hua$escape(max_(), true), false) + $b8hua$ssrAttribute("value", $b8hua$escape($b8hua$createMemo(() => {
|
|
2658
2669
|
min_();
|
|
2659
2670
|
max_();
|
|
2660
2671
|
return get_current_range()[0];
|
|
2661
2672
|
}, undefined, {
|
|
2662
2673
|
equals: false
|
|
2663
|
-
})(), true), false), $b8hua$ssrAttribute("disabled", should_be_disabled_(), true) + $b8hua$ssrAttribute("aria-label", $b8hua$escape(i18n_.range_filter_high_point_aria_label_(), true), false), $b8hua$ssrAttribute("min", $b8hua$escape(min_(), true), false) + $b8hua$ssrAttribute("max", $b8hua$escape(max_(), true), false))];
|
|
2674
|
+
})(), true), false), $b8hua$ssrAttribute("disabled", should_be_disabled_(), true) + $b8hua$ssrAttribute("aria-label", $b8hua$escape(i18n_.range_filter_high_point_aria_label_(), true), false) + $b8hua$ssrAttribute("aria-valuetext", $b8hua$escape(formatRealPrice(get_current_range()[1]), true), false), $b8hua$ssrAttribute("min", $b8hua$escape(min_(), true), false) + $b8hua$ssrAttribute("max", $b8hua$escape(max_(), true), false))];
|
|
2664
2675
|
}
|
|
2665
2676
|
function $1e7465a8ffa97f6c$var$set_range_with_sanitation(min_, max_, current_range_signal, index, target_el) {
|
|
2666
2677
|
let get_offset_value = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : (value, how_many) => value + how_many;
|
|
@@ -3082,7 +3093,8 @@ function $0ae614c5c7babb43$export$a32086fa6616eafd(_ref) {
|
|
|
3082
3093
|
$b8hua$createRenderEffect(() => {
|
|
3083
3094
|
set_view_more_button_below_group(some_top_level_are_hidden() ? $b8hua$createComponent((0, $3e850b2f2cca761f$export$ca21a16d65b3dd8), {
|
|
3084
3095
|
show_extras_: show_extras,
|
|
3085
|
-
i18n_: i18n_
|
|
3096
|
+
i18n_: i18n_,
|
|
3097
|
+
expanding_container_element_: expanding_container_els
|
|
3086
3098
|
}) : []);
|
|
3087
3099
|
});
|
|
3088
3100
|
$b8hua$onCleanup(() => set_view_more_button_below_group());
|
|
@@ -3528,6 +3540,13 @@ const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
|
|
|
3528
3540
|
const label = $b8hua$createMemo(() => value().name_ || value().value_ + "");
|
|
3529
3541
|
const count_zero = $b8hua$createMemo(() => value().count_ === 0);
|
|
3530
3542
|
return $b8hua$ssrElement("button", $b8hua$mergeProps1(attributes, {
|
|
3543
|
+
type: "button",
|
|
3544
|
+
get ["aria-pressed"]() {
|
|
3545
|
+
return is_selected();
|
|
3546
|
+
},
|
|
3547
|
+
get ["aria-label"]() {
|
|
3548
|
+
return value().count_ != undefined ? "".concat(label(), ", ").concat(value().count_) : label();
|
|
3549
|
+
},
|
|
3531
3550
|
get disabled() {
|
|
3532
3551
|
return count_zero() && !is_selected();
|
|
3533
3552
|
},
|
|
@@ -3706,7 +3725,14 @@ function $2cb856c297c53e6c$export$82ed4b28ecb67608(_ref) {
|
|
|
3706
3725
|
return !!(data !== null && data !== void 0 && data.some(item => $af5d8e0b7d97a7f6$export$325f75597868c4f0(item) === value));
|
|
3707
3726
|
});
|
|
3708
3727
|
const value = $b8hua$createMemo(() => checkbox().value_);
|
|
3709
|
-
const label_text = $b8hua$createMemo(() =>
|
|
3728
|
+
const label_text = $b8hua$createMemo(() => {
|
|
3729
|
+
const name = checkbox().name_;
|
|
3730
|
+
if (name) return name;
|
|
3731
|
+
const value_string = value() + "";
|
|
3732
|
+
if (backendFilterV2()) return value_string;
|
|
3733
|
+
// Legacy values are "Name;#hex" - split is used to get the name so that screen readers don't announce the hex code
|
|
3734
|
+
return value_string.split(";")[0] || value_string;
|
|
3735
|
+
});
|
|
3710
3736
|
const count = $b8hua$createMemo(() => checkbox().count_);
|
|
3711
3737
|
const colorNameDatasetValue = $b8hua$createMemo(() => {
|
|
3712
3738
|
var _split2;
|
|
@@ -3794,7 +3820,8 @@ function $2cb856c297c53e6c$export$82ed4b28ecb67608(_ref) {
|
|
|
3794
3820
|
$b8hua$createRenderEffect(() => {
|
|
3795
3821
|
set_view_more_button_below_group_(togglable_rest() ? $b8hua$createComponent((0, $3e850b2f2cca761f$export$ca21a16d65b3dd8), {
|
|
3796
3822
|
show_extras_: show_extras_signal,
|
|
3797
|
-
i18n_: i18n_
|
|
3823
|
+
i18n_: i18n_,
|
|
3824
|
+
expanding_container_element_: expanding_container_els
|
|
3798
3825
|
}) : []);
|
|
3799
3826
|
});
|
|
3800
3827
|
$b8hua$onCleanup(() => set_view_more_button_below_group_());
|
|
@@ -4134,9 +4161,9 @@ function $e354b2f9ce33cb75$var$find_str_arr_in_str_arr_arr(operation, haystack,
|
|
|
4134
4161
|
var $f6b0500577e1b210$var$_tmpl$ = ["<div", ' class="filter-collapsible">', "</div>"],
|
|
4135
4162
|
$f6b0500577e1b210$var$_tmpl$2 = ["<button", ' class="clear-group"><!--$-->', "<!--/--><span>", "</span></button>"],
|
|
4136
4163
|
$f6b0500577e1b210$var$_tmpl$3 = ["<div", ' class="view-more-clear"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"],
|
|
4137
|
-
$f6b0500577e1b210$var$_tmpl$4 = ["<div", ' class="filter-collapsible-body"><
|
|
4164
|
+
$f6b0500577e1b210$var$_tmpl$4 = ["<div", ' class="filter-collapsible-body"><fieldset class="filter-part"', "><!--$-->", "<!--/--><!--$-->", "<!--/--></fieldset><!--$-->", "<!--/--></div>"],
|
|
4138
4165
|
$f6b0500577e1b210$var$_tmpl$5 = ["<details", ' class="filter-collapsible"', "></details>"],
|
|
4139
|
-
$f6b0500577e1b210$var$_tmpl$6 = ["<summary", ' class="filter-group-summary"><div class="summary"><span
|
|
4166
|
+
$f6b0500577e1b210$var$_tmpl$6 = ["<summary", ' class="filter-group-summary"><div class="summary"><span', ">", '</span><div class="selected-w-sign"><!--$-->', "<!--/--><!--$-->", "<!--/--></div></div></summary>"],
|
|
4140
4167
|
$f6b0500577e1b210$var$_tmpl$7 = ["<div", ' class="ungrouped">', "</div>"],
|
|
4141
4168
|
$f6b0500577e1b210$var$_tmpl$8 = ["<button", ' class="clear-all-filters major">', "</button>"];
|
|
4142
4169
|
function $f6b0500577e1b210$export$3f1a388cc0d8fed7(props) {
|
|
@@ -4233,13 +4260,14 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
|
|
|
4233
4260
|
var _get_details_width;
|
|
4234
4261
|
return get_details_width === null || get_details_width === void 0 ? void 0 : (_get_details_width = get_details_width()) === null || _get_details_width === void 0 ? void 0 : _get_details_width();
|
|
4235
4262
|
});
|
|
4263
|
+
const title_id = $b8hua$make_random_classname();
|
|
4236
4264
|
return $b8hua$createComponent((0, $ad371564683947ab$export$6c6d7a51fa9aa15d), {
|
|
4237
4265
|
is_open_: is_open,
|
|
4238
4266
|
get details_() {
|
|
4239
4267
|
return $b8hua$ssr($f6b0500577e1b210$var$_tmpl$5, $b8hua$ssrHydrationKey(), $b8hua$ssrAttribute("data-group-title", $b8hua$escape(section_, true), false));
|
|
4240
4268
|
},
|
|
4241
4269
|
get summary_() {
|
|
4242
|
-
return $b8hua$ssr($f6b0500577e1b210$var$_tmpl$6, $b8hua$ssrHydrationKey(), $b8hua$escape(section_), $b8hua$escape($b8hua$createComponent((0, $b8hua$Show), {
|
|
4270
|
+
return $b8hua$ssr($f6b0500577e1b210$var$_tmpl$6, $b8hua$ssrHydrationKey(), $b8hua$ssrAttribute("id", $b8hua$escape(title_id, true), false), $b8hua$escape(section_), $b8hua$escape($b8hua$createComponent((0, $b8hua$Show), {
|
|
4243
4271
|
get when() {
|
|
4244
4272
|
return a_filter_is_selected();
|
|
4245
4273
|
},
|
|
@@ -4261,7 +4289,7 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
|
|
|
4261
4289
|
})));
|
|
4262
4290
|
},
|
|
4263
4291
|
get children() {
|
|
4264
|
-
return $b8hua$ssr($f6b0500577e1b210$var$_tmpl$4, $b8hua$ssrHydrationKey(), $b8hua$escape($b8hua$createComponent(SearchThisFilterGroup_, {})), $b8hua$escape($b8hua$createComponent((0, $b8hua$Index), {
|
|
4292
|
+
return $b8hua$ssr($f6b0500577e1b210$var$_tmpl$4, $b8hua$ssrHydrationKey(), $b8hua$ssrAttribute("aria-labelledby", $b8hua$escape(title_id, true), false), $b8hua$escape($b8hua$createComponent(SearchThisFilterGroup_, {})), $b8hua$escape($b8hua$createComponent((0, $b8hua$Index), {
|
|
4265
4293
|
get each() {
|
|
4266
4294
|
return searched_filter_array_();
|
|
4267
4295
|
},
|
|
@@ -4876,8 +4904,8 @@ var $bce10e104a1dd893$var$_tmpl$ = ["<svg", ' xmlns="http://www.w3.org/2000/svg"
|
|
|
4876
4904
|
function $bce10e104a1dd893$export$cb808a3c41736d8e() {
|
|
4877
4905
|
return $b8hua$ssr($bce10e104a1dd893$var$_tmpl$, $b8hua$ssrHydrationKey());
|
|
4878
4906
|
}
|
|
4879
|
-
var $7396052a1484264f$var$_tmpl$ = ["<
|
|
4880
|
-
$7396052a1484264f$var$_tmpl$2 = ["<
|
|
4907
|
+
var $7396052a1484264f$var$_tmpl$ = ["<section", ' class="filters"', '><div class="body">', "</div></section>"],
|
|
4908
|
+
$7396052a1484264f$var$_tmpl$2 = ["<section", ' class="sorting"', '><div class="body">', "</div></section>"],
|
|
4881
4909
|
$7396052a1484264f$var$_tmpl$3 = ["<div", ' class="sort-and-filter-buttons"><div class="outer"><div class="inner"><!--$-->', "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--></div></div></div>"],
|
|
4882
4910
|
$7396052a1484264f$var$_tmpl$4 = ["<span", ' class="num-filters" style="', '">', "</span>"],
|
|
4883
4911
|
$7396052a1484264f$var$_tmpl$5 = ["<div", ' class="open-filters-button-container" style="', '"><!--$-->', "<!--/--><button", ' class="', '" type="button"', ' style="', '"><!--$-->', "<!--/--><span>", "</span></button></div>"],
|
|
@@ -4954,6 +4982,27 @@ function $7396052a1484264f$export$d7841e452f2e59a8(_ref) {
|
|
|
4954
4982
|
available_sortings_: available_sortings_,
|
|
4955
4983
|
meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
|
|
4956
4984
|
};
|
|
4985
|
+
// Keyboard accessibility for the desktop panels (rendered after the product grid in the DOM): when the user
|
|
4986
|
+
// opens a panel we move focus into it, and restore focus to the toggle button on close. Intent is tracked with
|
|
4987
|
+
// a plain flag set in the buttons' click handlers - `filters_open`/`sorting_open` also change programmatically
|
|
4988
|
+
// (undo toast, history-state restore, SDK consumers), and those must not steal focus.
|
|
4989
|
+
let user_opened_panel = false;
|
|
4990
|
+
let filter_toggle_button;
|
|
4991
|
+
let sort_toggle_button;
|
|
4992
|
+
let current_panel;
|
|
4993
|
+
let current_panel_toggle_button;
|
|
4994
|
+
const focus_panel_when_in_dom = panel => $b8hua$catchify1(async () => {
|
|
4995
|
+
// Bounded wait: if the panel never lands in the DOM (e.g. it's superseded by a rapid re-render before
|
|
4996
|
+
// insertion), the timeout lets this promise resolve instead of keeping `panel` - and the observer
|
|
4997
|
+
// listener it registers - referenced forever.
|
|
4998
|
+
await (0, $b8hua$observer).wait_for_element(panel, 4000);
|
|
4999
|
+
if (panel.isConnected) panel.focus();
|
|
5000
|
+
})();
|
|
5001
|
+
const register_desktop_panel = (el, toggle_button, should_focus) => {
|
|
5002
|
+
current_panel = el;
|
|
5003
|
+
current_panel_toggle_button = toggle_button;
|
|
5004
|
+
if (should_focus) focus_panel_when_in_dom(el);
|
|
5005
|
+
};
|
|
4957
5006
|
const make_open_filters_button = function () {
|
|
4958
5007
|
let adhere_to_width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
4959
5008
|
let is_tabbable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -4964,7 +5013,9 @@ function $7396052a1484264f$export$d7841e452f2e59a8(_ref) {
|
|
|
4964
5013
|
search_sorting_open_: search_sorting_open_,
|
|
4965
5014
|
number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_,
|
|
4966
5015
|
filter_button_width_: adhere_to_width ? filter_button_width_ : undefined,
|
|
4967
|
-
hide_button_: hide_filters
|
|
5016
|
+
hide_button_: hide_filters,
|
|
5017
|
+
on_user_open_: () => user_opened_panel = true,
|
|
5018
|
+
button_ref_: is_tabbable ? el => filter_toggle_button = el : undefined
|
|
4968
5019
|
});
|
|
4969
5020
|
};
|
|
4970
5021
|
const make_open_sorting_button = function () {
|
|
@@ -4978,7 +5029,9 @@ function $7396052a1484264f$export$d7841e452f2e59a8(_ref) {
|
|
|
4978
5029
|
search_sorting_open_: search_sorting_open_,
|
|
4979
5030
|
available_sortings_: available_sortings_,
|
|
4980
5031
|
sort_button_width_: adhere_to_width ? sort_button_width_ : undefined,
|
|
4981
|
-
meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
|
|
5032
|
+
meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_,
|
|
5033
|
+
on_user_open_: () => user_opened_panel = true,
|
|
5034
|
+
button_ref_: is_tabbable ? el => sort_toggle_button = el : undefined
|
|
4982
5035
|
});
|
|
4983
5036
|
};
|
|
4984
5037
|
let open_modal_;
|
|
@@ -4998,10 +5051,35 @@ function $7396052a1484264f$export$d7841e452f2e59a8(_ref) {
|
|
|
4998
5051
|
grid_is_in_original_state = true;
|
|
4999
5052
|
}
|
|
5000
5053
|
});
|
|
5054
|
+
// Restore focus to the relevant toggle button when a desktop panel is torn down while focus is still inside it.
|
|
5055
|
+
const restore_focus_to_toggle_on_close = () => {
|
|
5056
|
+
const button_to_restore = current_panel_toggle_button;
|
|
5057
|
+
const focus_was_in_panel = !!current_panel && current_panel.contains(document.activeElement);
|
|
5058
|
+
current_panel = undefined;
|
|
5059
|
+
current_panel_toggle_button = undefined;
|
|
5060
|
+
if (focus_was_in_panel) button_to_restore === null || button_to_restore === void 0 || button_to_restore.focus();
|
|
5061
|
+
};
|
|
5062
|
+
// `<section>` + `aria-label` so the panel announces itself ("Filters"/"Sort") when we move focus to it; the bare
|
|
5063
|
+
// tabindex=-1 container would otherwise give screen readers nothing to read on focus. A semantic <section> avoids
|
|
5064
|
+
// an ARIA role and the UA styling pitfalls of <fieldset>; the existing CSS targets the `.filters`/`.sorting` class.
|
|
5065
|
+
const FiltersPanel = should_focus => $b8hua$createComponent((0, $b8hua$Show), {
|
|
5066
|
+
get when() {
|
|
5067
|
+
return !hide_filters();
|
|
5068
|
+
},
|
|
5069
|
+
get children() {
|
|
5070
|
+
return $b8hua$ssr($7396052a1484264f$var$_tmpl$, $b8hua$ssrHydrationKey(), $b8hua$ssrAttribute("tabindex", -1, false) + $b8hua$ssrAttribute("aria-label", $b8hua$escape(i18n_.filters_(), true), false), $b8hua$escape($b8hua$createComponent((0, $f6b0500577e1b210$export$3f1a388cc0d8fed7), filter_options)));
|
|
5071
|
+
}
|
|
5072
|
+
});
|
|
5073
|
+
const SortingPanel = should_focus => $b8hua$ssr($7396052a1484264f$var$_tmpl$2, $b8hua$ssrHydrationKey(), $b8hua$ssrAttribute("tabindex", -1, false) + $b8hua$ssrAttribute("aria-label", $b8hua$escape(i18n_.sorting_text_(), true), false), $b8hua$escape($b8hua$createComponent((0, $cfdbd124dd09d713$export$1f1775a58da589b5), sorting_options)));
|
|
5001
5074
|
$b8hua$createEffect(() => {
|
|
5075
|
+
// Consume the user-intent flag once per run, in every branch, so a stale flag can't leak into a later
|
|
5076
|
+
// resize-triggered re-render and steal focus.
|
|
5077
|
+
const should_focus_panel = user_opened_panel;
|
|
5078
|
+
user_opened_panel = false;
|
|
5002
5079
|
if (!filters_open() && !sorting_open()) {
|
|
5003
5080
|
var _close_modal_;
|
|
5004
5081
|
(_close_modal_ = close_modal_) === null || _close_modal_ === void 0 || _close_modal_();
|
|
5082
|
+
restore_focus_to_toggle_on_close();
|
|
5005
5083
|
set_extra_els_in_results_container_("");
|
|
5006
5084
|
} else if (isSmall()()) {
|
|
5007
5085
|
var _open_modal_;
|
|
@@ -5011,19 +5089,15 @@ function $7396052a1484264f$export$d7841e452f2e59a8(_ref) {
|
|
|
5011
5089
|
set_sorting_open(false);
|
|
5012
5090
|
return;
|
|
5013
5091
|
}
|
|
5092
|
+
// The modal manages its own focus; just drop the desktop panel reference.
|
|
5093
|
+
current_panel = undefined;
|
|
5094
|
+
current_panel_toggle_button = undefined;
|
|
5014
5095
|
(_open_modal_ = open_modal_) === null || _open_modal_ === void 0 || _open_modal_();
|
|
5015
5096
|
set_extra_els_in_results_container_("");
|
|
5016
5097
|
} else {
|
|
5017
5098
|
var _close_modal_2;
|
|
5018
5099
|
(_close_modal_2 = close_modal_) === null || _close_modal_2 === void 0 || _close_modal_2();
|
|
5019
|
-
if (filters_open()) set_extra_els_in_results_container_(() =>
|
|
5020
|
-
get when() {
|
|
5021
|
-
return !hide_filters();
|
|
5022
|
-
},
|
|
5023
|
-
get children() {
|
|
5024
|
-
return $b8hua$ssr($7396052a1484264f$var$_tmpl$, $b8hua$ssrHydrationKey(), $b8hua$escape($b8hua$createComponent((0, $f6b0500577e1b210$export$3f1a388cc0d8fed7), filter_options)));
|
|
5025
|
-
}
|
|
5026
|
-
}));else set_extra_els_in_results_container_($b8hua$ssr($7396052a1484264f$var$_tmpl$2, $b8hua$ssrHydrationKey(), $b8hua$escape($b8hua$createComponent((0, $cfdbd124dd09d713$export$1f1775a58da589b5), sorting_options))));
|
|
5100
|
+
if (filters_open()) set_extra_els_in_results_container_(() => FiltersPanel(should_focus_panel));else set_extra_els_in_results_container_(SortingPanel(should_focus_panel));
|
|
5027
5101
|
}
|
|
5028
5102
|
});
|
|
5029
5103
|
$b8hua$catchify1(async () => {
|
|
@@ -5074,7 +5148,9 @@ function $7396052a1484264f$var$OpenFiltersButton(_ref3) {
|
|
|
5074
5148
|
filter_button_width_: filter_button_width_,
|
|
5075
5149
|
tabindex_: tabindex_,
|
|
5076
5150
|
number_of_rendered_selected_filters_items_: [num_selected_filters],
|
|
5077
|
-
hide_button_: hide_button_
|
|
5151
|
+
hide_button_: hide_button_,
|
|
5152
|
+
on_user_open_: on_user_open_,
|
|
5153
|
+
button_ref_: button_ref_
|
|
5078
5154
|
} = _ref3;
|
|
5079
5155
|
const filters_closed = $b8hua$createMemo(() => !search_filters_open_[0]());
|
|
5080
5156
|
// We assume in embedded_num_products that this is a single HTMLElement so pls change there if you change it here
|
|
@@ -5087,7 +5163,7 @@ function $7396052a1484264f$var$OpenFiltersButton(_ref3) {
|
|
|
5087
5163
|
get children() {
|
|
5088
5164
|
return $b8hua$ssr($7396052a1484264f$var$_tmpl$4, $b8hua$ssrHydrationKey(), $b8hua$ssrStyle(filters_closed() ? "" : "opacity:0"), $b8hua$escape(num_selected_filters()));
|
|
5089
5165
|
}
|
|
5090
|
-
})), $b8hua$ssrAttribute("tabindex", $b8hua$escape(tabindex_, true), false), "".concat(!filters_closed() ? "major" : "", " ").concat(filters_closed() ? "minor" : "").concat("filter toggle-button major-minor-transition" + ((0, $b8hua$isServer) ? " minor" : "")), $b8hua$ssrAttribute("aria-label", $b8hua$escape((filters_closed() ? i18n_.open_filters_ : i18n_.close_filters_)(), true), false), $b8hua$ssrStyle(filter_button_width_ !== null && filter_button_width_ !== void 0 && filter_button_width_() ? {
|
|
5166
|
+
})), $b8hua$ssrAttribute("tabindex", $b8hua$escape(tabindex_, true), false), "".concat(!filters_closed() ? "major" : "", " ").concat(filters_closed() ? "minor" : "").concat("filter toggle-button major-minor-transition" + ((0, $b8hua$isServer) ? " minor" : "")), $b8hua$ssrAttribute("aria-label", $b8hua$escape((filters_closed() ? i18n_.open_filters_ : i18n_.close_filters_)(), true), false) + $b8hua$ssrAttribute("aria-expanded", !filters_closed(), false), $b8hua$ssrStyle(filter_button_width_ !== null && filter_button_width_ !== void 0 && filter_button_width_() ? {
|
|
5091
5167
|
width: filter_button_width_() + "px"
|
|
5092
5168
|
} : {}), $b8hua$escape($b8hua$createComponent((0, $b8hua$Show), {
|
|
5093
5169
|
get when() {
|
|
@@ -5111,11 +5187,13 @@ function $7396052a1484264f$var$OpenSortingButton(_ref4) {
|
|
|
5111
5187
|
search_sorting_open_: search_sorting_open_,
|
|
5112
5188
|
sort_button_width_: sort_button_width_,
|
|
5113
5189
|
tabindex_: tabindex_,
|
|
5114
|
-
meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
|
|
5190
|
+
meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_,
|
|
5191
|
+
on_user_open_: on_user_open_,
|
|
5192
|
+
button_ref_: button_ref_
|
|
5115
5193
|
} = _ref4;
|
|
5116
5194
|
const sorting_closed = $b8hua$createMemo(() => !search_sorting_open_[0]());
|
|
5117
5195
|
// We assume in embedded_num_products that this is a single HTMLElement so pls change there if you change it here
|
|
5118
|
-
return $b8hua$ssr($7396052a1484264f$var$_tmpl$6, $b8hua$ssrHydrationKey(), "".concat(!sorting_closed() ? "major" : "", " ").concat(sorting_closed() ? "minor" : "", " toggle-button for-sorting major-minor-transition"), $b8hua$ssrAttribute("tabindex", $b8hua$escape(tabindex_, true), false) + $b8hua$ssrAttribute("aria-label", $b8hua$escape((sorting_closed() ? i18n_.open_sorting_ : i18n_.close_sorting_)(), true), false), $b8hua$ssrStyle(sort_button_width_ !== null && sort_button_width_ !== void 0 && sort_button_width_() ? {
|
|
5196
|
+
return $b8hua$ssr($7396052a1484264f$var$_tmpl$6, $b8hua$ssrHydrationKey(), "".concat(!sorting_closed() ? "major" : "", " ").concat(sorting_closed() ? "minor" : "", " toggle-button for-sorting major-minor-transition"), $b8hua$ssrAttribute("tabindex", $b8hua$escape(tabindex_, true), false) + $b8hua$ssrAttribute("aria-label", $b8hua$escape((sorting_closed() ? i18n_.open_sorting_ : i18n_.close_sorting_)(), true), false) + $b8hua$ssrAttribute("aria-expanded", !sorting_closed(), false), $b8hua$ssrStyle(sort_button_width_ !== null && sort_button_width_ !== void 0 && sort_button_width_() ? {
|
|
5119
5197
|
width: sort_button_width_() + "px"
|
|
5120
5198
|
} : {}),
|
|
5121
5199
|
// Show the title of the currently selected sorting when the sorting is closed, if there's currently a sorting selected
|