@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.
- package/CHANGELOG.md +37 -0
- package/dist/default/FacetPanelPane.d.ts +0 -19
- package/dist/default/FacetPanelPane.d.ts.map +1 -1
- package/dist/default/FacetPanelPane.js +18 -61
- package/dist/default/FacetPanelPane.js.map +1 -1
- package/dist/default/FilterChips.d.ts +1 -24
- package/dist/default/FilterChips.d.ts.map +1 -1
- package/dist/default/FilterChips.js +4 -18
- package/dist/default/FilterChips.js.map +1 -1
- package/dist/default/LocationSummaryLine.d.ts +9 -0
- package/dist/default/LocationSummaryLine.d.ts.map +1 -1
- package/dist/default/LocationSummaryLine.js +29 -2
- package/dist/default/LocationSummaryLine.js.map +1 -1
- package/dist/default/SearchPage.d.ts +6 -5
- package/dist/default/SearchPage.d.ts.map +1 -1
- package/dist/default/SearchPage.js +26 -21
- package/dist/default/SearchPage.js.map +1 -1
- package/dist/default/geoSheet.d.ts +12 -6
- package/dist/default/geoSheet.d.ts.map +1 -1
- package/dist/default/geoSheet.js +14 -3
- package/dist/default/geoSheet.js.map +1 -1
- package/dist/default/index.d.ts +4 -3
- package/dist/default/index.d.ts.map +1 -1
- package/dist/default/index.js +4 -3
- package/dist/default/index.js.map +1 -1
- package/dist/headless/SearchStateProvider.d.ts +42 -30
- package/dist/headless/SearchStateProvider.d.ts.map +1 -1
- package/dist/headless/SearchStateProvider.js +16 -36
- package/dist/headless/SearchStateProvider.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +1 -0
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/keys.d.ts +1 -0
- package/dist/i18n/keys.d.ts.map +1 -1
- package/dist/i18n/keys.js +2 -0
- package/dist/i18n/keys.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +1 -0
- package/dist/i18n/ru.js.map +1 -1
- package/dist/state/urlState.d.ts +20 -2
- package/dist/state/urlState.d.ts.map +1 -1
- package/dist/state/urlState.js +26 -5
- package/dist/state/urlState.js.map +1 -1
- package/llms.txt +1 -1
- package/manifest.json +2 -1
- package/nav-manifest.json +1 -1
- package/package.json +2 -2
- package/src/analytics/generated/events.json +1 -1
- package/src/default/FacetPanelPane.tsx +16 -125
- package/src/default/FilterChips.tsx +5 -70
- package/src/default/LocationSummaryLine.tsx +65 -1
- package/src/default/SearchPage.tsx +52 -31
- package/src/default/geoSheet.tsx +46 -7
- package/src/default/index.ts +4 -3
- package/src/headless/SearchStateProvider.tsx +57 -66
- package/src/i18n/es.ts +1 -0
- package/src/i18n/keys.ts +2 -0
- package/src/i18n/ru.ts +1 -0
- package/src/state/urlState.ts +26 -4
package/src/state/urlState.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
/**
|
|
451
|
-
*
|
|
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
|
}
|