@stapel/search-react 0.10.0 → 0.12.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 +160 -0
- package/MODULE.md +111 -0
- package/README.md +42 -0
- package/dist/api/generated/schema.d.ts +76 -6
- package/dist/api/generated/schema.d.ts.map +1 -1
- package/dist/api/searchApi.d.ts +13 -6
- package/dist/api/searchApi.d.ts.map +1 -1
- package/dist/api/searchApi.js.map +1 -1
- package/dist/api/types.d.ts +107 -1
- package/dist/api/types.d.ts.map +1 -1
- package/dist/api/types.js +29 -0
- package/dist/api/types.js.map +1 -1
- package/dist/default/DegradationNotice.d.ts +22 -13
- package/dist/default/DegradationNotice.d.ts.map +1 -1
- package/dist/default/DegradationNotice.js +7 -8
- package/dist/default/DegradationNotice.js.map +1 -1
- package/dist/default/FacetPanelPane.d.ts +13 -2
- package/dist/default/FacetPanelPane.d.ts.map +1 -1
- package/dist/default/FacetPanelPane.js +29 -16
- package/dist/default/FacetPanelPane.js.map +1 -1
- package/dist/default/FilterChips.d.ts +88 -3
- package/dist/default/FilterChips.d.ts.map +1 -1
- package/dist/default/FilterChips.js +166 -13
- package/dist/default/FilterChips.js.map +1 -1
- package/dist/default/LocationSummaryLine.d.ts.map +1 -1
- package/dist/default/LocationSummaryLine.js +1 -1
- package/dist/default/LocationSummaryLine.js.map +1 -1
- package/dist/default/RangeFilterRow.d.ts.map +1 -1
- package/dist/default/RangeFilterRow.js +49 -5
- package/dist/default/RangeFilterRow.js.map +1 -1
- package/dist/default/SearchBox.d.ts.map +1 -1
- package/dist/default/SearchBox.js +74 -4
- package/dist/default/SearchBox.js.map +1 -1
- package/dist/default/SearchPage.d.ts +29 -1
- package/dist/default/SearchPage.d.ts.map +1 -1
- package/dist/default/SearchPage.js +25 -10
- package/dist/default/SearchPage.js.map +1 -1
- package/dist/default/SearchResultsPane.d.ts +22 -0
- package/dist/default/SearchResultsPane.d.ts.map +1 -1
- package/dist/default/SearchResultsPane.js +2 -2
- package/dist/default/SearchResultsPane.js.map +1 -1
- package/dist/default/SortSelect.d.ts +23 -0
- package/dist/default/SortSelect.d.ts.map +1 -1
- package/dist/default/SortSelect.js +29 -9
- package/dist/default/SortSelect.js.map +1 -1
- package/dist/default/index.d.ts +2 -2
- package/dist/default/index.d.ts.map +1 -1
- package/dist/default/index.js +1 -1
- package/dist/default/index.js.map +1 -1
- package/dist/headless/FacetPanel.d.ts +26 -0
- package/dist/headless/FacetPanel.d.ts.map +1 -1
- package/dist/headless/FacetPanel.js +16 -1
- package/dist/headless/FacetPanel.js.map +1 -1
- package/dist/headless/useFacetLabels.d.ts +39 -0
- package/dist/headless/useFacetLabels.d.ts.map +1 -0
- package/dist/headless/useFacetLabels.js +129 -0
- package/dist/headless/useFacetLabels.js.map +1 -0
- package/dist/headless/useSearchBox.d.ts +71 -0
- package/dist/headless/useSearchBox.d.ts.map +1 -1
- package/dist/headless/useSearchBox.js +67 -2
- package/dist/headless/useSearchBox.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +8 -0
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/keys.d.ts +48 -0
- package/dist/i18n/keys.d.ts.map +1 -1
- package/dist/i18n/keys.js +58 -0
- package/dist/i18n/keys.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +10 -0
- package/dist/i18n/ru.js.map +1 -1
- package/dist/index.d.ts +9 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/model/queries.d.ts +6 -5
- package/dist/model/queries.d.ts.map +1 -1
- package/dist/model/queries.js +4 -3
- package/dist/model/queries.js.map +1 -1
- package/dist/model/queryKeys.d.ts +12 -0
- package/dist/model/queryKeys.d.ts.map +1 -1
- package/dist/model/queryKeys.js +7 -0
- package/dist/model/queryKeys.js.map +1 -1
- package/dist/nav/manifest.d.ts +21 -0
- package/dist/nav/manifest.d.ts.map +1 -1
- package/dist/nav/manifest.js +3 -2
- package/dist/nav/manifest.js.map +1 -1
- package/dist/state/degradations.d.ts +32 -0
- package/dist/state/degradations.d.ts.map +1 -1
- package/dist/state/degradations.js +33 -0
- package/dist/state/degradations.js.map +1 -1
- package/dist/state/facets.d.ts +64 -0
- package/dist/state/facets.d.ts.map +1 -1
- package/dist/state/facets.js +134 -9
- package/dist/state/facets.js.map +1 -1
- package/dist/state/ranges.d.ts +45 -3
- package/dist/state/ranges.d.ts.map +1 -1
- package/dist/state/ranges.js +55 -14
- package/dist/state/ranges.js.map +1 -1
- package/llms.txt +2 -2
- package/manifest.json +27 -2
- package/nav-manifest.json +4 -3
- package/package.json +10 -10
- package/src/analytics/generated/events.json +1 -1
- package/src/api/generated/schema.ts +76 -6
- package/src/api/searchApi.ts +13 -6
- package/src/api/types.ts +115 -1
- package/src/default/DegradationNotice.tsx +30 -20
- package/src/default/FacetPanelPane.tsx +55 -25
- package/src/default/FilterChips.tsx +290 -38
- package/src/default/LocationSummaryLine.tsx +6 -1
- package/src/default/RangeFilterRow.tsx +61 -3
- package/src/default/SearchBox.tsx +134 -6
- package/src/default/SearchPage.tsx +79 -5
- package/src/default/SearchResultsPane.tsx +48 -11
- package/src/default/SortSelect.tsx +70 -9
- package/src/default/index.ts +10 -2
- package/src/headless/FacetPanel.tsx +44 -1
- package/src/headless/useFacetLabels.ts +172 -0
- package/src/headless/useSearchBox.ts +132 -5
- package/src/i18n/es.ts +9 -0
- package/src/i18n/keys.ts +60 -0
- package/src/i18n/ru.ts +11 -0
- package/src/index.ts +28 -4
- package/src/model/queries.ts +6 -5
- package/src/model/queryKeys.ts +23 -0
- package/src/nav/manifest.ts +24 -2
- package/src/state/degradations.ts +56 -0
- package/src/state/facets.ts +181 -9
- package/src/state/ranges.ts +85 -15
package/dist/api/types.d.ts
CHANGED
|
@@ -20,8 +20,114 @@ export type SearchItem = Schemas["SearchItem"];
|
|
|
20
20
|
/** The honesty block beside the counts: `approximate`, `candidates`,
|
|
21
21
|
* `counted`, `skipped`. Rendered, never swallowed (spec §4.2). */
|
|
22
22
|
export type FacetMeta = Schemas["FacetMeta"];
|
|
23
|
-
/** `GET /suggest` 200. */
|
|
23
|
+
/** `GET /suggest` 200, as the CURRENT generated schema describes it. */
|
|
24
24
|
export type SuggestResponse = Schemas["SuggestResponse"];
|
|
25
|
+
/**
|
|
26
|
+
* How a category's name matched the typed prefix. Informational — the server
|
|
27
|
+
* ranks by `count`, never by this.
|
|
28
|
+
*/
|
|
29
|
+
export type SuggestCategoryMatch = "prefix" | "substring";
|
|
30
|
+
/**
|
|
31
|
+
* One CATEGORY the type-ahead offers: a destination, not a search term.
|
|
32
|
+
*
|
|
33
|
+
* A classified's search box is a navigation control before it is a text
|
|
34
|
+
* filter. "Shorts" is not one destination but three — men's, women's,
|
|
35
|
+
* children's — and the only things that let a buyer pick between them are the
|
|
36
|
+
* ancestor path and how many live listings sit behind each. Both are here,
|
|
37
|
+
* and neither can be computed on the client: the count is one aggregate over
|
|
38
|
+
* the index, and a client-side matcher over a fetched tree would have the
|
|
39
|
+
* names and no numbers.
|
|
40
|
+
*/
|
|
41
|
+
export interface SuggestCategory {
|
|
42
|
+
readonly id: number;
|
|
43
|
+
readonly slug: string;
|
|
44
|
+
/** The category's own display name. */
|
|
45
|
+
readonly name: string;
|
|
46
|
+
/**
|
|
47
|
+
* Display names root→leaf, e.g. `["Menswear", "Shorts"]` — this is what
|
|
48
|
+
* distinguishes three categories sharing a name, and it is what a row has
|
|
49
|
+
* to print.
|
|
50
|
+
*/
|
|
51
|
+
readonly path: readonly string[];
|
|
52
|
+
/**
|
|
53
|
+
* The ancestry as ids joined with `/`, ready to pass VERBATIM as the
|
|
54
|
+
* `category` parameter of `/query`.
|
|
55
|
+
*
|
|
56
|
+
* The server serves the joined string rather than only the segments
|
|
57
|
+
* precisely so that a client cannot invent a different join and silently
|
|
58
|
+
* miss — so nothing in this pair rebuilds it from {@link path} or
|
|
59
|
+
* {@link slug}.
|
|
60
|
+
*/
|
|
61
|
+
readonly category: string;
|
|
62
|
+
/**
|
|
63
|
+
* Live listings a buyer would see under this category, descendants
|
|
64
|
+
* included — the same number the SERP reports for it.
|
|
65
|
+
*/
|
|
66
|
+
readonly count: number;
|
|
67
|
+
/** Number of segments in {@link path}. */
|
|
68
|
+
readonly depth: number;
|
|
69
|
+
readonly match: SuggestCategoryMatch;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The `/suggest` answer this pair actually reads.
|
|
73
|
+
*
|
|
74
|
+
* GENERATOR NOTE, and the reason this is not `Schemas["SuggestResponse"]`:
|
|
75
|
+
* the generated type describes ONE server. stapel-search 0.7.0 made the answer
|
|
76
|
+
* three-part — `categories`, `terms`, and `items` as a deprecated alias of
|
|
77
|
+
* `terms` — plus `language` and `degraded`, and declares all five REQUIRED,
|
|
78
|
+
* which is true of a 0.7.0 answer and false of every answer sent by the
|
|
79
|
+
* servers a storefront is also deployed against.
|
|
80
|
+
*
|
|
81
|
+
* Every member but `backend` is therefore OPTIONAL here, which is not
|
|
82
|
+
* sloppiness but the deployment story: a storefront ships against whichever
|
|
83
|
+
* server is actually running, an older one sends no `categories` key at all,
|
|
84
|
+
* and "the key is absent" has to read as "this server offers no destinations"
|
|
85
|
+
* rather than as a crash or as an empty group under a heading. A pair typed
|
|
86
|
+
* against the required-field version would compile while reading `undefined`
|
|
87
|
+
* from a field the compiler swore was there.
|
|
88
|
+
*/
|
|
89
|
+
export interface SuggestAnswer {
|
|
90
|
+
readonly backend: string;
|
|
91
|
+
/** Destinations, ranked by live listing count desc, then depth, then name. */
|
|
92
|
+
readonly categories?: readonly SuggestCategory[];
|
|
93
|
+
/** Title prefixes from the index. */
|
|
94
|
+
readonly terms?: readonly string[];
|
|
95
|
+
/** Deprecated alias of {@link terms}, and the only half a pre-0.7.0 server
|
|
96
|
+
* sends. Read through {@link suggestTerms}, never directly. */
|
|
97
|
+
readonly items?: readonly string[];
|
|
98
|
+
/** Which dictionary answered — the same resolution `/query` reports. */
|
|
99
|
+
readonly language?: string;
|
|
100
|
+
/** What this answer could not do — see {@link SUGGEST_DEGRADED_CATEGORIES}
|
|
101
|
+
* and {@link SUGGEST_DEGRADED_ROLLUP}. */
|
|
102
|
+
readonly degraded?: readonly string[];
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* The suggest answer had NO category provider, so the categories half is
|
|
106
|
+
* empty for a reason that is not "nothing matched".
|
|
107
|
+
*
|
|
108
|
+
* A dropdown has no room for a sentence about a provider being down, and the
|
|
109
|
+
* person reading it is mid-word. So the group is ABSENT rather than empty —
|
|
110
|
+
* an empty group under a heading is the box claiming the catalogue has no
|
|
111
|
+
* section by that name, which is a different and untrue statement.
|
|
112
|
+
*/
|
|
113
|
+
export declare const SUGGEST_DEGRADED_CATEGORIES = "category_suggestions";
|
|
114
|
+
/**
|
|
115
|
+
* Ancestry never arrived, so every stored path is one segment long and every
|
|
116
|
+
* count would read `0`.
|
|
117
|
+
*
|
|
118
|
+
* The rows are still destinations and still worth offering; their COUNTS are
|
|
119
|
+
* the part that is not an answer, so a surface drops the number rather than
|
|
120
|
+
* printing a catalogue of zeros.
|
|
121
|
+
*/
|
|
122
|
+
export declare const SUGGEST_DEGRADED_ROLLUP = "category_rollup";
|
|
123
|
+
/**
|
|
124
|
+
* The term half of a suggest answer, from whichever key this server sends.
|
|
125
|
+
*
|
|
126
|
+
* `terms` is 0.7.0's name and `items` is the deprecated alias kept for one
|
|
127
|
+
* minor; a client that read only one of them would go blank against half the
|
|
128
|
+
* servers in the fleet.
|
|
129
|
+
*/
|
|
130
|
+
export declare function suggestTerms(answer: SuggestAnswer | undefined): readonly string[];
|
|
25
131
|
/** `GET /ranking` 200 — the P2B Art. 5 disclosure. */
|
|
26
132
|
export type RankingResponse = Schemas["RankingResponse"];
|
|
27
133
|
/** One ranking parameter of the disclosure. */
|
package/dist/api/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,4EAA4E;AAC5E,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;AAE5C,6CAA6C;AAC7C,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAEvD;;0EAE0E;AAC1E,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAE/C;kEACkE;AAClE,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAE7C,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,4EAA4E;AAC5E,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;AAE5C,6CAA6C;AAC7C,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAEvD;;0EAE0E;AAC1E,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAE/C;kEACkE;AAClE,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAE7C,wEAAwE;AACxE,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE1D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,QAAQ,CAAC,IAAI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C,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;IAC9D,+BAA+B;IAC/B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IACvD,QAAQ,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC;IACzB,6EAA6E;IAC7E,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC;IACjC,mDAAmD;IACnD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;0BAC0B;AAC1B,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAC7B,gBAAgB,GAChB,iBAAiB,GACjB,aAAa,GACb,oBAAoB,GACpB,iBAAiB,GACjB,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;IACrC;4EACwE;IACxE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,iCAAiC;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B"}
|
package/dist/api/types.js
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The suggest answer had NO category provider, so the categories half is
|
|
3
|
+
* empty for a reason that is not "nothing matched".
|
|
4
|
+
*
|
|
5
|
+
* A dropdown has no room for a sentence about a provider being down, and the
|
|
6
|
+
* person reading it is mid-word. So the group is ABSENT rather than empty —
|
|
7
|
+
* an empty group under a heading is the box claiming the catalogue has no
|
|
8
|
+
* section by that name, which is a different and untrue statement.
|
|
9
|
+
*/
|
|
10
|
+
export const SUGGEST_DEGRADED_CATEGORIES = "category_suggestions";
|
|
11
|
+
/**
|
|
12
|
+
* Ancestry never arrived, so every stored path is one segment long and every
|
|
13
|
+
* count would read `0`.
|
|
14
|
+
*
|
|
15
|
+
* The rows are still destinations and still worth offering; their COUNTS are
|
|
16
|
+
* the part that is not an answer, so a surface drops the number rather than
|
|
17
|
+
* printing a catalogue of zeros.
|
|
18
|
+
*/
|
|
19
|
+
export const SUGGEST_DEGRADED_ROLLUP = "category_rollup";
|
|
20
|
+
/**
|
|
21
|
+
* The term half of a suggest answer, from whichever key this server sends.
|
|
22
|
+
*
|
|
23
|
+
* `terms` is 0.7.0's name and `items` is the deprecated alias kept for one
|
|
24
|
+
* minor; a client that read only one of them would go blank against half the
|
|
25
|
+
* servers in the fleet.
|
|
26
|
+
*/
|
|
27
|
+
export function suggestTerms(answer) {
|
|
28
|
+
return answer?.terms ?? answer?.items ?? [];
|
|
29
|
+
}
|
|
1
30
|
/**
|
|
2
31
|
* The sorts stapel-search ships (`conf.py::DEFAULT_SORTS`).
|
|
3
32
|
*
|
package/dist/api/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAgHA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,sBAAsB,CAAC;AAElE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,iBAAiB,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,MAAiC;IAC5D,OAAO,MAAM,EAAE,KAAK,IAAI,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC;AAC9C,CAAC;AAQD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,YAAY,GAAsB;IAC7C,WAAW;IACX,QAAQ;IACR,WAAW;IACX,YAAY;IACZ,UAAU;CACX,CAAC"}
|
|
@@ -12,20 +12,27 @@
|
|
|
12
12
|
*
|
|
13
13
|
* ── Two deliberate ways NOT to shout ───────────────────────────────────────
|
|
14
14
|
*
|
|
15
|
-
* 1.
|
|
16
|
-
*
|
|
17
|
-
* the
|
|
18
|
-
*
|
|
19
|
-
* is
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
15
|
+
* 1. **A degradation addressed to the OPERATOR never reaches the reader.**
|
|
16
|
+
* `typo_tolerance` and `phrase_synonyms` both say, in the shipped ru copy,
|
|
17
|
+
* "the search engine in use cannot do this" — a sentence about which
|
|
18
|
+
* engine somebody licensed, printed at a person trying to buy a phone. It
|
|
19
|
+
* is the same sentence on every query forever, which is what makes it
|
|
20
|
+
* invisible by the day `category_rollup` shows up in the same box.
|
|
21
|
+
* `exact_total` joins them: the count already says "N+".
|
|
22
|
+
*
|
|
23
|
+
* Measured live on a classified board: a full-screen yellow "synonyms
|
|
24
|
+
* were not substituted" between the sort control and the first card, on every
|
|
25
|
+
* query, for every buyer. Note what the fix is NOT — the string was not
|
|
26
|
+
* deleted and the kind was not special-cased. `readerFacing` names the
|
|
27
|
+
* *audience*, so the next engine-capability literal is filtered by the
|
|
28
|
+
* same rule instead of growing its own copy of this comment.
|
|
24
29
|
* 2. **`variant`.** A catalogue page wants the banner; a landing page that
|
|
25
30
|
* shows six cards under a hero has no room for a warning box and passes
|
|
26
|
-
* `"inline"` (one quiet line) or `"off"`. `"
|
|
27
|
-
*
|
|
28
|
-
*
|
|
31
|
+
* `"inline"` (one quiet line) or `"off"`. `"debug"` is the operator's
|
|
32
|
+
* view: everything, unfiltered, for a status page or a support tool.
|
|
33
|
+
* `"off"` is a decision the CONTAINER makes about ITS surface — the
|
|
34
|
+
* notice stays the default, and nothing here silences a reader-facing
|
|
35
|
+
* degradation for everyone.
|
|
29
36
|
*/
|
|
30
37
|
import type { ReactElement } from "react";
|
|
31
38
|
import type { SearchDegradation } from "../api/types.js";
|
|
@@ -34,10 +41,12 @@ import type { SearchDegradation } from "../api/types.js";
|
|
|
34
41
|
*
|
|
35
42
|
* - `"banner"` (default) — an antd warning `Alert` with one line per item.
|
|
36
43
|
* - `"inline"` — the same sentences as quiet secondary text, no box.
|
|
44
|
+
* - `"debug"` — every degradation including the operator's, for a status page
|
|
45
|
+
* or a support tool. The one variant that does not filter by audience.
|
|
37
46
|
* - `"off"` — nothing. For a surface where the notice does not belong at all;
|
|
38
47
|
* the container that turns it off owns saying so somewhere else.
|
|
39
48
|
*/
|
|
40
|
-
export type DegradationNoticeVariant = "banner" | "inline" | "off";
|
|
49
|
+
export type DegradationNoticeVariant = "banner" | "inline" | "debug" | "off";
|
|
41
50
|
export interface DegradationNoticeProps {
|
|
42
51
|
readonly degradations: readonly SearchDegradation[];
|
|
43
52
|
readonly variant?: DegradationNoticeVariant;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DegradationNotice.d.ts","sourceRoot":"","sources":["../../src/default/DegradationNotice.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"DegradationNotice.d.ts","sourceRoot":"","sources":["../../src/default/DegradationNotice.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIzD;;;;;;;;;GASG;AACH,MAAM,MAAM,wBAAwB,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;AAE7E,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,YAAY,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACpD,QAAQ,CAAC,OAAO,CAAC,EAAE,wBAAwB,CAAC;IAC5C;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CAC5D;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,sBAAsB,GAC5B,YAAY,GAAG,IAAI,CA2DrB"}
|
|
@@ -2,17 +2,16 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Alert, Flex, Typography } from "antd";
|
|
3
3
|
import { fontSize, spacing } from "@stapel/tokens";
|
|
4
4
|
import { useT } from "@stapel/core";
|
|
5
|
-
import {
|
|
5
|
+
import { readerFacing } from "../state/degradations.js";
|
|
6
6
|
import { SEARCH_I18N_KEYS } from "../i18n/keys.js";
|
|
7
7
|
export function DegradationNotice(props) {
|
|
8
8
|
const t = useT();
|
|
9
9
|
const variant = props.variant ?? "banner";
|
|
10
10
|
if (variant === "off")
|
|
11
11
|
return null;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (isCountNuanceOnly(props.degradations))
|
|
12
|
+
// Everything, or only what this page's reader can act on.
|
|
13
|
+
const degradations = variant === "debug" ? props.degradations : readerFacing(props.degradations);
|
|
14
|
+
if (degradations.length === 0)
|
|
16
15
|
return null;
|
|
17
16
|
const say = (degradation) => {
|
|
18
17
|
const slug = degradation.scorer;
|
|
@@ -27,10 +26,10 @@ export function DegradationNotice(props) {
|
|
|
27
26
|
// theme's warning tint, and grey body text on it measured under 3:1 in the
|
|
28
27
|
// visual pass. Inside a coloured box the readable colour is the box's own
|
|
29
28
|
// text colour, which is what a plain `<Typography.Text>` inherits.
|
|
30
|
-
const lines =
|
|
29
|
+
const lines = degradations.map((degradation) => (_jsx("li", { "data-degradation": degradation.raw, children: _jsx(Typography.Text, { children: say(degradation) }) }, degradation.raw)));
|
|
31
30
|
if (variant === "inline") {
|
|
32
|
-
return (_jsxs(Flex, { vertical: true, gap: spacing[1], "data-testid": "search-degraded", "data-variant": "inline", children: [_jsx(Typography.Text, { type: "secondary", style: { fontSize: fontSize.xs.fontSize }, children: t(SEARCH_I18N_KEYS.degradedTitle) }), _jsx("ul", { style: { margin: 0, paddingInlineStart: spacing[5], fontSize: fontSize.xs.fontSize }, children:
|
|
31
|
+
return (_jsxs(Flex, { vertical: true, gap: spacing[1], "data-testid": "search-degraded", "data-variant": "inline", children: [_jsx(Typography.Text, { type: "secondary", style: { fontSize: fontSize.xs.fontSize }, children: t(SEARCH_I18N_KEYS.degradedTitle) }), _jsx("ul", { style: { margin: 0, paddingInlineStart: spacing[5], fontSize: fontSize.xs.fontSize }, children: degradations.map((degradation) => (_jsx("li", { "data-degradation": degradation.raw, children: _jsx(Typography.Text, { type: "secondary", children: say(degradation) }) }, degradation.raw))) })] }));
|
|
33
32
|
}
|
|
34
|
-
return (_jsx(Alert, { type: "warning", showIcon: true, "data-testid": "search-degraded", "data-variant": "banner", title: t(SEARCH_I18N_KEYS.degradedTitle), description: _jsx("ul", { style: { margin: 0, paddingInlineStart: spacing[5] }, children: lines }) }));
|
|
33
|
+
return (_jsx(Alert, { type: "warning", showIcon: true, "data-testid": "search-degraded", "data-variant": variant === "debug" ? "debug" : "banner", title: t(SEARCH_I18N_KEYS.degradedTitle), description: _jsx("ul", { style: { margin: 0, paddingInlineStart: spacing[5] }, children: lines }) }));
|
|
35
34
|
}
|
|
36
35
|
//# sourceMappingURL=DegradationNotice.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DegradationNotice.js","sourceRoot":"","sources":["../../src/default/DegradationNotice.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"DegradationNotice.js","sourceRoot":"","sources":["../../src/default/DegradationNotice.tsx"],"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AM,GAExE,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
import type { ReactElement, ReactNode } from "react";
|
|
37
37
|
import type { FeatureDef } from "@stapel/attributes-react";
|
|
38
38
|
import type { SearchGeo } from "../api/types.js";
|
|
39
|
+
import type { FacetLabelResolver } from "../headless/useFacetLabels.js";
|
|
39
40
|
import type { ThemeModeProp } from "./types.js";
|
|
40
41
|
/** What a host's category control is handed. */
|
|
41
42
|
export interface CategoryFilterSlotProps {
|
|
@@ -51,11 +52,21 @@ export interface GeoFilterSlotProps {
|
|
|
51
52
|
readonly onChange: (geo: SearchGeo | null) => void;
|
|
52
53
|
}
|
|
53
54
|
export interface FacetPanelPaneProps extends ThemeModeProp {
|
|
54
|
-
/** The category's feature schema — the source of option LABELS
|
|
55
|
-
* slugs get a numeric range row
|
|
55
|
+
/** The category's feature schema — the source of option LABELS, of which
|
|
56
|
+
* slugs get a numeric range row, and of which slugs are a filter at all
|
|
57
|
+
* (`isFacetableFeature`: an `imei` is counted and is not one). */
|
|
56
58
|
readonly categoryFeatures?: readonly FeatureDef[];
|
|
57
59
|
readonly locale?: string;
|
|
58
60
|
readonly enabled?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Name the values neither the answer nor the schema names — see
|
|
63
|
+
* {@link FacetLabelResolver}. A `ref_select` facet carries only a pointer to
|
|
64
|
+
* a vocabulary in its config, and the vocabulary is the host's to read.
|
|
65
|
+
*
|
|
66
|
+
* The same prop reaches `<FilterChips>` from `<SearchPage>`, so the panel
|
|
67
|
+
* and the chip row cannot print two different words for one value.
|
|
68
|
+
*/
|
|
69
|
+
readonly resolveFacetLabels?: FacetLabelResolver;
|
|
59
70
|
/** The catalogue picker (`categories-react`'s `CategoryPickerField`, bound
|
|
60
71
|
* to a path). Unfilled, an active category still gets a "clear" control. */
|
|
61
72
|
readonly renderCategoryFilter?: (slot: CategoryFilterSlotProps) => ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FacetPanelPane.d.ts","sourceRoot":"","sources":["../../src/default/FacetPanelPane.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAkBrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"FacetPanelPane.d.ts","sourceRoot":"","sources":["../../src/default/FacetPanelPane.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAkBrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAOxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,gDAAgD;AAChD,MAAM,WAAW,uBAAuB;IACtC,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAClD;AAED,gDAAgD;AAChD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;IACtC,6CAA6C;IAC7C,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,KAAK,IAAI,CAAC;CACpD;AAED,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD;;sEAEkE;IAClE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;;OAOG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACjD;gFAC4E;IAC5E,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE,uBAAuB,KAAK,SAAS,CAAC;IAC7E;8DAC0D;IAC1D,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,SAAS,CAAC;IACnE;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B,wEAAwE;IACxE,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;CAC9B;AAiDD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,SAAS,EACd,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GACzB,MAAM,CAIR;AAuHD,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,YAAY,CAgKvE"}
|
|
@@ -122,23 +122,36 @@ function skippedNames(slugs, features, t) {
|
|
|
122
122
|
export function FacetPanelPane(props) {
|
|
123
123
|
const t = useT();
|
|
124
124
|
const { state } = useSearchState();
|
|
125
|
-
const ranges = buildRangeGroups({
|
|
126
|
-
state,
|
|
127
|
-
...(props.categoryFeatures !== undefined
|
|
128
|
-
? { categoryFeatures: props.categoryFeatures }
|
|
129
|
-
: {}),
|
|
130
|
-
t,
|
|
131
|
-
});
|
|
132
125
|
return (_jsx(SkinTheme, { ...(props.mode !== undefined ? { mode: props.mode } : {}), children: _jsx(FacetPanel, { ...(props.categoryFeatures !== undefined
|
|
133
126
|
? { categoryFeatures: props.categoryFeatures }
|
|
134
|
-
: {}), ...(props.locale !== undefined ? { locale: props.locale } : {}), ...(props.enabled !== undefined ? { enabled: props.enabled } : {}),
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
127
|
+
: {}), ...(props.locale !== undefined ? { locale: props.locale } : {}), ...(props.enabled !== undefined ? { enabled: props.enabled } : {}), ...(props.resolveFacetLabels !== undefined
|
|
128
|
+
? { resolveFacetLabels: props.resolveFacetLabels }
|
|
129
|
+
: {}), children: (bag) => {
|
|
130
|
+
// Built INSIDE the bag, because which axes exist is a property of
|
|
131
|
+
// the ANSWER now: `facet_meta.core_ranges` names the core columns
|
|
132
|
+
// this server can actually filter on (`r.price`), and the corpus
|
|
133
|
+
// currency is read off the cards it just returned. Computed
|
|
134
|
+
// outside, the panel would have had to keep its own list of core
|
|
135
|
+
// slugs — which is how a board ends up offering a price filter
|
|
136
|
+
// against a server that answers zero for one.
|
|
137
|
+
const ranges = buildRangeGroups({
|
|
138
|
+
state,
|
|
139
|
+
...(props.categoryFeatures !== undefined
|
|
140
|
+
? { categoryFeatures: props.categoryFeatures }
|
|
141
|
+
: {}),
|
|
142
|
+
coreRanges: bag.coreRanges,
|
|
143
|
+
...(bag.currency !== undefined ? { currency: bag.currency } : {}),
|
|
144
|
+
t,
|
|
145
|
+
});
|
|
146
|
+
return (_jsxs(Flex, { vertical: true, gap: spacing[3], "data-testid": "search-facets", children: [_jsxs(Flex, { justify: "space-between", align: "center", gap: spacing[2], children: [props.heading === null ? (_jsx("span", {})) : (_jsx(Typography.Title, { level: 5, style: { margin: 0 }, children: props.heading ?? t(SEARCH_I18N_KEYS.facetsTitle) })), bag.activeFilters > 0 && (_jsx(Button, { onClick: bag.clearAll, "data-analytics": "none", "data-analytics-reason": "a filter is a read, not a flow step", "data-testid": "facets-clear-all", children: t(SEARCH_I18N_KEYS.facetsClearAll, { count: bag.activeFilters }) }))] }), _jsx(CategoryFilter, { ...(props.renderCategoryFilter !== undefined
|
|
147
|
+
? { render: props.renderCategoryFilter }
|
|
148
|
+
: {}) }), _jsx(LanguageSelect, { ...(props.languages !== undefined ? { languages: props.languages } : {}) }), _jsx(GeoFilter, { ...(props.renderGeoFilter !== undefined
|
|
149
|
+
? { render: props.renderGeoFilter }
|
|
150
|
+
: {}), ...(props.geoLabel !== undefined ? { label: props.geoLabel } : {}) }), ranges.length > 0 && (_jsx(Flex, { vertical: true, gap: spacing[3], "data-testid": "search-ranges", children: ranges.map((group) => (_jsx(RangeFilterRow, { group: group, onApply: bag.setRange }, group.slug))) })), ranges.length > 0 && _jsx(Divider, { style: { margin: 0 } }), bag.approximate && (_jsx(Alert, { type: "info", showIcon: true, "data-testid": "facets-approximate", title: t(SEARCH_I18N_KEYS.facetsApproximate) })), bag.skipped.length > 0 && (_jsx(Alert, { type: "warning", showIcon: true, "data-testid": "facets-skipped", title: t(SEARCH_I18N_KEYS.facetsSkipped, {
|
|
151
|
+
slugs: skippedNames(bag.skipped, props.categoryFeatures, t),
|
|
152
|
+
}) })), _jsx(LoadList, { state: bag.state, testId: "facets", skeletonRows: 4, empty: _jsx(EmptyState, { compact: true, title: t(SEARCH_I18N_KEYS.facetsEmpty), testId: "facets-empty" }), failed: (error) => (_jsx(ErrorAlert, { testId: "facets-failed", thrown: error, message: t(SEARCH_I18N_KEYS.facetsLoadFailed) })), children: (groups) => (_jsxs(Flex, { vertical: true, gap: spacing[4], children: [groups
|
|
153
|
+
.filter((group) => group.options.length > 0)
|
|
154
|
+
.map((group) => (_jsx(FacetGroupControl, { group: group, onToggle: bag.toggle }, group.slug))), _jsx(Typography.Text, { type: "secondary", children: t(SEARCH_I18N_KEYS.facetsDrillDownHint) })] })) })] }));
|
|
155
|
+
} }) }));
|
|
143
156
|
}
|
|
144
157
|
//# sourceMappingURL=FacetPanelPane.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FacetPanelPane.js","sourceRoot":"","sources":["../../src/default/FacetPanelPane.tsx"],"names":[],"mappings":";AAoCA,OAAO,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,IAAI,EACJ,WAAW,EACX,UAAU,GACX,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,SAAS,GACV,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"FacetPanelPane.js","sourceRoot":"","sources":["../../src/default/FacetPanelPane.tsx"],"names":[],"mappings":";AAoCA,OAAO,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,IAAI,EACJ,WAAW,EACX,UAAU,GACX,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,SAAS,GACV,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAA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CAAC,KAAK,EAAE,EAAE,CAAC,CACjB,KAAC,UAAU,IACT,MAAM,EAAC,eAAe,EACtB,MAAM,EAAE,KAAK,EACb,OAAO,EAAE,CAAC,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,GAC7C,CACH,YAEA,CAAC,MAAM,EAAE,EAAE,CAAC,CACX,MAAC,IAAI,IAAC,QAAQ,QAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,aAa3B,MAAM;yCACJ,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;yCAC3C,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACd,KAAC,iBAAiB,IAEhB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,GAAG,CAAC,MAAM,IAFf,KAAK,CAAC,IAAI,CAGf,CACH,CAAC,EACJ,KAAC,UAAU,CAAC,IAAI,IAAC,IAAI,EAAC,WAAW,YAC9B,CAAC,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,GACxB,IACb,CACR,GACQ,IACN,CACN,CAAC;YACJ,CAAC,GACU,GACH,CACb,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode } from "react";
|
|
2
2
|
import type { FeatureDef } from "@stapel/attributes-react";
|
|
3
|
-
import type {
|
|
3
|
+
import type { FacetLabelResolver } from "../headless/useFacetLabels.js";
|
|
4
|
+
import type { RangeGroup } from "../state/ranges.js";
|
|
5
|
+
import type { FacetGroup } from "../state/facets.js";
|
|
6
|
+
import type { CategoryFilterSlotProps, GeoFilterSlotProps } from "./FacetPanelPane.js";
|
|
4
7
|
/** The class the scroller carries, for {@link chipRowCss}. */
|
|
5
8
|
export declare const CHIP_ROW_CLASS = "stapel-filter-chips";
|
|
6
9
|
/** The `href` the hoisted chip-row stylesheet is deduplicated by. */
|
|
@@ -11,11 +14,72 @@ export declare const CHIP_ROW_STYLE_HREF = "stapel-search-filter-chips";
|
|
|
11
14
|
* copy serves the document.
|
|
12
15
|
*/
|
|
13
16
|
export declare function chipRowCss(): string;
|
|
17
|
+
/**
|
|
18
|
+
* The three bands the row's non-slot chips fall into, most-evidenced first.
|
|
19
|
+
*
|
|
20
|
+
* `core_range` is the SERVER's own declaration (`facet_meta.core_ranges`) that
|
|
21
|
+
* an axis exists for every document in every category. `facet` is a group the
|
|
22
|
+
* server COUNTED for this search, which arrives with the remaining counts that
|
|
23
|
+
* make it a drill-down. `attribute_range` is a numeric field the category
|
|
24
|
+
* declares and nothing ranks — see this module's ordering note.
|
|
25
|
+
*/
|
|
26
|
+
export type ChipBand = "core_range" | "facet" | "attribute_range";
|
|
27
|
+
/** Band order, stated once. */
|
|
28
|
+
export declare const CHIP_BAND_ORDER: readonly ChipBand[];
|
|
29
|
+
/** One non-slot chip, resolved to the band and the applied state it sorts by. */
|
|
30
|
+
export type ChipSpec = {
|
|
31
|
+
readonly band: "core_range" | "attribute_range";
|
|
32
|
+
readonly range: RangeGroup;
|
|
33
|
+
} | {
|
|
34
|
+
readonly band: "facet";
|
|
35
|
+
readonly facet: FacetGroup;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* The row's order: applied first, then band, then the order each source
|
|
39
|
+
* already came in.
|
|
40
|
+
*
|
|
41
|
+
* Exported because the order IS the fix — the defect it closes is invisible to
|
|
42
|
+
* a test that only asks whether a chip exists, and a rule stated in prose next
|
|
43
|
+
* to an unexercised implementation is a rule that drifts.
|
|
44
|
+
*
|
|
45
|
+
* `Array.prototype.sort` is stable in every runtime this pair supports, so
|
|
46
|
+
* equal-ranked chips keep the order `buildRangeGroups` and `buildFacetGroups`
|
|
47
|
+
* gave them — a closed set's authored order survives all the way to the row.
|
|
48
|
+
*/
|
|
49
|
+
export declare function orderChipFilters(ranges: readonly RangeGroup[], facets: readonly FacetGroup[]): readonly ChipSpec[];
|
|
14
50
|
export interface FilterChipsProps {
|
|
15
51
|
/** The category's feature schema — the source of option labels, of which
|
|
16
|
-
* slugs get a range chip,
|
|
52
|
+
* slugs get a range chip, of which slugs are choosable at all, and of how
|
|
53
|
+
* each group is drawn. */
|
|
17
54
|
readonly categoryFeatures?: readonly FeatureDef[];
|
|
18
55
|
readonly locale?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Name the values neither the answer nor the schema names — see
|
|
58
|
+
* {@link FacetLabelResolver}. The same prop reaches the filter panel, so a
|
|
59
|
+
* value cannot read one way on a chip and another way inside the sheet.
|
|
60
|
+
*/
|
|
61
|
+
readonly resolveFacetLabels?: FacetLabelResolver;
|
|
62
|
+
/**
|
|
63
|
+
* The catalogue picker (`categories-react`), same slot the panel takes.
|
|
64
|
+
*
|
|
65
|
+
* Filled, it becomes the row's LEADING chip and opens in the same sheet as
|
|
66
|
+
* every other chip. Unfilled, the row draws no category chip at all — and
|
|
67
|
+
* that is not a constraint left without a control: the whole panel is one
|
|
68
|
+
* tap away behind the leading circle, and it carries the "search the whole
|
|
69
|
+
* catalogue" button for a link that arrived narrowed.
|
|
70
|
+
*/
|
|
71
|
+
readonly renderCategoryFilter?: (slot: CategoryFilterSlotProps) => ReactNode;
|
|
72
|
+
/**
|
|
73
|
+
* What the current category is CALLED, in words.
|
|
74
|
+
*
|
|
75
|
+
* The pair holds a `root/leaf` PATH of slugs and nothing that turns one into
|
|
76
|
+
* a catalogue name — the tree belongs to `categories-react`, and whoever
|
|
77
|
+
* rendered the picker has the name already. Absent, the chip falls back to
|
|
78
|
+
* the path's last segment, which is the honest half-answer: it is what the
|
|
79
|
+
* search is actually narrowed to, it fits a 390px row where the whole path
|
|
80
|
+
* does not, and it is never invented.
|
|
81
|
+
*/
|
|
82
|
+
readonly categoryLabel?: ReactNode;
|
|
19
83
|
/** The location control (`geo-react`), same slot the panel takes. Without
|
|
20
84
|
* it the location chip appears only when the URL already carries a point,
|
|
21
85
|
* so a shared link can still be widened. */
|
|
@@ -32,6 +96,27 @@ export interface FilterChipsProps {
|
|
|
32
96
|
/** Open the whole panel — the leading chip's action. The page owns that
|
|
33
97
|
* sheet, because the page is the surface it covers. */
|
|
34
98
|
readonly onOpenAll: () => void;
|
|
99
|
+
/**
|
|
100
|
+
* Draw the location chip. Default `true`.
|
|
101
|
+
*
|
|
102
|
+
* `false` for a surface that already states the location ABOVE this row —
|
|
103
|
+
* `<LocationSummaryLine>` is that surface, and the phone SERP mounts both.
|
|
104
|
+
* Together they printed two location controls one line apart — the summary
|
|
105
|
+
* sentence over the chip's own prompt — opening two different sheets over
|
|
106
|
+
* one filter, which is the same constraint asked about twice.
|
|
107
|
+
*/
|
|
108
|
+
readonly geoChip?: boolean;
|
|
35
109
|
}
|
|
36
|
-
|
|
110
|
+
/**
|
|
111
|
+
* The last segment of a `root/leaf` category path.
|
|
112
|
+
*
|
|
113
|
+
* A chip has room for one word, and the whole path is what the panel prints on
|
|
114
|
+
* a surface with a column to spend. This is the pair's LAST resort — a host
|
|
115
|
+
* that renders the picker knows the catalogue's own name for the node and
|
|
116
|
+
* passes `categoryLabel` — but it is a real narrowing stated with a value the
|
|
117
|
+
* URL genuinely carries, which is the line the geo chip draws too: never print
|
|
118
|
+
* a coordinate, always print the name you actually have.
|
|
119
|
+
*/
|
|
120
|
+
export declare function categoryLeaf(path: string): string;
|
|
121
|
+
export declare function FilterChips(props: FilterChipsProps): ReactElement | null;
|
|
37
122
|
//# sourceMappingURL=FilterChips.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterChips.d.ts","sourceRoot":"","sources":["../../src/default/FilterChips.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FilterChips.d.ts","sourceRoot":"","sources":["../../src/default/FilterChips.tsx"],"names":[],"mappings":"AA4GA,OAAO,KAAK,EAAiB,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,KAAK,EAAE,kBAAkB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