@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/ES10/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import $8tj43$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 = $8tj43$createSignal(false);
|
|
16
16
|
$8tj43$onCleanup($8tj43$javascript_media_query(media_query, _ref => {
|
|
@@ -2720,20 +2720,57 @@ var $3e850b2f2cca761f$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<button type=bu
|
|
|
2720
2720
|
function $3e850b2f2cca761f$export$ca21a16d65b3dd8(_ref) {
|
|
2721
2721
|
let {
|
|
2722
2722
|
show_extras_: [get_show_extras, set_show_extras],
|
|
2723
|
-
i18n_: i18n_
|
|
2723
|
+
i18n_: i18n_,
|
|
2724
|
+
expanding_container_element_: expanding_container_element_
|
|
2724
2725
|
} = _ref;
|
|
2726
|
+
let button;
|
|
2725
2727
|
return (() => {
|
|
2726
2728
|
var _el$ = $8tj43$getNextElement($3e850b2f2cca761f$var$_tmpl$),
|
|
2727
2729
|
_el$3 = _el$.firstChild,
|
|
2728
2730
|
[_el$4, _co$] = $8tj43$getNextMarker(_el$3.nextSibling),
|
|
2729
2731
|
_el$2 = _el$4.nextSibling;
|
|
2730
|
-
$8tj43$addEventListener(_el$, "click", $8tj43$catchify1(
|
|
2732
|
+
$8tj43$addEventListener(_el$, "click", $8tj43$catchify1(event => {
|
|
2733
|
+
const container = expanding_container_element_;
|
|
2734
|
+
const will_expand = !get_show_extras();
|
|
2735
|
+
// A click from Enter/Space on the button reports `detail === 0`; a real pointer click reports >= 1.
|
|
2736
|
+
// Only hijack focus for keyboard activation - mouse users can see the revealed options and don't need it
|
|
2737
|
+
// (and would otherwise get the viewport scrolled and an unexpected focus ring).
|
|
2738
|
+
const keyboard_activated = event.detail === 0;
|
|
2739
|
+
const had_focus_inside = !!container && container.contains(document.activeElement);
|
|
2740
|
+
set_show_extras(will_expand);
|
|
2741
|
+
if (will_expand) {
|
|
2742
|
+
if (!keyboard_activated) return;
|
|
2743
|
+
// The container's `expand()` (run from the consumer's effect after this handler) clears `inert`/`visibility`;
|
|
2744
|
+
// focus the first revealed option on the next frame so Tab continues through the newly shown options.
|
|
2745
|
+
// `preventScroll` so moving focus never yanks the viewport down to the first checkbox.
|
|
2746
|
+
requestAnimationFrame($8tj43$catchify1(() => {
|
|
2747
|
+
var _container$querySelec;
|
|
2748
|
+
return container === null || container === void 0 ? void 0 : (_container$querySelec = container.querySelector("input:not(:disabled)")) === null || _container$querySelec === void 0 ? void 0 : _container$querySelec.focus({
|
|
2749
|
+
preventScroll: true
|
|
2750
|
+
});
|
|
2751
|
+
}));
|
|
2752
|
+
} else if (had_focus_inside)
|
|
2753
|
+
// Keep focus on the toggle when collapsing, otherwise making the container `inert` dumps focus to <body>
|
|
2754
|
+
// (Safari doesn't focus buttons on mouse click, so focus can still be inside the container here).
|
|
2755
|
+
button.focus();
|
|
2756
|
+
}), true);
|
|
2757
|
+
var _ref$ = button;
|
|
2758
|
+
typeof _ref$ === "function" ? $8tj43$use(_ref$, _el$) : button = _el$;
|
|
2731
2759
|
$8tj43$insert(_el$, $8tj43$createComponent((0, $ff3225aef892a467$export$f21ab0717a89c77f), {}), _el$4, _co$);
|
|
2732
2760
|
$8tj43$insert(_el$2, (() => {
|
|
2733
2761
|
var _c$ = $8tj43$memo(() => !!get_show_extras());
|
|
2734
2762
|
return () => _c$() ? i18n_.view_less_() : i18n_.view_more_();
|
|
2735
2763
|
})());
|
|
2736
|
-
$8tj43$effect(
|
|
2764
|
+
$8tj43$effect(_p$ => {
|
|
2765
|
+
var _v$ = get_show_extras(),
|
|
2766
|
+
_v$2 = !!get_show_extras();
|
|
2767
|
+
_v$ !== _p$.e && $8tj43$setAttribute(_el$, "aria-expanded", _p$.e = _v$);
|
|
2768
|
+
_v$2 !== _p$.t && _el$.classList.toggle("expanded", _p$.t = _v$2);
|
|
2769
|
+
return _p$;
|
|
2770
|
+
}, {
|
|
2771
|
+
e: undefined,
|
|
2772
|
+
t: undefined
|
|
2773
|
+
});
|
|
2737
2774
|
$8tj43$runHydrationEvents();
|
|
2738
2775
|
return _el$;
|
|
2739
2776
|
})();
|
|
@@ -2917,7 +2954,8 @@ function $133484ef10e4e954$export$dd948f91abc3a1c4(_ref) {
|
|
|
2917
2954
|
$8tj43$createRenderEffect(() => {
|
|
2918
2955
|
set_view_more_button_below_group_(togglable_rest() ? $8tj43$createComponent((0, $3e850b2f2cca761f$export$ca21a16d65b3dd8), {
|
|
2919
2956
|
show_extras_: show_extras_signal,
|
|
2920
|
-
i18n_: i18n_
|
|
2957
|
+
i18n_: i18n_,
|
|
2958
|
+
expanding_container_element_: expanding_container_els
|
|
2921
2959
|
}) : []);
|
|
2922
2960
|
});
|
|
2923
2961
|
$8tj43$onCleanup(() => set_view_more_button_below_group_());
|
|
@@ -3076,7 +3114,7 @@ function $b54fc842e721c9eb$export$430444115f70a734(_ref) {
|
|
|
3076
3114
|
return _el$;
|
|
3077
3115
|
})();
|
|
3078
3116
|
}
|
|
3079
|
-
var $1e7465a8ffa97f6c$var$_tmpl$ = /*#__PURE__*/$8tj43$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><!$><!/><!$><!/><!$><!/>`),
|
|
3117
|
+
var $1e7465a8ffa97f6c$var$_tmpl$ = /*#__PURE__*/$8tj43$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><!$><!/><!$><!/><!$><!/>`),
|
|
3080
3118
|
$1e7465a8ffa97f6c$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<div class=slider><div class=progress>`),
|
|
3081
3119
|
$1e7465a8ffa97f6c$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<div class=range-group><input type=range step=any><input type=range step=any>`);
|
|
3082
3120
|
function $1e7465a8ffa97f6c$export$e0d834a0ad870cda(_ref) {
|
|
@@ -3218,7 +3256,8 @@ function $1e7465a8ffa97f6c$var$RangeSelector(_ref3) {
|
|
|
3218
3256
|
min_: min_,
|
|
3219
3257
|
current_range_: current_range_,
|
|
3220
3258
|
i18n_: i18n_,
|
|
3221
|
-
should_be_disabled_: should_be_disabled_
|
|
3259
|
+
should_be_disabled_: should_be_disabled_,
|
|
3260
|
+
priceFormatting_: price_formatting_
|
|
3222
3261
|
}), _el$24, _co$7);
|
|
3223
3262
|
$8tj43$insert(_el$9, pre_price, _el$11, _co$);
|
|
3224
3263
|
$8tj43$insert(_el$9, $8tj43$createComponent((0, $60ec7a29849d81db$export$a71e92cfbb498adc), {
|
|
@@ -3283,7 +3322,8 @@ function $1e7465a8ffa97f6c$var$ExponentialSlider(_ref6) {
|
|
|
3283
3322
|
min_: min_,
|
|
3284
3323
|
i18n_: i18n_,
|
|
3285
3324
|
max_: max_,
|
|
3286
|
-
should_be_disabled_: should_be_disabled_
|
|
3325
|
+
should_be_disabled_: should_be_disabled_,
|
|
3326
|
+
priceFormatting_: priceFormatting_
|
|
3287
3327
|
} = _ref6;
|
|
3288
3328
|
// inspired by https://observablehq.com/@mbostock/nonlinear-slider
|
|
3289
3329
|
const transform_linear_to_nonlinear = _ref7 => {
|
|
@@ -3320,7 +3360,8 @@ function $1e7465a8ffa97f6c$var$ExponentialSlider(_ref6) {
|
|
|
3320
3360
|
max_: modified_max,
|
|
3321
3361
|
offset_value_calculator_: offset_value_calculator_,
|
|
3322
3362
|
i18n_: i18n_,
|
|
3323
|
-
should_be_disabled_: should_be_disabled_
|
|
3363
|
+
should_be_disabled_: should_be_disabled_,
|
|
3364
|
+
priceFormatting_: priceFormatting_
|
|
3324
3365
|
});
|
|
3325
3366
|
}
|
|
3326
3367
|
function $1e7465a8ffa97f6c$var$LinearSlider(_ref8) {
|
|
@@ -3330,12 +3371,17 @@ function $1e7465a8ffa97f6c$var$LinearSlider(_ref8) {
|
|
|
3330
3371
|
current_range_: current_range_,
|
|
3331
3372
|
offset_value_calculator_: offset_value_calculator_,
|
|
3332
3373
|
i18n_: i18n_,
|
|
3333
|
-
should_be_disabled_: should_be_disabled_
|
|
3374
|
+
should_be_disabled_: should_be_disabled_,
|
|
3375
|
+
priceFormatting_: priceFormatting_
|
|
3334
3376
|
} = _ref8;
|
|
3335
3377
|
let range_input_1;
|
|
3336
3378
|
let range_input_2;
|
|
3337
3379
|
let clickable_slider;
|
|
3338
3380
|
const [get_current_range, set_current_range] = current_range_;
|
|
3381
|
+
const formatRealPrice = value => {
|
|
3382
|
+
const priceFormatting = priceFormatting_();
|
|
3383
|
+
return priceFormatting.pre_ + $8tj43$standard_price_format(value, priceFormatting.places_after_comma_, priceFormatting.decimal_places_delimiter_, priceFormatting.thousands_delimiter_) + priceFormatting.post_;
|
|
3384
|
+
};
|
|
3339
3385
|
const progress_styling = $8tj43$createMemo(() => {
|
|
3340
3386
|
const min = min_();
|
|
3341
3387
|
const span = max_() - min;
|
|
@@ -3392,20 +3438,24 @@ function $1e7465a8ffa97f6c$var$LinearSlider(_ref8) {
|
|
|
3392
3438
|
$8tj43$effect(_p$ => {
|
|
3393
3439
|
var _v$10 = should_be_disabled_(),
|
|
3394
3440
|
_v$11 = i18n_.range_filter_low_point_aria_label_(),
|
|
3395
|
-
_v$12 =
|
|
3396
|
-
_v$13 =
|
|
3397
|
-
_v$14 =
|
|
3398
|
-
_v$15 =
|
|
3399
|
-
_v$16 =
|
|
3400
|
-
_v$17 =
|
|
3441
|
+
_v$12 = formatRealPrice(get_current_range()[0]),
|
|
3442
|
+
_v$13 = min_(),
|
|
3443
|
+
_v$14 = max_(),
|
|
3444
|
+
_v$15 = should_be_disabled_(),
|
|
3445
|
+
_v$16 = i18n_.range_filter_high_point_aria_label_(),
|
|
3446
|
+
_v$17 = formatRealPrice(get_current_range()[1]),
|
|
3447
|
+
_v$18 = min_(),
|
|
3448
|
+
_v$19 = max_();
|
|
3401
3449
|
_v$10 !== _p$.e && $8tj43$setProperty(_el$28, "disabled", _p$.e = _v$10);
|
|
3402
3450
|
_v$11 !== _p$.t && $8tj43$setAttribute(_el$28, "aria-label", _p$.t = _v$11);
|
|
3403
|
-
_v$12 !== _p$.a && $8tj43$setAttribute(_el$28, "
|
|
3404
|
-
_v$13 !== _p$.o && $8tj43$setAttribute(_el$28, "
|
|
3405
|
-
_v$14 !== _p$.i && $8tj43$
|
|
3406
|
-
_v$15 !== _p$.n && $8tj43$
|
|
3407
|
-
_v$16 !== _p$.s && $8tj43$setAttribute(_el$29, "
|
|
3408
|
-
_v$17 !== _p$.h && $8tj43$setAttribute(_el$29, "
|
|
3451
|
+
_v$12 !== _p$.a && $8tj43$setAttribute(_el$28, "aria-valuetext", _p$.a = _v$12);
|
|
3452
|
+
_v$13 !== _p$.o && $8tj43$setAttribute(_el$28, "min", _p$.o = _v$13);
|
|
3453
|
+
_v$14 !== _p$.i && $8tj43$setAttribute(_el$28, "max", _p$.i = _v$14);
|
|
3454
|
+
_v$15 !== _p$.n && $8tj43$setProperty(_el$29, "disabled", _p$.n = _v$15);
|
|
3455
|
+
_v$16 !== _p$.s && $8tj43$setAttribute(_el$29, "aria-label", _p$.s = _v$16);
|
|
3456
|
+
_v$17 !== _p$.h && $8tj43$setAttribute(_el$29, "aria-valuetext", _p$.h = _v$17);
|
|
3457
|
+
_v$18 !== _p$.r && $8tj43$setAttribute(_el$29, "min", _p$.r = _v$18);
|
|
3458
|
+
_v$19 !== _p$.d && $8tj43$setAttribute(_el$29, "max", _p$.d = _v$19);
|
|
3409
3459
|
return _p$;
|
|
3410
3460
|
}, {
|
|
3411
3461
|
e: undefined,
|
|
@@ -3415,7 +3465,9 @@ function $1e7465a8ffa97f6c$var$LinearSlider(_ref8) {
|
|
|
3415
3465
|
i: undefined,
|
|
3416
3466
|
n: undefined,
|
|
3417
3467
|
s: undefined,
|
|
3418
|
-
h: undefined
|
|
3468
|
+
h: undefined,
|
|
3469
|
+
r: undefined,
|
|
3470
|
+
d: undefined
|
|
3419
3471
|
});
|
|
3420
3472
|
$8tj43$effect(() => $8tj43$setProperty(_el$28, "value", $8tj43$createMemo(() => {
|
|
3421
3473
|
min_();
|
|
@@ -3880,7 +3932,8 @@ function $0ae614c5c7babb43$export$a32086fa6616eafd(_ref) {
|
|
|
3880
3932
|
$8tj43$createRenderEffect(() => {
|
|
3881
3933
|
set_view_more_button_below_group(some_top_level_are_hidden() ? $8tj43$createComponent((0, $3e850b2f2cca761f$export$ca21a16d65b3dd8), {
|
|
3882
3934
|
show_extras_: show_extras,
|
|
3883
|
-
i18n_: i18n_
|
|
3935
|
+
i18n_: i18n_,
|
|
3936
|
+
expanding_container_element_: expanding_container_els
|
|
3884
3937
|
}) : []);
|
|
3885
3938
|
});
|
|
3886
3939
|
$8tj43$onCleanup(() => set_view_more_button_below_group());
|
|
@@ -4374,6 +4427,13 @@ const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
|
|
|
4374
4427
|
_el$7 = _el$6.nextSibling,
|
|
4375
4428
|
[_el$8, _co$2] = $8tj43$getNextMarker(_el$7.nextSibling);
|
|
4376
4429
|
$8tj43$spread(_el$2, $8tj43$mergeProps1(attributes, {
|
|
4430
|
+
"type": "button",
|
|
4431
|
+
get ["aria-pressed"]() {
|
|
4432
|
+
return is_selected();
|
|
4433
|
+
},
|
|
4434
|
+
get ["aria-label"]() {
|
|
4435
|
+
return $8tj43$memo(() => value().count_ != undefined)() ? "".concat(label(), ", ").concat(value().count_) : label();
|
|
4436
|
+
},
|
|
4377
4437
|
get disabled() {
|
|
4378
4438
|
return $8tj43$memo(() => !!count_zero())() && !is_selected();
|
|
4379
4439
|
},
|
|
@@ -4585,7 +4645,14 @@ function $2cb856c297c53e6c$export$82ed4b28ecb67608(_ref) {
|
|
|
4585
4645
|
return !!(data !== null && data !== void 0 && data.some(item => $af5d8e0b7d97a7f6$export$325f75597868c4f0(item) === value));
|
|
4586
4646
|
});
|
|
4587
4647
|
const value = $8tj43$createMemo(() => checkbox().value_);
|
|
4588
|
-
const label_text = $8tj43$createMemo(() =>
|
|
4648
|
+
const label_text = $8tj43$createMemo(() => {
|
|
4649
|
+
const name = checkbox().name_;
|
|
4650
|
+
if (name) return name;
|
|
4651
|
+
const value_string = value() + "";
|
|
4652
|
+
if (backendFilterV2()) return value_string;
|
|
4653
|
+
// Legacy values are "Name;#hex" - split is used to get the name so that screen readers don't announce the hex code
|
|
4654
|
+
return value_string.split(";")[0] || value_string;
|
|
4655
|
+
});
|
|
4589
4656
|
const count = $8tj43$createMemo(() => checkbox().count_);
|
|
4590
4657
|
const colorNameDatasetValue = $8tj43$createMemo(() => {
|
|
4591
4658
|
var _split2;
|
|
@@ -4673,7 +4740,8 @@ function $2cb856c297c53e6c$export$82ed4b28ecb67608(_ref) {
|
|
|
4673
4740
|
$8tj43$createRenderEffect(() => {
|
|
4674
4741
|
set_view_more_button_below_group_(togglable_rest() ? $8tj43$createComponent((0, $3e850b2f2cca761f$export$ca21a16d65b3dd8), {
|
|
4675
4742
|
show_extras_: show_extras_signal,
|
|
4676
|
-
i18n_: i18n_
|
|
4743
|
+
i18n_: i18n_,
|
|
4744
|
+
expanding_container_element_: expanding_container_els
|
|
4677
4745
|
}) : []);
|
|
4678
4746
|
});
|
|
4679
4747
|
$8tj43$onCleanup(() => set_view_more_button_below_group_());
|
|
@@ -5080,7 +5148,7 @@ $8tj43$delegateEvents(["input", "click"]);
|
|
|
5080
5148
|
var $f6b0500577e1b210$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class=filter-collapsible>`),
|
|
5081
5149
|
$f6b0500577e1b210$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<button class=clear-group><!$><!/><span>`),
|
|
5082
5150
|
$f6b0500577e1b210$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<div class=view-more-clear><!$><!/><!$><!/>`),
|
|
5083
|
-
$f6b0500577e1b210$var$_tmpl$4 = /*#__PURE__*/$8tj43$template(`<div class=filter-collapsible-body><
|
|
5151
|
+
$f6b0500577e1b210$var$_tmpl$4 = /*#__PURE__*/$8tj43$template(`<div class=filter-collapsible-body><fieldset class=filter-part><!$><!/><!$><!/></fieldset><!$><!/>`),
|
|
5084
5152
|
$f6b0500577e1b210$var$_tmpl$5 = /*#__PURE__*/$8tj43$template(`<details class=filter-collapsible>`),
|
|
5085
5153
|
$f6b0500577e1b210$var$_tmpl$6 = /*#__PURE__*/$8tj43$template(`<summary class=filter-group-summary><div class=summary><span></span><div class=selected-w-sign><!$><!/><!$><!/>`),
|
|
5086
5154
|
$f6b0500577e1b210$var$_tmpl$7 = /*#__PURE__*/$8tj43$template(`<div class=ungrouped>`),
|
|
@@ -5183,6 +5251,7 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
|
|
|
5183
5251
|
var _get_details_width;
|
|
5184
5252
|
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();
|
|
5185
5253
|
});
|
|
5254
|
+
const title_id = $8tj43$make_random_classname();
|
|
5186
5255
|
return $8tj43$createComponent((0, $ad371564683947ab$export$6c6d7a51fa9aa15d), {
|
|
5187
5256
|
is_open_: is_open,
|
|
5188
5257
|
get details_() {
|
|
@@ -5203,6 +5272,7 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
|
|
|
5203
5272
|
[_el$25, _co$7] = $8tj43$getNextMarker(_el$24.nextSibling),
|
|
5204
5273
|
_el$26 = _el$25.nextSibling,
|
|
5205
5274
|
[_el$27, _co$8] = $8tj43$getNextMarker(_el$26.nextSibling);
|
|
5275
|
+
$8tj43$setAttribute(_el$22, "id", title_id);
|
|
5206
5276
|
$8tj43$insert(_el$22, section_);
|
|
5207
5277
|
$8tj43$insert(_el$23, $8tj43$createComponent((0, $8tj43$Show), {
|
|
5208
5278
|
get when() {
|
|
@@ -5237,6 +5307,7 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
|
|
|
5237
5307
|
[_el$7, _co$2] = $8tj43$getNextMarker(_el$6.nextSibling),
|
|
5238
5308
|
_el$17 = _el$3.nextSibling,
|
|
5239
5309
|
[_el$18, _co$6] = $8tj43$getNextMarker(_el$17.nextSibling);
|
|
5310
|
+
$8tj43$setAttribute(_el$3, "aria-labelledby", title_id);
|
|
5240
5311
|
$8tj43$insert(_el$3, $8tj43$createComponent(SearchThisFilterGroup_, {}), _el$5, _co$);
|
|
5241
5312
|
$8tj43$insert(_el$3, $8tj43$createComponent((0, $8tj43$Index), {
|
|
5242
5313
|
get each() {
|
|
@@ -6161,8 +6232,8 @@ var $bce10e104a1dd893$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<svg xmlns=http
|
|
|
6161
6232
|
function $bce10e104a1dd893$export$cb808a3c41736d8e() {
|
|
6162
6233
|
return $8tj43$getNextElement($bce10e104a1dd893$var$_tmpl$);
|
|
6163
6234
|
}
|
|
6164
|
-
var $7396052a1484264f$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<
|
|
6165
|
-
$7396052a1484264f$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<
|
|
6235
|
+
var $7396052a1484264f$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<section class=filters tabindex=-1><div class=body>`),
|
|
6236
|
+
$7396052a1484264f$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<section class=sorting tabindex=-1><div class=body>`),
|
|
6166
6237
|
$7396052a1484264f$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<div class=sort-and-filter-buttons><div class=outer><div class=inner><!$><!/><!$><!/><!$><!/>`),
|
|
6167
6238
|
$7396052a1484264f$var$_tmpl$4 = /*#__PURE__*/$8tj43$template(`<span class=num-filters>`),
|
|
6168
6239
|
$7396052a1484264f$var$_tmpl$5 = /*#__PURE__*/$8tj43$template(`<div class=open-filters-button-container><!$><!/><button type=button><!$><!/><span>`),
|
|
@@ -6239,6 +6310,27 @@ function $7396052a1484264f$export$d7841e452f2e59a8(_ref) {
|
|
|
6239
6310
|
available_sortings_: available_sortings_,
|
|
6240
6311
|
meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
|
|
6241
6312
|
};
|
|
6313
|
+
// Keyboard accessibility for the desktop panels (rendered after the product grid in the DOM): when the user
|
|
6314
|
+
// opens a panel we move focus into it, and restore focus to the toggle button on close. Intent is tracked with
|
|
6315
|
+
// a plain flag set in the buttons' click handlers - `filters_open`/`sorting_open` also change programmatically
|
|
6316
|
+
// (undo toast, history-state restore, SDK consumers), and those must not steal focus.
|
|
6317
|
+
let user_opened_panel = false;
|
|
6318
|
+
let filter_toggle_button;
|
|
6319
|
+
let sort_toggle_button;
|
|
6320
|
+
let current_panel;
|
|
6321
|
+
let current_panel_toggle_button;
|
|
6322
|
+
const focus_panel_when_in_dom = panel => $8tj43$catchify1(async () => {
|
|
6323
|
+
// Bounded wait: if the panel never lands in the DOM (e.g. it's superseded by a rapid re-render before
|
|
6324
|
+
// insertion), the timeout lets this promise resolve instead of keeping `panel` - and the observer
|
|
6325
|
+
// listener it registers - referenced forever.
|
|
6326
|
+
await (0, $8tj43$observer).wait_for_element(panel, 4000);
|
|
6327
|
+
if (panel.isConnected) panel.focus();
|
|
6328
|
+
})();
|
|
6329
|
+
const register_desktop_panel = (el, toggle_button, should_focus) => {
|
|
6330
|
+
current_panel = el;
|
|
6331
|
+
current_panel_toggle_button = toggle_button;
|
|
6332
|
+
if (should_focus) focus_panel_when_in_dom(el);
|
|
6333
|
+
};
|
|
6242
6334
|
const make_open_filters_button = function () {
|
|
6243
6335
|
let adhere_to_width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6244
6336
|
let is_tabbable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -6249,7 +6341,9 @@ function $7396052a1484264f$export$d7841e452f2e59a8(_ref) {
|
|
|
6249
6341
|
search_sorting_open_: search_sorting_open_,
|
|
6250
6342
|
number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_,
|
|
6251
6343
|
filter_button_width_: adhere_to_width ? filter_button_width_ : undefined,
|
|
6252
|
-
hide_button_: hide_filters
|
|
6344
|
+
hide_button_: hide_filters,
|
|
6345
|
+
on_user_open_: () => user_opened_panel = true,
|
|
6346
|
+
button_ref_: is_tabbable ? el => filter_toggle_button = el : undefined
|
|
6253
6347
|
});
|
|
6254
6348
|
};
|
|
6255
6349
|
const make_open_sorting_button = function () {
|
|
@@ -6263,7 +6357,9 @@ function $7396052a1484264f$export$d7841e452f2e59a8(_ref) {
|
|
|
6263
6357
|
search_sorting_open_: search_sorting_open_,
|
|
6264
6358
|
available_sortings_: available_sortings_,
|
|
6265
6359
|
sort_button_width_: adhere_to_width ? sort_button_width_ : undefined,
|
|
6266
|
-
meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
|
|
6360
|
+
meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_,
|
|
6361
|
+
on_user_open_: () => user_opened_panel = true,
|
|
6362
|
+
button_ref_: is_tabbable ? el => sort_toggle_button = el : undefined
|
|
6267
6363
|
});
|
|
6268
6364
|
};
|
|
6269
6365
|
let open_modal_;
|
|
@@ -6283,10 +6379,47 @@ function $7396052a1484264f$export$d7841e452f2e59a8(_ref) {
|
|
|
6283
6379
|
grid_is_in_original_state = true;
|
|
6284
6380
|
}
|
|
6285
6381
|
});
|
|
6382
|
+
// Restore focus to the relevant toggle button when a desktop panel is torn down while focus is still inside it.
|
|
6383
|
+
const restore_focus_to_toggle_on_close = () => {
|
|
6384
|
+
const button_to_restore = current_panel_toggle_button;
|
|
6385
|
+
const focus_was_in_panel = !!current_panel && current_panel.contains(document.activeElement);
|
|
6386
|
+
current_panel = undefined;
|
|
6387
|
+
current_panel_toggle_button = undefined;
|
|
6388
|
+
if (focus_was_in_panel) button_to_restore === null || button_to_restore === void 0 || button_to_restore.focus();
|
|
6389
|
+
};
|
|
6390
|
+
// `<section>` + `aria-label` so the panel announces itself ("Filters"/"Sort") when we move focus to it; the bare
|
|
6391
|
+
// tabindex=-1 container would otherwise give screen readers nothing to read on focus. A semantic <section> avoids
|
|
6392
|
+
// an ARIA role and the UA styling pitfalls of <fieldset>; the existing CSS targets the `.filters`/`.sorting` class.
|
|
6393
|
+
const FiltersPanel = should_focus => $8tj43$createComponent((0, $8tj43$Show), {
|
|
6394
|
+
get when() {
|
|
6395
|
+
return !hide_filters();
|
|
6396
|
+
},
|
|
6397
|
+
get children() {
|
|
6398
|
+
var _el$ = $8tj43$getNextElement($7396052a1484264f$var$_tmpl$),
|
|
6399
|
+
_el$2 = _el$.firstChild;
|
|
6400
|
+
$8tj43$use(el => register_desktop_panel(el, filter_toggle_button, should_focus), _el$);
|
|
6401
|
+
$8tj43$insert(_el$2, $8tj43$createComponent((0, $f6b0500577e1b210$export$3f1a388cc0d8fed7), filter_options));
|
|
6402
|
+
$8tj43$effect(() => $8tj43$setAttribute(_el$, "aria-label", i18n_.filters_()));
|
|
6403
|
+
return _el$;
|
|
6404
|
+
}
|
|
6405
|
+
});
|
|
6406
|
+
const SortingPanel = should_focus => (() => {
|
|
6407
|
+
var _el$3 = $8tj43$getNextElement($7396052a1484264f$var$_tmpl$2),
|
|
6408
|
+
_el$4 = _el$3.firstChild;
|
|
6409
|
+
$8tj43$use(el => register_desktop_panel(el, sort_toggle_button, should_focus), _el$3);
|
|
6410
|
+
$8tj43$insert(_el$4, $8tj43$createComponent((0, $cfdbd124dd09d713$export$1f1775a58da589b5), sorting_options));
|
|
6411
|
+
$8tj43$effect(() => $8tj43$setAttribute(_el$3, "aria-label", i18n_.sorting_text_()));
|
|
6412
|
+
return _el$3;
|
|
6413
|
+
})();
|
|
6286
6414
|
$8tj43$createEffect(() => {
|
|
6415
|
+
// Consume the user-intent flag once per run, in every branch, so a stale flag can't leak into a later
|
|
6416
|
+
// resize-triggered re-render and steal focus.
|
|
6417
|
+
const should_focus_panel = user_opened_panel;
|
|
6418
|
+
user_opened_panel = false;
|
|
6287
6419
|
if (!filters_open() && !sorting_open()) {
|
|
6288
6420
|
var _close_modal_;
|
|
6289
6421
|
(_close_modal_ = close_modal_) === null || _close_modal_ === void 0 || _close_modal_();
|
|
6422
|
+
restore_focus_to_toggle_on_close();
|
|
6290
6423
|
set_extra_els_in_results_container_("");
|
|
6291
6424
|
} else if (isSmall()()) {
|
|
6292
6425
|
var _open_modal_;
|
|
@@ -6296,27 +6429,15 @@ function $7396052a1484264f$export$d7841e452f2e59a8(_ref) {
|
|
|
6296
6429
|
set_sorting_open(false);
|
|
6297
6430
|
return;
|
|
6298
6431
|
}
|
|
6432
|
+
// The modal manages its own focus; just drop the desktop panel reference.
|
|
6433
|
+
current_panel = undefined;
|
|
6434
|
+
current_panel_toggle_button = undefined;
|
|
6299
6435
|
(_open_modal_ = open_modal_) === null || _open_modal_ === void 0 || _open_modal_();
|
|
6300
6436
|
set_extra_els_in_results_container_("");
|
|
6301
6437
|
} else {
|
|
6302
6438
|
var _close_modal_2;
|
|
6303
6439
|
(_close_modal_2 = close_modal_) === null || _close_modal_2 === void 0 || _close_modal_2();
|
|
6304
|
-
if (filters_open()) set_extra_els_in_results_container_(() =>
|
|
6305
|
-
get when() {
|
|
6306
|
-
return !hide_filters();
|
|
6307
|
-
},
|
|
6308
|
-
get children() {
|
|
6309
|
-
var _el$ = $8tj43$getNextElement($7396052a1484264f$var$_tmpl$),
|
|
6310
|
-
_el$2 = _el$.firstChild;
|
|
6311
|
-
$8tj43$insert(_el$2, $8tj43$createComponent((0, $f6b0500577e1b210$export$3f1a388cc0d8fed7), filter_options));
|
|
6312
|
-
return _el$;
|
|
6313
|
-
}
|
|
6314
|
-
}));else set_extra_els_in_results_container_((() => {
|
|
6315
|
-
var _el$3 = $8tj43$getNextElement($7396052a1484264f$var$_tmpl$2),
|
|
6316
|
-
_el$4 = _el$3.firstChild;
|
|
6317
|
-
$8tj43$insert(_el$4, $8tj43$createComponent((0, $cfdbd124dd09d713$export$1f1775a58da589b5), sorting_options));
|
|
6318
|
-
return _el$3;
|
|
6319
|
-
})());
|
|
6440
|
+
if (filters_open()) set_extra_els_in_results_container_(() => FiltersPanel(should_focus_panel));else set_extra_els_in_results_container_(SortingPanel(should_focus_panel));
|
|
6320
6441
|
}
|
|
6321
6442
|
});
|
|
6322
6443
|
$8tj43$catchify1(async () => {
|
|
@@ -6381,7 +6502,9 @@ function $7396052a1484264f$var$OpenFiltersButton(_ref3) {
|
|
|
6381
6502
|
filter_button_width_: filter_button_width_,
|
|
6382
6503
|
tabindex_: tabindex_,
|
|
6383
6504
|
number_of_rendered_selected_filters_items_: [num_selected_filters],
|
|
6384
|
-
hide_button_: hide_button_
|
|
6505
|
+
hide_button_: hide_button_,
|
|
6506
|
+
on_user_open_: on_user_open_,
|
|
6507
|
+
button_ref_: button_ref_
|
|
6385
6508
|
} = _ref3;
|
|
6386
6509
|
const filters_closed = $8tj43$createMemo(() => !search_filters_open_[0]());
|
|
6387
6510
|
// We assume in embedded_num_products that this is a single HTMLElement so pls change there if you change it here
|
|
@@ -6409,9 +6532,12 @@ function $7396052a1484264f$var$OpenFiltersButton(_ref3) {
|
|
|
6409
6532
|
search_filters_open_[1](false);
|
|
6410
6533
|
return;
|
|
6411
6534
|
}
|
|
6535
|
+
on_user_open_ === null || on_user_open_ === void 0 || on_user_open_();
|
|
6412
6536
|
search_filters_open_[1](true);
|
|
6413
6537
|
search_sorting_open_[1](false);
|
|
6414
6538
|
})), true);
|
|
6539
|
+
var _ref$2 = button_ref_;
|
|
6540
|
+
typeof _ref$2 === "function" ? $8tj43$use(_ref$2, _el$16) : button_ref_ = _el$16;
|
|
6415
6541
|
$8tj43$setAttribute(_el$16, "tabindex", tabindex_);
|
|
6416
6542
|
$8tj43$className(_el$16, "filter toggle-button major-minor-transition" + ((0, $8tj43$isServer) ? " minor" : ""));
|
|
6417
6543
|
$8tj43$insert(_el$16, $8tj43$createComponent((0, $8tj43$Show), {
|
|
@@ -6433,21 +6559,24 @@ function $7396052a1484264f$var$OpenFiltersButton(_ref3) {
|
|
|
6433
6559
|
_v$2 = !filters_closed(),
|
|
6434
6560
|
_v$3 = !!filters_closed(),
|
|
6435
6561
|
_v$4 = (filters_closed() ? i18n_.open_filters_ : i18n_.close_filters_)(),
|
|
6436
|
-
_v$5 =
|
|
6562
|
+
_v$5 = !filters_closed(),
|
|
6563
|
+
_v$6 = filter_button_width_ !== null && filter_button_width_ !== void 0 && filter_button_width_() ? {
|
|
6437
6564
|
width: filter_button_width_() + "px"
|
|
6438
6565
|
} : {};
|
|
6439
6566
|
_p$.e = $8tj43$style(_el$14, _v$, _p$.e);
|
|
6440
6567
|
_v$2 !== _p$.t && _el$16.classList.toggle("major", _p$.t = _v$2);
|
|
6441
6568
|
_v$3 !== _p$.a && _el$16.classList.toggle("minor", _p$.a = _v$3);
|
|
6442
6569
|
_v$4 !== _p$.o && $8tj43$setAttribute(_el$16, "aria-label", _p$.o = _v$4);
|
|
6443
|
-
_p$.i
|
|
6570
|
+
_v$5 !== _p$.i && $8tj43$setAttribute(_el$16, "aria-expanded", _p$.i = _v$5);
|
|
6571
|
+
_p$.n = $8tj43$style(_el$16, _v$6, _p$.n);
|
|
6444
6572
|
return _p$;
|
|
6445
6573
|
}, {
|
|
6446
6574
|
e: undefined,
|
|
6447
6575
|
t: undefined,
|
|
6448
6576
|
a: undefined,
|
|
6449
6577
|
o: undefined,
|
|
6450
|
-
i: undefined
|
|
6578
|
+
i: undefined,
|
|
6579
|
+
n: undefined
|
|
6451
6580
|
});
|
|
6452
6581
|
$8tj43$runHydrationEvents();
|
|
6453
6582
|
return _el$14;
|
|
@@ -6462,7 +6591,9 @@ function $7396052a1484264f$var$OpenSortingButton(_ref4) {
|
|
|
6462
6591
|
search_sorting_open_: search_sorting_open_,
|
|
6463
6592
|
sort_button_width_: sort_button_width_,
|
|
6464
6593
|
tabindex_: tabindex_,
|
|
6465
|
-
meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
|
|
6594
|
+
meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_,
|
|
6595
|
+
on_user_open_: on_user_open_,
|
|
6596
|
+
button_ref_: button_ref_
|
|
6466
6597
|
} = _ref4;
|
|
6467
6598
|
const sorting_closed = $8tj43$createMemo(() => !search_sorting_open_[0]());
|
|
6468
6599
|
// We assume in embedded_num_products that this is a single HTMLElement so pls change there if you change it here
|
|
@@ -6476,9 +6607,12 @@ function $7396052a1484264f$var$OpenSortingButton(_ref4) {
|
|
|
6476
6607
|
search_sorting_open_[1](false);
|
|
6477
6608
|
return;
|
|
6478
6609
|
}
|
|
6610
|
+
on_user_open_ === null || on_user_open_ === void 0 || on_user_open_();
|
|
6479
6611
|
search_filters_open_[1](false);
|
|
6480
6612
|
search_sorting_open_[1](true);
|
|
6481
6613
|
})), true);
|
|
6614
|
+
var _ref$3 = button_ref_;
|
|
6615
|
+
typeof _ref$3 === "function" ? $8tj43$use(_ref$3, _el$22) : button_ref_ = _el$22;
|
|
6482
6616
|
$8tj43$setAttribute(_el$22, "tabindex", tabindex_);
|
|
6483
6617
|
$8tj43$insert(_el$23, (() => {
|
|
6484
6618
|
var _c$ = $8tj43$memo(() => !!sorting_closed());
|
|
@@ -6507,22 +6641,25 @@ function $7396052a1484264f$var$OpenSortingButton(_ref4) {
|
|
|
6507
6641
|
}
|
|
6508
6642
|
}), _el$25, _co$6);
|
|
6509
6643
|
$8tj43$effect(_p$ => {
|
|
6510
|
-
var _v$
|
|
6511
|
-
_v$
|
|
6512
|
-
_v$
|
|
6513
|
-
_v$
|
|
6644
|
+
var _v$7 = !sorting_closed(),
|
|
6645
|
+
_v$8 = !!sorting_closed(),
|
|
6646
|
+
_v$9 = (sorting_closed() ? i18n_.open_sorting_ : i18n_.close_sorting_)(),
|
|
6647
|
+
_v$10 = !sorting_closed(),
|
|
6648
|
+
_v$11 = sort_button_width_ !== null && sort_button_width_ !== void 0 && sort_button_width_() ? {
|
|
6514
6649
|
width: sort_button_width_() + "px"
|
|
6515
6650
|
} : {};
|
|
6516
|
-
_v$
|
|
6517
|
-
_v$
|
|
6518
|
-
_v$
|
|
6519
|
-
_p$.o
|
|
6651
|
+
_v$7 !== _p$.e && _el$22.classList.toggle("major", _p$.e = _v$7);
|
|
6652
|
+
_v$8 !== _p$.t && _el$22.classList.toggle("minor", _p$.t = _v$8);
|
|
6653
|
+
_v$9 !== _p$.a && $8tj43$setAttribute(_el$22, "aria-label", _p$.a = _v$9);
|
|
6654
|
+
_v$10 !== _p$.o && $8tj43$setAttribute(_el$22, "aria-expanded", _p$.o = _v$10);
|
|
6655
|
+
_p$.i = $8tj43$style(_el$22, _v$11, _p$.i);
|
|
6520
6656
|
return _p$;
|
|
6521
6657
|
}, {
|
|
6522
6658
|
e: undefined,
|
|
6523
6659
|
t: undefined,
|
|
6524
6660
|
a: undefined,
|
|
6525
|
-
o: undefined
|
|
6661
|
+
o: undefined,
|
|
6662
|
+
i: undefined
|
|
6526
6663
|
});
|
|
6527
6664
|
$8tj43$runHydrationEvents();
|
|
6528
6665
|
return _el$22;
|