@stapel/search-react 0.3.1 → 0.7.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 +180 -0
- package/MODULE.md +43 -4
- package/README.md +1 -1
- package/dist/api/generated/schema.d.ts +5 -1
- package/dist/api/generated/schema.d.ts.map +1 -1
- package/dist/default/DegradationNotice.d.ts +34 -0
- package/dist/default/DegradationNotice.d.ts.map +1 -1
- package/dist/default/DegradationNotice.js +28 -6
- package/dist/default/DegradationNotice.js.map +1 -1
- package/dist/default/FacetPanelPane.d.ts +54 -3
- package/dist/default/FacetPanelPane.d.ts.map +1 -1
- package/dist/default/FacetPanelPane.js +119 -19
- package/dist/default/FacetPanelPane.js.map +1 -1
- package/dist/default/LanguageSelect.d.ts +9 -0
- package/dist/default/LanguageSelect.d.ts.map +1 -0
- package/dist/default/LanguageSelect.js +72 -0
- package/dist/default/LanguageSelect.js.map +1 -0
- package/dist/default/PageSizeSelect.d.ts +29 -0
- package/dist/default/PageSizeSelect.d.ts.map +1 -0
- package/dist/default/PageSizeSelect.js +25 -0
- package/dist/default/PageSizeSelect.js.map +1 -0
- package/dist/default/RangeFilterRow.d.ts +12 -0
- package/dist/default/RangeFilterRow.d.ts.map +1 -0
- package/dist/default/RangeFilterRow.js +75 -0
- package/dist/default/RangeFilterRow.js.map +1 -0
- package/dist/default/RankingDisclosurePane.d.ts +5 -0
- package/dist/default/RankingDisclosurePane.d.ts.map +1 -1
- package/dist/default/RankingDisclosurePane.js +15 -15
- package/dist/default/RankingDisclosurePane.js.map +1 -1
- package/dist/default/SearchBox.d.ts +13 -0
- package/dist/default/SearchBox.d.ts.map +1 -0
- package/dist/default/SearchBox.js +67 -0
- package/dist/default/SearchBox.js.map +1 -0
- package/dist/default/SearchPage.d.ts +58 -16
- package/dist/default/SearchPage.d.ts.map +1 -1
- package/dist/default/SearchPage.js +155 -6
- package/dist/default/SearchPage.js.map +1 -1
- package/dist/default/SearchResultCard.d.ts +19 -18
- package/dist/default/SearchResultCard.d.ts.map +1 -1
- package/dist/default/SearchResultCard.js +178 -5
- package/dist/default/SearchResultCard.js.map +1 -1
- package/dist/default/SearchResultsPane.d.ts +54 -3
- package/dist/default/SearchResultsPane.d.ts.map +1 -1
- package/dist/default/SearchResultsPane.js +45 -25
- package/dist/default/SearchResultsPane.js.map +1 -1
- package/dist/default/SortSelect.d.ts +10 -2
- package/dist/default/SortSelect.d.ts.map +1 -1
- package/dist/default/SortSelect.js +27 -24
- package/dist/default/SortSelect.js.map +1 -1
- package/dist/default/UrlIssueNotice.d.ts.map +1 -1
- package/dist/default/UrlIssueNotice.js +19 -1
- package/dist/default/UrlIssueNotice.js.map +1 -1
- package/dist/default/index.d.ts +33 -16
- package/dist/default/index.d.ts.map +1 -1
- package/dist/default/index.js +26 -12
- package/dist/default/index.js.map +1 -1
- package/dist/default/sortLabels.d.ts +5 -0
- package/dist/default/sortLabels.d.ts.map +1 -0
- package/dist/default/sortLabels.js +32 -0
- package/dist/default/sortLabels.js.map +1 -0
- package/dist/headless/FacetPanel.d.ts +17 -0
- package/dist/headless/FacetPanel.d.ts.map +1 -1
- package/dist/headless/FacetPanel.js +23 -2
- package/dist/headless/FacetPanel.js.map +1 -1
- package/dist/headless/SearchResults.d.ts +20 -3
- package/dist/headless/SearchResults.d.ts.map +1 -1
- package/dist/headless/SearchResults.js +3 -1
- package/dist/headless/SearchResults.js.map +1 -1
- package/dist/headless/useAppliedCount.d.ts +8 -0
- package/dist/headless/useAppliedCount.d.ts.map +1 -0
- package/dist/headless/useAppliedCount.js +30 -0
- package/dist/headless/useAppliedCount.js.map +1 -0
- package/dist/headless/useScorerNames.d.ts +4 -0
- package/dist/headless/useScorerNames.d.ts.map +1 -0
- package/dist/headless/useScorerNames.js +34 -0
- package/dist/headless/useScorerNames.js.map +1 -0
- package/dist/headless/useSearchBox.d.ts +44 -0
- package/dist/headless/useSearchBox.d.ts.map +1 -0
- package/dist/headless/useSearchBox.js +116 -0
- package/dist/headless/useSearchBox.js.map +1 -0
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +32 -4
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/keys.d.ts +46 -2
- package/dist/i18n/keys.d.ts.map +1 -1
- package/dist/i18n/keys.js +86 -6
- package/dist/i18n/keys.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +38 -4
- package/dist/i18n/ru.js.map +1 -1
- package/dist/index.d.ts +9 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/model/queries.d.ts +26 -2
- package/dist/model/queries.d.ts.map +1 -1
- package/dist/model/queries.js +38 -1
- package/dist/model/queries.js.map +1 -1
- package/dist/state/degradations.d.ts +41 -0
- package/dist/state/degradations.d.ts.map +1 -1
- package/dist/state/degradations.js +41 -0
- package/dist/state/degradations.js.map +1 -1
- package/dist/state/limits.d.ts +44 -0
- package/dist/state/limits.d.ts.map +1 -0
- package/dist/state/limits.js +44 -0
- package/dist/state/limits.js.map +1 -0
- package/dist/state/ranges.d.ts +52 -0
- package/dist/state/ranges.d.ts.map +1 -0
- package/dist/state/ranges.js +108 -0
- package/dist/state/ranges.js.map +1 -0
- package/llms.txt +16 -5
- package/manifest.json +245 -22
- package/nav-manifest.json +1 -1
- package/package.json +15 -10
- package/src/analytics/generated/events.json +1 -1
- package/src/api/generated/schema.ts +5 -1
- package/src/default/DegradationNotice.tsx +84 -14
- package/src/default/FacetPanelPane.tsx +343 -64
- package/src/default/LanguageSelect.tsx +93 -0
- package/src/default/PageSizeSelect.tsx +80 -0
- package/src/default/RangeFilterRow.tsx +148 -0
- package/src/default/RankingDisclosurePane.tsx +67 -35
- package/src/default/SearchBox.tsx +130 -0
- package/src/default/SearchPage.tsx +356 -41
- package/src/default/SearchResultCard.tsx +231 -24
- package/src/default/SearchResultsPane.tsx +147 -76
- package/src/default/SortSelect.tsx +50 -37
- package/src/default/UrlIssueNotice.tsx +21 -3
- package/src/default/index.ts +42 -16
- package/src/default/sortLabels.ts +34 -0
- package/src/headless/FacetPanel.tsx +30 -2
- package/src/headless/SearchResults.tsx +32 -4
- package/src/headless/useAppliedCount.ts +41 -0
- package/src/headless/useScorerNames.ts +36 -0
- package/src/headless/useSearchBox.ts +189 -0
- package/src/i18n/es.ts +39 -4
- package/src/i18n/keys.ts +97 -6
- package/src/i18n/ru.ts +45 -4
- package/src/index.ts +30 -3
- package/src/model/queries.ts +51 -1
- package/src/state/degradations.ts +60 -0
- package/src/state/limits.ts +50 -0
- package/src/state/ranges.ts +144 -0
- package/dist/default/ErrorAlert.d.ts +0 -9
- package/dist/default/ErrorAlert.d.ts.map +0 -1
- package/dist/default/ErrorAlert.js +0 -27
- package/dist/default/ErrorAlert.js.map +0 -1
- package/dist/default/theme.d.ts +0 -24
- package/dist/default/theme.d.ts.map +0 -1
- package/dist/default/theme.js +0 -39
- package/dist/default/theme.js.map +0 -1
- package/src/default/ErrorAlert.tsx +0 -46
- package/src/default/theme.tsx +0 -66
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"degradations.d.ts","sourceRoot":"","sources":["../../src/state/degradations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAYhF,+CAA+C;AAC/C,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,qBAAqB,GAAG,MAAM,CAEzE;AAED,0DAA0D;AAC1D,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACtC,SAAS,iBAAiB,EAAE,CAwB9B;AAED
|
|
1
|
+
{"version":3,"file":"degradations.d.ts","sourceRoot":"","sources":["../../src/state/degradations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAYhF,+CAA+C;AAC/C,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,qBAAqB,GAAG,MAAM,CAEzE;AAED,0DAA0D;AAC1D,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACtC,SAAS,iBAAiB,EAAE,CAwB9B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,OAAO,EACnB,YAAY,EAAE,SAAS,iBAAiB,EAAE,GACzC,OAAO,CAET;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;AAE/D;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,YAAY,EAAE,OAAO,GAAG,SAAS,EACjC,UAAU,EAAE,OAAO,EACnB,YAAY,EAAE,SAAS,iBAAiB,EAAE,GACzC,eAAe,CAIjB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,SAAS,iBAAiB,EAAE,GACzC,OAAO,CAKT"}
|
|
@@ -45,8 +45,49 @@ export function parseDegradations(degraded) {
|
|
|
45
45
|
* the envelope's own `exact_total: false`, and the `"exact_total"`
|
|
46
46
|
* degradation. They agree in practice; treating either as decisive is what
|
|
47
47
|
* keeps "≈1 200" from ever being rendered as "1 200".
|
|
48
|
+
*
|
|
49
|
+
* @deprecated Since stapel-search 0.2.0 the envelope answers this directly
|
|
50
|
+
* with `count_is_lower_bound`, and "not exact" now means a FLOOR rather than
|
|
51
|
+
* a fuzzy number. Use {@link countKind}, which reads the wire field and also
|
|
52
|
+
* handles `count: null`.
|
|
48
53
|
*/
|
|
49
54
|
export function countIsEstimate(exactTotal, degradations) {
|
|
50
55
|
return !exactTotal || degradations.some((d) => d.kind === "exact_total");
|
|
51
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Read the envelope's three count fields as one decision.
|
|
59
|
+
*
|
|
60
|
+
* `null` is UNKNOWN and renders as no count line — never as `0`, and never
|
|
61
|
+
* as "about 0". Anything the server declines to call exact is rendered as a
|
|
62
|
+
* floor ("N+"), including the defensive case of an `exact_total: false` from
|
|
63
|
+
* a server that predates `count_is_lower_bound`: claiming "at least N" over
|
|
64
|
+
* a page that shows N rows is the one reading that cannot be contradicted by
|
|
65
|
+
* what the reader can see.
|
|
66
|
+
*/
|
|
67
|
+
export function countKind(count, isLowerBound, exactTotal, degradations) {
|
|
68
|
+
if (count === null || count === undefined)
|
|
69
|
+
return "unknown";
|
|
70
|
+
if (isLowerBound === true)
|
|
71
|
+
return "at_least";
|
|
72
|
+
return countIsEstimate(exactTotal, degradations) ? "at_least" : "exact";
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Is `exact_total` the ONLY thing the engine could not do?
|
|
76
|
+
*
|
|
77
|
+
* It is a count NUANCE, not a failed search: the answer is complete, the
|
|
78
|
+
* rows are the right rows, and the single consequence — that the total is a
|
|
79
|
+
* floor — is already spoken by the count itself as "N+". Raising a warning
|
|
80
|
+
* banner over it teaches a reader that a perfectly good result page is
|
|
81
|
+
* broken, and a banner that cries wolf on every landing page is a banner
|
|
82
|
+
* nobody reads on the day `category_rollup` shows up in it.
|
|
83
|
+
*
|
|
84
|
+
* Every other degradation changes what the page MEANS ("typos were not
|
|
85
|
+
* corrected", "subcategories may be missing", "counts are approximate") and
|
|
86
|
+
* still renders. So does `exact_total` when it arrives BESIDE one of them —
|
|
87
|
+
* the list is then a description of a genuinely degraded answer.
|
|
88
|
+
*/
|
|
89
|
+
export function isCountNuanceOnly(degradations) {
|
|
90
|
+
return (degradations.length > 0 &&
|
|
91
|
+
degradations.every((degradation) => degradation.kind === "exact_total"));
|
|
92
|
+
}
|
|
52
93
|
//# sourceMappingURL=degradations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"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AAI,SAAS,CAAC;SACrD,CAAC,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,eAAe,CAC7B,UAAmB,EACnB,YAA0C;IAE1C,OAAO,CAAC,UAAU,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC;AAC3E,CAAC;AAYD;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CACvB,KAAgC,EAChC,YAAiC,EACjC,UAAmB,EACnB,YAA0C;IAE1C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC5D,IAAI,YAAY,KAAK,IAAI;QAAE,OAAO,UAAU,CAAC;IAC7C,OAAO,eAAe,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC;AAC1E,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,iBAAiB,CAC/B,YAA0C;IAE1C,OAAO,CACL,YAAY,CAAC,MAAM,GAAG,CAAC;QACvB,YAAY,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,KAAK,aAAa,CAAC,CACxE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The backend's own limits, in one place — and the two timings the client
|
|
3
|
+
* chooses so that it never provokes them.
|
|
4
|
+
*
|
|
5
|
+
* Every number here is a fact about stapel-search's `conf.py` (or, for the
|
|
6
|
+
* debounces, a decision taken because of one). They live in the state layer,
|
|
7
|
+
* beside the codec, because they are properties of the CONTRACT rather than of
|
|
8
|
+
* any component: a control that caps its input at `SEARCH_QUERY_MAX_CHARS`
|
|
9
|
+
* cannot produce `error.400.search_query_too_long`, and a typeahead that waits
|
|
10
|
+
* for `SEARCH_BOX_SUGGEST_DEBOUNCE_MS` does not earn a 429 from a throttled
|
|
11
|
+
* endpoint for typing quickly.
|
|
12
|
+
*
|
|
13
|
+
* They are DEFAULTS, not assertions: a deployment may raise `MAX_PAGE_SIZE` or
|
|
14
|
+
* lower `MAX_QUERY_CHARS`, and nothing here is sent to the server as a claim.
|
|
15
|
+
* The server remains the one entitled to refuse.
|
|
16
|
+
*/
|
|
17
|
+
/** `MAX_QUERY_CHARS` — the longest `q` (and suggest prefix) the server reads. */
|
|
18
|
+
export declare const SEARCH_QUERY_MAX_CHARS = 200;
|
|
19
|
+
/** `DEFAULT_PAGE_SIZE` — what a request with no `limit` gets. */
|
|
20
|
+
export declare const SEARCH_DEFAULT_PAGE_SIZE = 24;
|
|
21
|
+
/** `MAX_PAGE_SIZE` — the server clamps anything above this. */
|
|
22
|
+
export declare const SEARCH_MAX_PAGE_SIZE = 100;
|
|
23
|
+
/** `services.suggest` clamps `limit` into `1..25`. */
|
|
24
|
+
export declare const SUGGEST_MAX_LIMIT = 25;
|
|
25
|
+
/**
|
|
26
|
+
* The shortest prefix worth asking the index about.
|
|
27
|
+
*
|
|
28
|
+
* One and two letters match nearly everything, so the answer is noise and the
|
|
29
|
+
* request is a keystroke tax on a throttled endpoint (`SuggestThrottle`,
|
|
30
|
+
* scope `search-suggest`). Three is where a prefix starts to mean something.
|
|
31
|
+
*/
|
|
32
|
+
export declare const SUGGEST_MIN_CHARS = 3;
|
|
33
|
+
/** How long the typing has to stop before the SEARCH runs. */
|
|
34
|
+
export declare const SEARCH_BOX_DEBOUNCE_MS = 350;
|
|
35
|
+
/**
|
|
36
|
+
* How long it has to stop before the INDEX is asked for prefixes.
|
|
37
|
+
*
|
|
38
|
+
* Shorter than the commit: a suggestion is only worth having while you are
|
|
39
|
+
* still typing, and it costs a cheap read of one column. Longer than zero: the
|
|
40
|
+
* endpoint is throttled per client, and a request per keystroke is how a person
|
|
41
|
+
* gets 429s for typing quickly.
|
|
42
|
+
*/
|
|
43
|
+
export declare const SEARCH_BOX_SUGGEST_DEBOUNCE_MS = 150;
|
|
44
|
+
//# sourceMappingURL=limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../src/state/limits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,iFAAiF;AACjF,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,iEAAiE;AACjE,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,+DAA+D;AAC/D,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,sDAAsD;AACtD,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC,8DAA8D;AAC9D,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,MAAM,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The backend's own limits, in one place — and the two timings the client
|
|
3
|
+
* chooses so that it never provokes them.
|
|
4
|
+
*
|
|
5
|
+
* Every number here is a fact about stapel-search's `conf.py` (or, for the
|
|
6
|
+
* debounces, a decision taken because of one). They live in the state layer,
|
|
7
|
+
* beside the codec, because they are properties of the CONTRACT rather than of
|
|
8
|
+
* any component: a control that caps its input at `SEARCH_QUERY_MAX_CHARS`
|
|
9
|
+
* cannot produce `error.400.search_query_too_long`, and a typeahead that waits
|
|
10
|
+
* for `SEARCH_BOX_SUGGEST_DEBOUNCE_MS` does not earn a 429 from a throttled
|
|
11
|
+
* endpoint for typing quickly.
|
|
12
|
+
*
|
|
13
|
+
* They are DEFAULTS, not assertions: a deployment may raise `MAX_PAGE_SIZE` or
|
|
14
|
+
* lower `MAX_QUERY_CHARS`, and nothing here is sent to the server as a claim.
|
|
15
|
+
* The server remains the one entitled to refuse.
|
|
16
|
+
*/
|
|
17
|
+
/** `MAX_QUERY_CHARS` — the longest `q` (and suggest prefix) the server reads. */
|
|
18
|
+
export const SEARCH_QUERY_MAX_CHARS = 200;
|
|
19
|
+
/** `DEFAULT_PAGE_SIZE` — what a request with no `limit` gets. */
|
|
20
|
+
export const SEARCH_DEFAULT_PAGE_SIZE = 24;
|
|
21
|
+
/** `MAX_PAGE_SIZE` — the server clamps anything above this. */
|
|
22
|
+
export const SEARCH_MAX_PAGE_SIZE = 100;
|
|
23
|
+
/** `services.suggest` clamps `limit` into `1..25`. */
|
|
24
|
+
export const SUGGEST_MAX_LIMIT = 25;
|
|
25
|
+
/**
|
|
26
|
+
* The shortest prefix worth asking the index about.
|
|
27
|
+
*
|
|
28
|
+
* One and two letters match nearly everything, so the answer is noise and the
|
|
29
|
+
* request is a keystroke tax on a throttled endpoint (`SuggestThrottle`,
|
|
30
|
+
* scope `search-suggest`). Three is where a prefix starts to mean something.
|
|
31
|
+
*/
|
|
32
|
+
export const SUGGEST_MIN_CHARS = 3;
|
|
33
|
+
/** How long the typing has to stop before the SEARCH runs. */
|
|
34
|
+
export const SEARCH_BOX_DEBOUNCE_MS = 350;
|
|
35
|
+
/**
|
|
36
|
+
* How long it has to stop before the INDEX is asked for prefixes.
|
|
37
|
+
*
|
|
38
|
+
* Shorter than the commit: a suggestion is only worth having while you are
|
|
39
|
+
* still typing, and it costs a cheap read of one column. Longer than zero: the
|
|
40
|
+
* endpoint is throttled per client, and a request per keystroke is how a person
|
|
41
|
+
* gets 429s for typing quickly.
|
|
42
|
+
*/
|
|
43
|
+
export const SEARCH_BOX_SUGGEST_DEBOUNCE_MS = 150;
|
|
44
|
+
//# sourceMappingURL=limits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits.js","sourceRoot":"","sources":["../../src/state/limits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,iFAAiF;AACjF,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAE1C,iEAAiE;AACjE,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAE3C,+DAA+D;AAC/D,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAExC,sDAAsD;AACtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEpC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAEnC,8DAA8D;AAC9D,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAE1C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { FeatureDef } from "@stapel/attributes-react";
|
|
2
|
+
import type { SearchQueryState, SearchRange } from "../api/types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Value types a numeric range row is drawn for (`config.type`, the
|
|
5
|
+
* stapel-attributes value-type slug).
|
|
6
|
+
*/
|
|
7
|
+
export declare const RANGE_FEATURE_TYPES: readonly string[];
|
|
8
|
+
/** One `r.<slug>` row of the filter panel. */
|
|
9
|
+
export interface RangeGroup {
|
|
10
|
+
readonly slug: string;
|
|
11
|
+
/** The feature's display name (translated when it is a key), else the slug. */
|
|
12
|
+
readonly label: string;
|
|
13
|
+
/** The schema entry behind the slug, when the host supplied one. */
|
|
14
|
+
readonly feature: FeatureDef | undefined;
|
|
15
|
+
/** The applied bounds, exactly as the URL carries them (strings — the wire
|
|
16
|
+
* never promised a number, and re-formatting one would rewrite the link). */
|
|
17
|
+
readonly from: string | undefined;
|
|
18
|
+
readonly to: string | undefined;
|
|
19
|
+
/** Bounds the schema declares, for the input's own limits. */
|
|
20
|
+
readonly min: number | undefined;
|
|
21
|
+
readonly max: number | undefined;
|
|
22
|
+
/** Unit suffix the schema declares (`postfix`, or a convertible unit). */
|
|
23
|
+
readonly unit: string | undefined;
|
|
24
|
+
/** `1` for an integer feature — a whole-number input for a whole number. */
|
|
25
|
+
readonly step: number | undefined;
|
|
26
|
+
/** Whether the URL currently constrains this slug. */
|
|
27
|
+
readonly active: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface BuildRangeGroupsInput {
|
|
30
|
+
readonly state: SearchQueryState;
|
|
31
|
+
readonly categoryFeatures?: readonly FeatureDef[];
|
|
32
|
+
/** Translator for label keys (the schema's `name` is often one). */
|
|
33
|
+
readonly t?: (key: string) => string;
|
|
34
|
+
}
|
|
35
|
+
/** Is this feature one a numeric range row is drawn for? */
|
|
36
|
+
export declare function isRangeFeature(feature: FeatureDef): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* The range rows for the current search: every numeric feature of the
|
|
39
|
+
* category, in the schema's own order, plus any slug the URL constrains that
|
|
40
|
+
* the schema does not explain.
|
|
41
|
+
*/
|
|
42
|
+
export declare function buildRangeGroups(input: BuildRangeGroupsInput): readonly RangeGroup[];
|
|
43
|
+
/**
|
|
44
|
+
* Is a from/to pair one the server could ever match?
|
|
45
|
+
*
|
|
46
|
+
* `100..50` is syntactically fine and semantically empty, and the backend does
|
|
47
|
+
* not refuse it — it answers zero results, which reads as "there is nothing
|
|
48
|
+
* like this" rather than "you typed it backwards". So the panel refuses to
|
|
49
|
+
* apply it and says why, beside the button (`search.facets.range_invalid`).
|
|
50
|
+
*/
|
|
51
|
+
export declare function isRangeUsable(range: SearchRange): boolean;
|
|
52
|
+
//# sourceMappingURL=ranges.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ranges.d.ts","sourceRoot":"","sources":["../../src/state/ranges.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAErE;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAIhD,CAAC;AAEF,8CA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slug>=from..to`.
|
|
3
|
+
*
|
|
4
|
+
* The codec has carried ranges since 0.1 (`setRangeValue`, `RANGE_PREFIX`) and
|
|
5
|
+
* nothing ever drew one: a marketplace shipped without a price filter because
|
|
6
|
+
* the panel only knew how to draw checkboxes. This module is the missing half:
|
|
7
|
+
* which slugs a range row exists for, and what the row is called.
|
|
8
|
+
*
|
|
9
|
+
* ── Where a range row comes from, and why it is not the response ───────────
|
|
10
|
+
*
|
|
11
|
+
* A facet answer (`facets: {slug: {value: count}}`) enumerates DISCRETE values;
|
|
12
|
+
* a range is not enumerable and the server never sends one. So the rows come
|
|
13
|
+
* from the CATEGORY SCHEMA — the same `categoryFeatures` slot that gives the
|
|
14
|
+
* checkboxes their labels — filtered to the numeric value types, plus every
|
|
15
|
+
* slug the URL already carries a range for.
|
|
16
|
+
*
|
|
17
|
+
* That last clause is the same rule `buildFacetGroups` follows for a filtered
|
|
18
|
+
* slug that fell out of the plan: a constraint that is ACTIVE must always have
|
|
19
|
+
* a control that removes it, even when the schema no longer explains it.
|
|
20
|
+
* Otherwise a shared link narrows the search with nothing on screen to widen it
|
|
21
|
+
* again.
|
|
22
|
+
*
|
|
23
|
+
* `date` is range-capable on the wire and is deliberately NOT here: a date
|
|
24
|
+
* range needs a date editor, the editor lives in `@stapel/attributes-react`'s
|
|
25
|
+
* registry, and a numeric input over a Unix timestamp would be worse than no
|
|
26
|
+
* control at all. The codec still round-trips one a host sets.
|
|
27
|
+
*/
|
|
28
|
+
import { featureConfig, featureName, featureType } from "@stapel/attributes-react";
|
|
29
|
+
/**
|
|
30
|
+
* Value types a numeric range row is drawn for (`config.type`, the
|
|
31
|
+
* stapel-attributes value-type slug).
|
|
32
|
+
*/
|
|
33
|
+
export const RANGE_FEATURE_TYPES = [
|
|
34
|
+
"int",
|
|
35
|
+
"float",
|
|
36
|
+
"convertible_unit",
|
|
37
|
+
];
|
|
38
|
+
function num(value) {
|
|
39
|
+
return typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
40
|
+
}
|
|
41
|
+
function str(value) {
|
|
42
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
43
|
+
}
|
|
44
|
+
function translate(t, key) {
|
|
45
|
+
if (t === undefined)
|
|
46
|
+
return key;
|
|
47
|
+
const resolved = t(key);
|
|
48
|
+
return resolved.length > 0 ? resolved : key;
|
|
49
|
+
}
|
|
50
|
+
/** Is this feature one a numeric range row is drawn for? */
|
|
51
|
+
export function isRangeFeature(feature) {
|
|
52
|
+
const type = featureType(feature);
|
|
53
|
+
return type !== undefined && RANGE_FEATURE_TYPES.includes(type);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The range rows for the current search: every numeric feature of the
|
|
57
|
+
* category, in the schema's own order, plus any slug the URL constrains that
|
|
58
|
+
* the schema does not explain.
|
|
59
|
+
*/
|
|
60
|
+
export function buildRangeGroups(input) {
|
|
61
|
+
const bySlug = new Map();
|
|
62
|
+
for (const feature of input.categoryFeatures ?? [])
|
|
63
|
+
bySlug.set(feature.slug, feature);
|
|
64
|
+
const slugs = [];
|
|
65
|
+
for (const feature of input.categoryFeatures ?? []) {
|
|
66
|
+
if (isRangeFeature(feature))
|
|
67
|
+
slugs.push(feature.slug);
|
|
68
|
+
}
|
|
69
|
+
for (const slug of Object.keys(input.state.ranges)) {
|
|
70
|
+
if (!slugs.includes(slug))
|
|
71
|
+
slugs.push(slug);
|
|
72
|
+
}
|
|
73
|
+
return slugs.map((slug) => {
|
|
74
|
+
const feature = bySlug.get(slug);
|
|
75
|
+
const config = feature === undefined ? {} : featureConfig(feature);
|
|
76
|
+
const applied = input.state.ranges[slug];
|
|
77
|
+
return {
|
|
78
|
+
slug,
|
|
79
|
+
label: feature === undefined ? slug : translate(input.t, featureName(feature)),
|
|
80
|
+
feature,
|
|
81
|
+
from: applied?.from,
|
|
82
|
+
to: applied?.to,
|
|
83
|
+
min: num(config["min"]),
|
|
84
|
+
max: num(config["max"]),
|
|
85
|
+
unit: str(config["postfix"]) ?? str(config["unit_m"]) ?? str(config["unit_i"]),
|
|
86
|
+
step: feature !== undefined && featureType(feature) === "int" ? 1 : undefined,
|
|
87
|
+
active: applied !== undefined,
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Is a from/to pair one the server could ever match?
|
|
93
|
+
*
|
|
94
|
+
* `100..50` is syntactically fine and semantically empty, and the backend does
|
|
95
|
+
* not refuse it — it answers zero results, which reads as "there is nothing
|
|
96
|
+
* like this" rather than "you typed it backwards". So the panel refuses to
|
|
97
|
+
* apply it and says why, beside the button (`search.facets.range_invalid`).
|
|
98
|
+
*/
|
|
99
|
+
export function isRangeUsable(range) {
|
|
100
|
+
if (range.from === undefined || range.to === undefined)
|
|
101
|
+
return true;
|
|
102
|
+
const from = Number(range.from);
|
|
103
|
+
const to = Number(range.to);
|
|
104
|
+
if (!Number.isFinite(from) || !Number.isFinite(to))
|
|
105
|
+
return true;
|
|
106
|
+
return from <= to;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=ranges.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ranges.js","sourceRoot":"","sources":["../../src/state/ranges.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAInF;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAsB;IACpD,KAAK;IACL,OAAO;IACP,kBAAkB;CACnB,CAAC;AA+BF,SAAS,GAAG,CAAC,KAAc;IACzB,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACjF,CAAC;AAED,SAAS,GAAG,CAAC,KAAc;IACzB,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,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AAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QAAE,OAAO,IAAI,CAAC;IAChE,OAAO,IAAI,IAAI,EAAE,CAAC;AACpB,CAAC"}
|
package/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# @stapel/search-react 0.
|
|
1
|
+
# @stapel/search-react 0.7.0
|
|
2
2
|
|
|
3
|
-
Headless React flow pair for stapel-search (contract >=0.
|
|
3
|
+
Headless React flow pair for stapel-search (contract >=0.2 <0.3) — business + state, zero visual opinion.
|
|
4
4
|
Built on @stapel/core: typed client + StapelApiError envelope, auth token refresh,
|
|
5
5
|
verification-403 interception, i18n engine, analytics facade, TanStack Query layer.
|
|
6
6
|
|
|
@@ -30,6 +30,7 @@ Paths are relative to `/search/api/v1/`.
|
|
|
30
30
|
## Query hooks (server state; keys come only from the key factory)
|
|
31
31
|
- useRankingDisclosure (query) → ranking
|
|
32
32
|
- useSearchQuery (query) → query
|
|
33
|
+
- useSuggest (query) → suggest
|
|
33
34
|
|
|
34
35
|
## Errors (render t(code, params); UX from remediation)
|
|
35
36
|
54 keys (full catalog: manifest.json §errors). By remediation: fix_input 26 · retry 15 · verify 5 · wait_and_retry 5 · contact_support 2 · reauthenticate 1.
|
|
@@ -74,9 +75,19 @@ const { tracked } = useTracked();
|
|
|
74
75
|
```
|
|
75
76
|
|
|
76
77
|
## Demos (defineDemo → manifest.demos; compiled, linted, rendered examples)
|
|
77
|
-
- search.
|
|
78
|
-
- search.
|
|
79
|
-
- search.
|
|
78
|
+
- search.box → <SearchBox> [empty|typed] demo/SearchBox.demo.tsx
|
|
79
|
+
- search.degradation-notice → <DegradationNotice> [banner|inline] demo/DegradationNotice.demo.tsx
|
|
80
|
+
- search.facet-panel-pane → <FacetPanelPane> [open-search|narrowed] demo/FacetPanelPane.demo.tsx
|
|
81
|
+
- search.filter-sheet → <SearchPage> [open] demo/FilterSheet.demo.tsx
|
|
82
|
+
- search.language-select → <LanguageSelect> [offered|from-a-link] demo/LanguageSelect.demo.tsx
|
|
83
|
+
- search.page → <SearchPage> [desktop|phone|unreadable-link] demo/SearchPage.demo.tsx
|
|
84
|
+
- search.page-size-select → <PageSizeSelect> [ladder|off-ladder] demo/PageSizeSelect.demo.tsx
|
|
85
|
+
- search.range-filter-row → <RangeFilterRow> [untouched|applied] demo/RangeFilterRow.demo.tsx
|
|
86
|
+
- search.ranking-pane → <RankingDisclosurePane> [desktop|phone] demo/RankingDisclosurePane.demo.tsx
|
|
87
|
+
- search.result-card → <SearchResultCard> [promoted|plain] demo/SearchResultCard.demo.tsx
|
|
88
|
+
- search.results-pane → <SearchResultsPane> [desktop|phone|empty] demo/SearchResultsPane.demo.tsx
|
|
89
|
+
- search.sort-select → <SortSelect> [no-centre|with-centre] demo/SortSelect.demo.tsx
|
|
90
|
+
- search.url-issue-notice → <UrlIssueNotice> [two-issues|one-issue] demo/UrlIssueNotice.demo.tsx
|
|
80
91
|
Each source file is the canonical usage snippet (open the default variant).
|
|
81
92
|
|
|
82
93
|
## Snippets
|