@reblu/site-blocks 0.5.0 → 0.5.1
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/CHANGELOG.md +18 -0
- package/dist/index.cjs +6 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -13425,7 +13425,10 @@ function toValueArray(value) {
|
|
|
13425
13425
|
return Array.isArray(value) ? value : [value];
|
|
13426
13426
|
}
|
|
13427
13427
|
function hasAnyActiveFilter(active) {
|
|
13428
|
-
return Object.keys(active.taxonomy ?? {}).length > 0 || Object.keys(active.attr ?? {}).length > 0 || active
|
|
13428
|
+
return Object.keys(active.taxonomy ?? {}).length > 0 || Object.keys(active.attr ?? {}).length > 0 || hasActivePriceFilter(active) || Boolean(active.onSale);
|
|
13429
|
+
}
|
|
13430
|
+
function hasActivePriceFilter(active) {
|
|
13431
|
+
return active.priceMin != null || active.priceMax != null;
|
|
13429
13432
|
}
|
|
13430
13433
|
function shouldRenderShopFilters(facets, active = {}) {
|
|
13431
13434
|
const hasFacetContent = facets.taxonomies.some((axis) => axis.terms.length > 0) || facets.attributes.some((attr) => attr.options.length > 0) || facets.price.max > facets.price.min || facets.onSale.count > 0;
|
|
@@ -13483,6 +13486,7 @@ function ShopFilters({
|
|
|
13483
13486
|
const visibleTaxonomies = facets.taxonomies.filter((axis) => axis.terms.length > 0);
|
|
13484
13487
|
const visibleAttributes = facets.attributes.filter((attr) => attr.options.length > 0);
|
|
13485
13488
|
const hasPriceSpread = facets.price.max > facets.price.min;
|
|
13489
|
+
const showPriceGroup = hasPriceSpread || hasActivePriceFilter(active);
|
|
13486
13490
|
const hasOnSale = facets.onSale.count > 0;
|
|
13487
13491
|
if (!shouldRenderShopFilters(facets, active)) {
|
|
13488
13492
|
return null;
|
|
@@ -13546,7 +13550,7 @@ function ShopFilters({
|
|
|
13546
13550
|
);
|
|
13547
13551
|
}) }, attr.key);
|
|
13548
13552
|
}),
|
|
13549
|
-
|
|
13553
|
+
showPriceGroup && /* @__PURE__ */ jsx7(FilterFieldset, { legend: t.price, children: priceBands.map((band, i) => {
|
|
13550
13554
|
const isActive = active.priceMin === band.min && active.priceMax === band.max;
|
|
13551
13555
|
const nextMin = isActive ? void 0 : band.min;
|
|
13552
13556
|
const nextMax = isActive ? void 0 : band.max;
|