@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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @reblu/site-blocks
2
2
 
3
+ ## 0.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 75d3963: Fix `ShopFilters` stranding an active price filter when the price range
8
+ collapses (REB-827). The Price fieldset previously rendered only when
9
+ `facets.price.max > facets.price.min`; an active price band can itself
10
+ collapse that range to a single value (or every currently filtered product
11
+ can simply cost the same), which made the whole Price group — including the
12
+ active band's own click-to-clear affordance — disappear, leaving "Clear
13
+ filters" as the only way out. The group now also renders whenever
14
+ `active.priceMin`/`active.priceMax` is set, matching the same rule every
15
+ taxonomy axis already follows, and `shouldRenderShopFilters` stays consistent
16
+ with it (it already accounted for an active price selection via
17
+ `hasAnyActiveFilter`).
18
+ - Updated dependencies [87b7fa0]
19
+ - @reblu/site-contracts@1.4.0
20
+
3
21
  ## 0.5.0
4
22
 
5
23
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -13456,7 +13456,10 @@ function toValueArray(value) {
13456
13456
  return Array.isArray(value) ? value : [value];
13457
13457
  }
13458
13458
  function hasAnyActiveFilter(active) {
13459
- return Object.keys(active.taxonomy ?? {}).length > 0 || Object.keys(active.attr ?? {}).length > 0 || active.priceMin !== void 0 || active.priceMax !== void 0 || Boolean(active.onSale);
13459
+ return Object.keys(active.taxonomy ?? {}).length > 0 || Object.keys(active.attr ?? {}).length > 0 || hasActivePriceFilter(active) || Boolean(active.onSale);
13460
+ }
13461
+ function hasActivePriceFilter(active) {
13462
+ return active.priceMin != null || active.priceMax != null;
13460
13463
  }
13461
13464
  function shouldRenderShopFilters(facets, active = {}) {
13462
13465
  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;
@@ -13514,6 +13517,7 @@ function ShopFilters({
13514
13517
  const visibleTaxonomies = facets.taxonomies.filter((axis) => axis.terms.length > 0);
13515
13518
  const visibleAttributes = facets.attributes.filter((attr) => attr.options.length > 0);
13516
13519
  const hasPriceSpread = facets.price.max > facets.price.min;
13520
+ const showPriceGroup = hasPriceSpread || hasActivePriceFilter(active);
13517
13521
  const hasOnSale = facets.onSale.count > 0;
13518
13522
  if (!shouldRenderShopFilters(facets, active)) {
13519
13523
  return null;
@@ -13577,7 +13581,7 @@ function ShopFilters({
13577
13581
  );
13578
13582
  }) }, attr.key);
13579
13583
  }),
13580
- hasPriceSpread && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FilterFieldset, { legend: t.price, children: priceBands.map((band, i) => {
13584
+ showPriceGroup && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FilterFieldset, { legend: t.price, children: priceBands.map((band, i) => {
13581
13585
  const isActive = active.priceMin === band.min && active.priceMax === band.max;
13582
13586
  const nextMin = isActive ? void 0 : band.min;
13583
13587
  const nextMax = isActive ? void 0 : band.max;