@stapel/search-react 0.19.0 → 0.20.0

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.
Files changed (59) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/default/FacetPanelPane.d.ts +0 -19
  3. package/dist/default/FacetPanelPane.d.ts.map +1 -1
  4. package/dist/default/FacetPanelPane.js +18 -61
  5. package/dist/default/FacetPanelPane.js.map +1 -1
  6. package/dist/default/FilterChips.d.ts +1 -24
  7. package/dist/default/FilterChips.d.ts.map +1 -1
  8. package/dist/default/FilterChips.js +4 -18
  9. package/dist/default/FilterChips.js.map +1 -1
  10. package/dist/default/LocationSummaryLine.d.ts +9 -0
  11. package/dist/default/LocationSummaryLine.d.ts.map +1 -1
  12. package/dist/default/LocationSummaryLine.js +29 -2
  13. package/dist/default/LocationSummaryLine.js.map +1 -1
  14. package/dist/default/SearchPage.d.ts +6 -5
  15. package/dist/default/SearchPage.d.ts.map +1 -1
  16. package/dist/default/SearchPage.js +26 -21
  17. package/dist/default/SearchPage.js.map +1 -1
  18. package/dist/default/geoSheet.d.ts +12 -6
  19. package/dist/default/geoSheet.d.ts.map +1 -1
  20. package/dist/default/geoSheet.js +14 -3
  21. package/dist/default/geoSheet.js.map +1 -1
  22. package/dist/default/index.d.ts +4 -3
  23. package/dist/default/index.d.ts.map +1 -1
  24. package/dist/default/index.js +4 -3
  25. package/dist/default/index.js.map +1 -1
  26. package/dist/headless/SearchStateProvider.d.ts +42 -30
  27. package/dist/headless/SearchStateProvider.d.ts.map +1 -1
  28. package/dist/headless/SearchStateProvider.js +16 -36
  29. package/dist/headless/SearchStateProvider.js.map +1 -1
  30. package/dist/i18n/es.d.ts.map +1 -1
  31. package/dist/i18n/es.js +1 -0
  32. package/dist/i18n/es.js.map +1 -1
  33. package/dist/i18n/keys.d.ts +1 -0
  34. package/dist/i18n/keys.d.ts.map +1 -1
  35. package/dist/i18n/keys.js +2 -0
  36. package/dist/i18n/keys.js.map +1 -1
  37. package/dist/i18n/ru.d.ts.map +1 -1
  38. package/dist/i18n/ru.js +1 -0
  39. package/dist/i18n/ru.js.map +1 -1
  40. package/dist/state/urlState.d.ts +20 -2
  41. package/dist/state/urlState.d.ts.map +1 -1
  42. package/dist/state/urlState.js +26 -5
  43. package/dist/state/urlState.js.map +1 -1
  44. package/llms.txt +1 -1
  45. package/manifest.json +2 -1
  46. package/nav-manifest.json +1 -1
  47. package/package.json +2 -2
  48. package/src/analytics/generated/events.json +1 -1
  49. package/src/default/FacetPanelPane.tsx +16 -125
  50. package/src/default/FilterChips.tsx +5 -70
  51. package/src/default/LocationSummaryLine.tsx +65 -1
  52. package/src/default/SearchPage.tsx +52 -31
  53. package/src/default/geoSheet.tsx +46 -7
  54. package/src/default/index.ts +4 -3
  55. package/src/headless/SearchStateProvider.tsx +57 -66
  56. package/src/i18n/es.ts +1 -0
  57. package/src/i18n/keys.ts +2 -0
  58. package/src/i18n/ru.ts +1 -0
  59. package/src/state/urlState.ts +26 -4
@@ -444,15 +444,37 @@ export function setRangeValue(
444
444
  * would be removing something they never set.
445
445
  */
446
446
  export function clearFilters(state: SearchQueryState): SearchQueryState {
447
- return patchSearchState(state, { filters: {}, ranges: {}, geo: null });
447
+ // The PLACE survives. It is not a filter (see `activeFilterCount`), it is
448
+ // not counted by the control that calls this, and a person who chose their
449
+ // city and then narrowed by price did not ask to be moved back to the whole
450
+ // country when they widen the price again. The location control has its own
451
+ // way off, and it says the name of the place it would remove.
452
+ return patchSearchState(state, { filters: {}, ranges: {} });
448
453
  }
449
454
 
450
- /** How many constraints the person has actually applied (facet values +
451
- * ranges + geo) what a "clear all (N)" control counts. */
455
+ /**
456
+ * How many constraints the person has actually applied facet values and
457
+ * ranges, and NOTHING ELSE. What a "clear all (N)" control counts.
458
+ *
459
+ * ## A latitude is not a filter
460
+ *
461
+ * `lat`/`lon` used to add 1 to this, and a place chosen on a map is a real
462
+ * narrowing, so that looked right. What a person saw was not. On a live board
463
+ * a landing announced "clear all filters (2)" over an empty page, with two
464
+ * filters that had no chip, no name and no row in the panel — the owner's
465
+ * words were "two active filters I can't even look at". A count that names
466
+ * nothing is worse than no count: it tells a person that something is hiding
467
+ * their results and gives them nothing to press.
468
+ *
469
+ * A coordinate pair is not a filter a person picked, it is the machine form
470
+ * of a place. The place is stated by the location control, in words, beside
471
+ * the radius it comes with — its own thing in the chrome, like the search box,
472
+ * not a row in the filter list and not a number in this sum. So this counts
473
+ * facets and ranges, and the location says its own name.
474
+ */
452
475
  export function activeFilterCount(state: SearchQueryState): number {
453
476
  let count = 0;
454
477
  for (const values of Object.values(state.filters)) count += values.length;
455
478
  count += Object.keys(state.ranges).length;
456
- if (state.geo !== undefined) count += 1;
457
479
  return count;
458
480
  }