@stapel/search-react 0.4.0 → 0.8.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 +191 -0
- package/README.md +1 -1
- package/dist/default/DegradationNotice.d.ts +7 -0
- package/dist/default/DegradationNotice.d.ts.map +1 -1
- package/dist/default/DegradationNotice.js +17 -6
- package/dist/default/DegradationNotice.js.map +1 -1
- package/dist/default/FacetGroupControl.d.ts +40 -0
- package/dist/default/FacetGroupControl.d.ts.map +1 -0
- package/dist/default/FacetGroupControl.js +176 -0
- package/dist/default/FacetGroupControl.js.map +1 -0
- package/dist/default/FacetPanelPane.d.ts +54 -3
- package/dist/default/FacetPanelPane.d.ts.map +1 -1
- package/dist/default/FacetPanelPane.js +116 -22
- package/dist/default/FacetPanelPane.js.map +1 -1
- package/dist/default/FilterChips.d.ts +28 -0
- package/dist/default/FilterChips.d.ts.map +1 -0
- package/dist/default/FilterChips.js +204 -0
- package/dist/default/FilterChips.js.map +1 -0
- 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 +94 -16
- package/dist/default/SearchPage.d.ts.map +1 -1
- package/dist/default/SearchPage.js +191 -8
- 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 +61 -3
- package/dist/default/SearchResultsPane.d.ts.map +1 -1
- package/dist/default/SearchResultsPane.js +51 -21
- 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/ViewSwitch.d.ts +66 -0
- package/dist/default/ViewSwitch.d.ts.map +1 -0
- package/dist/default/ViewSwitch.js +49 -0
- package/dist/default/ViewSwitch.js.map +1 -0
- package/dist/default/index.d.ts +38 -15
- package/dist/default/index.d.ts.map +1 -1
- package/dist/default/index.js +29 -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/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 +38 -4
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/keys.d.ts +55 -0
- package/dist/i18n/keys.d.ts.map +1 -1
- package/dist/i18n/keys.js +101 -4
- package/dist/i18n/keys.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +42 -4
- package/dist/i18n/ru.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- 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/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 -4
- package/manifest.json +268 -22
- package/nav-manifest.json +1 -1
- package/package.json +15 -10
- package/src/analytics/generated/events.json +1 -1
- package/src/default/DegradationNotice.tsx +34 -12
- package/src/default/FacetGroupControl.tsx +312 -0
- package/src/default/FacetPanelPane.tsx +320 -87
- package/src/default/FilterChips.tsx +415 -0
- 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 +454 -44
- package/src/default/SearchResultCard.tsx +231 -24
- package/src/default/SearchResultsPane.tsx +158 -71
- package/src/default/SortSelect.tsx +50 -37
- package/src/default/UrlIssueNotice.tsx +21 -3
- package/src/default/ViewSwitch.tsx +147 -0
- package/src/default/index.ts +55 -15
- package/src/default/sortLabels.ts +34 -0
- package/src/headless/FacetPanel.tsx +30 -2
- 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 +46 -4
- package/src/i18n/keys.ts +114 -4
- package/src/i18n/ru.ts +50 -4
- package/src/index.ts +22 -2
- package/src/model/queries.ts +51 -1
- 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":"SearchResultsPane.d.ts","sourceRoot":"","sources":["../../src/default/SearchResultsPane.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"SearchResultsPane.d.ts","sourceRoot":"","sources":["../../src/default/SearchResultsPane.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,EAAiB,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAWpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAOlD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,C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3
|
-
import { errorCode,
|
|
2
|
+
import { Flex, Typography } from "antd";
|
|
3
|
+
import { errorCode, useT, useTPlural } from "@stapel/core";
|
|
4
|
+
import { EmptyState, ErrorAlert, GatedButton, LoadList, SkinTheme, } from "@stapel/tokens-antd/skin";
|
|
5
|
+
import { spacing } from "@stapel/tokens";
|
|
4
6
|
import { SearchResults } from "../headless/SearchResults.js";
|
|
7
|
+
import { useScorerNames } from "../headless/useScorerNames.js";
|
|
5
8
|
import { SEARCH_WINDOW_EXCEEDED } from "../i18n/errorsMap.js";
|
|
6
9
|
import { SEARCH_I18N_KEYS } from "../i18n/keys.js";
|
|
7
10
|
import { DegradationNotice } from "./DegradationNotice.js";
|
|
8
|
-
import { ErrorAlert } from "./ErrorAlert.js";
|
|
9
11
|
import { SearchResultCard } from "./SearchResultCard.js";
|
|
10
|
-
|
|
12
|
+
/**
|
|
13
|
+
* The widest a column of results is allowed to get.
|
|
14
|
+
*
|
|
15
|
+
* Off the spacing scale and named for it: it is a MEASURE, the reading-width
|
|
16
|
+
* decision every long page has to take. Without it the pane spread the full
|
|
17
|
+
* width of whatever it was dropped into — the visual pass measured a 2560px
|
|
18
|
+
* pane with four cards floating at the top of it and a status row 1350px from
|
|
19
|
+
* the buttons that act on it (class C-NOMAXW).
|
|
20
|
+
*/
|
|
21
|
+
export const RESULTS_MAX_WIDTH = 1120;
|
|
11
22
|
/**
|
|
12
23
|
* The results grid. `auto-fill` + `minmax(280px, 1fr)`: as many columns as fit,
|
|
13
24
|
* each at least a readable card and never wider than its share — a catalogue
|
|
@@ -19,9 +30,22 @@ import { SearchSkinTheme } from "./theme.js";
|
|
|
19
30
|
const RESULTS_GRID = {
|
|
20
31
|
display: "grid",
|
|
21
32
|
gridTemplateColumns: "repeat(auto-fill, minmax(280px, 1fr))",
|
|
22
|
-
gap:
|
|
33
|
+
gap: spacing[3],
|
|
23
34
|
alignItems: "stretch",
|
|
24
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* The LIST arrangement: one wide row per result.
|
|
38
|
+
*
|
|
39
|
+
* The same grid with one track, deliberately — not a second layout mechanism.
|
|
40
|
+
* A list is a grid whose column count is one, and expressing it that way is
|
|
41
|
+
* what keeps the card slot, the gap and the stretch identical between the two
|
|
42
|
+
* arrangements, so switching views cannot change anything except the number of
|
|
43
|
+
* columns.
|
|
44
|
+
*/
|
|
45
|
+
const RESULTS_LIST = {
|
|
46
|
+
...RESULTS_GRID,
|
|
47
|
+
gridTemplateColumns: "1fr",
|
|
48
|
+
};
|
|
25
49
|
function Count(props) {
|
|
26
50
|
// A COUNTED sentence: `tPlural` asks Intl.PluralRules for the locale's
|
|
27
51
|
// category, so Russian gets three different endings for 1, 3 and 17 instead
|
|
@@ -39,30 +63,36 @@ function Count(props) {
|
|
|
39
63
|
? tPlural(SEARCH_I18N_KEYS.resultsCountAtLeast, { count: page.count })
|
|
40
64
|
: tPlural(SEARCH_I18N_KEYS.resultsCountExact, { count: page.count }) }));
|
|
41
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* The keyset controls — rendered only when there IS another page.
|
|
68
|
+
*
|
|
69
|
+
* Keyset paging has no page numbers to jump to: there is a next, a previous,
|
|
70
|
+
* and a server-side depth cap. When neither direction exists the pager is not
|
|
71
|
+
* "disabled", it is absent — a control that can never do anything is not a
|
|
72
|
+
* control that needs explaining.
|
|
73
|
+
*/
|
|
42
74
|
function Pager(props) {
|
|
43
75
|
const t = useT();
|
|
44
|
-
const { prev, next, goPrev, goNext } = props.bag;
|
|
45
|
-
|
|
76
|
+
const { page, prev, next, goPrev, goNext } = props.bag;
|
|
77
|
+
if (page === null || (!page.hasNext && !page.hasPrev))
|
|
78
|
+
return null;
|
|
79
|
+
return (_jsxs(Flex, { gap: spacing[2], justify: "center", wrap: true, "data-testid": "search-pager", children: [_jsx(GatedButton, { gate: prev, onClick: goPrev, testId: "search-prev", "data-analytics": "none", "data-analytics-reason": "keyset paging is a read, not a flow step", children: t(SEARCH_I18N_KEYS.resultsPrev) }), _jsx(GatedButton, { gate: next, onClick: goNext, testId: "search-next", "data-analytics": "none", "data-analytics-reason": "keyset paging is a read, not a flow step", children: t(SEARCH_I18N_KEYS.resultsNext) })] }));
|
|
46
80
|
}
|
|
47
81
|
export function SearchResultsPane(props) {
|
|
48
82
|
const t = useT();
|
|
49
|
-
const describe = useDescribeFlowError();
|
|
50
83
|
const { renderCard, renderResults } = props;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
84
|
+
const scorerName = useScorerNames();
|
|
85
|
+
const maxWidth = props.maxWidth === undefined ? RESULTS_MAX_WIDTH : props.maxWidth;
|
|
86
|
+
return (_jsx(SkinTheme, { surface: "base", ...(props.mode !== undefined ? { mode: props.mode } : {}), style: {
|
|
87
|
+
width: "100%",
|
|
88
|
+
...(maxWidth !== null ? { maxWidth } : {}),
|
|
89
|
+
}, children: _jsx(SearchResults, { ...(props.enabled !== undefined ? { enabled: props.enabled } : {}), children: (bag) => (_jsxs(Flex, { vertical: true, gap: spacing[4], children: [_jsxs(Flex, { justify: "space-between", align: "center", wrap: true, gap: spacing[2], children: [_jsx(Typography.Title, { level: props.headingLevel ?? 4, style: { margin: 0 }, "data-testid": "search-results-heading", children: props.heading ?? t(SEARCH_I18N_KEYS.resultsTitle) }), _jsxs(Flex, { align: "center", wrap: true, gap: spacing[3], children: [_jsx(Count, { bag: bag }), props.toolbar] })] }), _jsx(DegradationNotice, { degradations: bag.degradations, variant: props.degradationNotice ?? "banner", scorerName: scorerName }), _jsx(LoadList, { state: bag.state, testId: "search", skeletonRows: 6, onRetry: bag.refetch, empty: _jsx(EmptyState, { title: t(SEARCH_I18N_KEYS.resultsEmpty), testId: "search-empty" }), failed: (error) => {
|
|
54
90
|
// The window refusal is a DIFFERENT sentence from a failed
|
|
55
91
|
// search, and both are different from "nothing found".
|
|
56
92
|
const isWindow = errorCode(error) === SEARCH_WINDOW_EXCEEDED;
|
|
57
|
-
return (_jsx(ErrorAlert, { testId: isWindow ? "search-window-exceeded" : "search-failed", error:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
: SEARCH_I18N_KEYS.resultsLoadFailed),
|
|
62
|
-
}, action: _jsx(Button, { size: "small", onClick: bag.refetch, "data-analytics": "none", "data-analytics-reason": "retry of a failed read; no flow to step", children: t(SEARCH_I18N_KEYS.resultsRetry) }) }));
|
|
63
|
-
},
|
|
64
|
-
empty: () => (_jsx(Empty, { "data-testid": "search-empty", description: t(SEARCH_I18N_KEYS.resultsEmpty) })),
|
|
65
|
-
ready: (items) => (_jsx("div", { "data-testid": "search-results", children: renderResults !== undefined ? (renderResults(items)) : (_jsx("div", { style: RESULTS_GRID, "data-testid": "search-results-grid", children: items.map((item) => (_jsx("div", { children: renderCard !== undefined ? (renderCard(item)) : (_jsx(SearchResultCard, { item: item })) }, item.key))) })) })),
|
|
66
|
-
}), _jsx(Pager, { bag: bag }), props.footer] })) }) }));
|
|
93
|
+
return (_jsx(ErrorAlert, { testId: isWindow ? "search-window-exceeded" : "search-failed", thrown: error, message: t(isWindow
|
|
94
|
+
? SEARCH_I18N_KEYS.resultsWindowExceeded
|
|
95
|
+
: SEARCH_I18N_KEYS.resultsLoadFailed), retryLabel: t(SEARCH_I18N_KEYS.resultsRetry), onRetry: bag.refetch }));
|
|
96
|
+
}, children: (items) => (_jsx("div", { "data-testid": "search-results", children: renderResults !== undefined ? (renderResults(items)) : (_jsx("div", { style: props.layout === "list" ? RESULTS_LIST : RESULTS_GRID, "data-testid": "search-results-grid", "data-layout": props.layout ?? "grid", children: items.map((item) => (_jsx("div", { children: renderCard !== undefined ? (renderCard(item)) : (_jsx(SearchResultCard, { item: item })) }, item.key))) })) })) }), _jsx(Pager, { bag: bag }), props.footer] })) }) }));
|
|
67
97
|
}
|
|
68
98
|
//# sourceMappingURL=SearchResultsPane.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchResultsPane.js","sourceRoot":"","sources":["../../src/default/SearchResultsPane.tsx"],"names":[],"mappings":";
|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H,CAAC;wBACJ,CAAC,YAEA,CAAC,KAAK,EAAE,EAAE,CAAC,CACV,6BAAiB,gBAAgB,YAC9B,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,CAC7B,aAAa,CAAC,KAAK,CAAC,CACrB,CAAC,CAAC,CAAC,CACF,cACE,KAAK,EAAE,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,iBAChD,qBAAqB,iBACpB,KAAK,CAAC,MAAM,IAAI,MAAM,YAElC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAgB,EAAE,EAAE,CAAC,CAC/B,wBACG,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,CAC1B,UAAU,CAAC,IAAI,CAAC,CACjB,CAAC,CAAC,CAAC,CACF,KAAC,gBAAgB,IAAC,IAAI,EAAE,IAAI,GAAI,CACjC,IALO,IAAI,CAAC,GAAG,CAMZ,CACP,CAAC,GACE,CACP,GACG,CACP,GACQ,EAEX,KAAC,KAAK,IAAC,GAAG,EAAE,GAAG,GAAI,EAClB,KAAK,CAAC,MAAM,IACR,CACR,GACa,GACN,CACb,CAAC;AACJ,CAAC"}
|
|
@@ -10,10 +10,18 @@
|
|
|
10
10
|
*
|
|
11
11
|
* `sort=distance` needs a centre — the server answers
|
|
12
12
|
* `error.400.search_sort_needs_center` without one. The option is therefore
|
|
13
|
-
* DISABLED
|
|
14
|
-
*
|
|
13
|
+
* DISABLED when no geo centre is set, and the REASON is rendered beside the
|
|
14
|
+
* control through `GatedControl`, not in a `title=` a phone can never surface.
|
|
15
|
+
* That is the whole defect this file used to carry: the one sort a person
|
|
16
|
+
* would most want on a phone was greyed out with its explanation in a hover.
|
|
15
17
|
*/
|
|
16
18
|
import type { ReactElement } from "react";
|
|
19
|
+
/**
|
|
20
|
+
* The select's floor width. Off the spacing scale on purpose and named for it:
|
|
21
|
+
* it is the width of the longest shipped sort label ("Price: low to high") at
|
|
22
|
+
* the default type step, so the control does not resize as the choice changes.
|
|
23
|
+
*/
|
|
24
|
+
export declare const SORT_SELECT_MIN_WIDTH = 200;
|
|
17
25
|
export interface SortSelectProps {
|
|
18
26
|
/** The sort the SERVER applied, shown when the URL names none. Omitted, it
|
|
19
27
|
* is read from the page already in cache — see {@link useAppliedSort}. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortSelect.d.ts","sourceRoot":"","sources":["../../src/default/SortSelect.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"SortSelect.d.ts","sourceRoot":"","sources":["../../src/default/SortSelect.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAY1C;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,MAAM,WAAW,eAAe;IAC9B;8EAC0E;IAC1E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3C;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,CAwD/D"}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Flex, Select, Typography } from "antd";
|
|
3
|
-
import { useT } from "@stapel/core";
|
|
3
|
+
import { actionAvailable, actionBlocked, useT } from "@stapel/core";
|
|
4
|
+
import { GatedControl } from "@stapel/tokens-antd/skin";
|
|
5
|
+
import { spacing } from "@stapel/tokens";
|
|
4
6
|
import { SEARCH_SORTS } from "../api/types.js";
|
|
5
7
|
import { useAppliedSort } from "../headless/useAppliedSort.js";
|
|
6
8
|
import { useSearchState } from "../headless/SearchStateProvider.js";
|
|
7
9
|
import { SEARCH_I18N_KEYS } from "../i18n/keys.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
import { sortLabelKey } from "./sortLabels.js";
|
|
11
|
+
/**
|
|
12
|
+
* The select's floor width. Off the spacing scale on purpose and named for it:
|
|
13
|
+
* it is the width of the longest shipped sort label ("Price: low to high") at
|
|
14
|
+
* the default type step, so the control does not resize as the choice changes.
|
|
15
|
+
*/
|
|
16
|
+
export const SORT_SELECT_MIN_WIDTH = 200;
|
|
15
17
|
export function SortSelect(props) {
|
|
16
18
|
const t = useT();
|
|
17
19
|
const { state, setSort } = useSearchState();
|
|
@@ -28,21 +30,22 @@ export function SortSelect(props) {
|
|
|
28
30
|
const values = active !== undefined && !known.has(active)
|
|
29
31
|
? [...SEARCH_SORTS, active]
|
|
30
32
|
: SEARCH_SORTS;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
:
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
// The gate is about ONE option, not the whole control — so the binding's
|
|
34
|
+
// `aria-describedby` is spread onto the select (a screen reader hears the
|
|
35
|
+
// reason with the control) and its `disabled` deliberately is not: the other
|
|
36
|
+
// four sorts work perfectly well without a location.
|
|
37
|
+
const distance = hasCentre
|
|
38
|
+
? actionAvailable()
|
|
39
|
+
: actionBlocked("error.400.search_sort_needs_center");
|
|
40
|
+
return (_jsx(GatedControl, { gate: distance, testId: "search-sort-gate", children: (bind) => (_jsxs(Flex, { gap: spacing[2], align: "center", children: [_jsx(Typography.Text, { type: "secondary", "aria-hidden": "true", children: t(SEARCH_I18N_KEYS.sortLabel) }), _jsx(Select, { "data-testid": "search-sort", "aria-label": t(SEARCH_I18N_KEYS.sortLabel), "aria-describedby": bind["aria-describedby"], style: { minWidth: SORT_SELECT_MIN_WIDTH }, value: active ?? null, onChange: (next) => {
|
|
41
|
+
setSort(next);
|
|
42
|
+
}, options: values.map((value) => {
|
|
43
|
+
const key = sortLabelKey(value);
|
|
44
|
+
return {
|
|
45
|
+
value,
|
|
46
|
+
label: key !== undefined ? t(key) : value,
|
|
47
|
+
disabled: value === "distance" && !hasCentre,
|
|
48
|
+
};
|
|
49
|
+
}) })] })) }));
|
|
47
50
|
}
|
|
48
51
|
//# sourceMappingURL=SortSelect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortSelect.js","sourceRoot":"","sources":["../../src/default/SortSelect.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"SortSelect.js","sourceRoot":"","sources":["../../src/default/SortSelect.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAQzC,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC;IACjB,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,cAAc,EAAE,CAAC;IAC5C,yEAAyE;IACzE,2EAA2E;IAC3E,wEAAwE;IACxE,2BAA2B;IAC3B,MAAM,OAAO,GAAG,cAAc,EAAE,CAA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AG,CAAC,CAAC,KAAK,EAAE,EAAE;wBAC5B,MAAM,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;wBAChC,OAAO;4BACL,KAAK;4BACL,KAAK,EAAE,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK;4BACzC,QAAQ,EAAE,KAAK,KAAK,UAAU,IAAI,CAAC,SAAS;yBAC7C,CAAC;oBACJ,CAAC,CAAC,GACF,IACG,CACR,GACY,CAChB,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UrlIssueNotice.d.ts","sourceRoot":"","sources":["../../src/default/UrlIssueNotice.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"UrlIssueNotice.d.ts","sourceRoot":"","sources":["../../src/default/UrlIssueNotice.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAwB1C,wBAAgB,cAAc,IAAI,YAAY,GAAG,IAAI,CAqBpD"}
|
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Alert } from "antd";
|
|
3
|
+
import { spacing } from "@stapel/tokens";
|
|
3
4
|
import { useT } from "@stapel/core";
|
|
5
|
+
import { FILTER_PREFIX, RANGE_PREFIX } from "../state/urlState.js";
|
|
4
6
|
import { useSearchState } from "../headless/SearchStateProvider.js";
|
|
5
7
|
import { SEARCH_I18N_KEYS } from "../i18n/keys.js";
|
|
8
|
+
/**
|
|
9
|
+
* The parameter as a person can recognise it.
|
|
10
|
+
*
|
|
11
|
+
* The codec reports the WIRE name, which for a facet or a range carries the
|
|
12
|
+
* prefix that tells the backend which family it belongs to (`r.price`,
|
|
13
|
+
* `f.brand`). That prefix is a protocol detail: the sentence is read by
|
|
14
|
+
* somebody who followed a link, and "price" is the part of `r.price` they
|
|
15
|
+
* have any chance of recognising.
|
|
16
|
+
*/
|
|
17
|
+
function readableParam(param) {
|
|
18
|
+
for (const prefix of [RANGE_PREFIX, FILTER_PREFIX]) {
|
|
19
|
+
if (param.startsWith(prefix))
|
|
20
|
+
return param.slice(prefix.length);
|
|
21
|
+
}
|
|
22
|
+
return param;
|
|
23
|
+
}
|
|
6
24
|
export function UrlIssueNotice() {
|
|
7
25
|
const t = useT();
|
|
8
26
|
const { issues } = useSearchState();
|
|
9
27
|
if (issues.length === 0)
|
|
10
28
|
return null;
|
|
11
|
-
return (_jsx(Alert, { type: "warning", showIcon: true, "data-testid": "search-url-issues",
|
|
29
|
+
return (_jsx(Alert, { type: "warning", showIcon: true, "data-testid": "search-url-issues", title: t(SEARCH_I18N_KEYS.urlIssuesTitle), description: _jsx("ul", { style: { margin: 0, paddingInlineStart: spacing[5] }, children: issues.map((issue) => (_jsx("li", { children: t(issue.messageKey, { param: readableParam(issue.param) }) }, `${issue.param}:${issue.code}`))) }) }));
|
|
12
30
|
}
|
|
13
31
|
//# sourceMappingURL=UrlIssueNotice.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UrlIssueNotice.js","sourceRoot":"","sources":["../../src/default/UrlIssueNotice.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,UAAU,cAAc;IAC5B,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,CAAC;IACpC,IAAI,MAAM,CAAC,MAAM,KAAK,C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,EAAE,YACrD,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACrB,uBACG,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,IADpD,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,CAElC,CACN,CAAC,GACC,GAEP,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<ViewSwitch>` — how the results are ARRANGED: a list, a grid, or something
|
|
3
|
+
* the deployment brought with it.
|
|
4
|
+
*
|
|
5
|
+
* ## Why two of the three views ship and the third is a slot
|
|
6
|
+
*
|
|
7
|
+
* A list and a grid are the SAME data in two arrangements: one column of wide
|
|
8
|
+
* rows, or as many card columns as fit. That is a layout decision and a search
|
|
9
|
+
* pair can take it. A MAP is not — it needs a tile source, a projection, a
|
|
10
|
+
* marker layer and a geocoder, all of which live in `geo-react` and none of
|
|
11
|
+
* which a search package may depend on. So the third view arrives as a
|
|
12
|
+
* {@link SearchView} the host declares, with its own `render`, and this
|
|
13
|
+
* component treats it exactly like the two it ships. A pair that hardcoded a
|
|
14
|
+
* "map" button and then had nothing to draw would be offering a control that
|
|
15
|
+
* cannot work — the defect class the fleet calls a silent slot.
|
|
16
|
+
*
|
|
17
|
+
* ## The view is not URL state, and that is deliberate
|
|
18
|
+
*
|
|
19
|
+
* `sort`, `page size`, every filter and the cursor are in the query string,
|
|
20
|
+
* because they change WHAT the answer is and a shared link has to carry them.
|
|
21
|
+
* The view changes only how the same answer is drawn. Putting it in the URL
|
|
22
|
+
* would make every arrangement flip a new history entry and would rewrite the
|
|
23
|
+
* meaning of a link somebody sent. The page holds it in component state and
|
|
24
|
+
* offers `defaultView`/`onViewChange` so a host that wants it remembered can
|
|
25
|
+
* persist it wherever it keeps preferences.
|
|
26
|
+
*/
|
|
27
|
+
import type { ReactElement, ReactNode } from "react";
|
|
28
|
+
import type { SearchResultsRenderer } from "./SearchResultsPane.js";
|
|
29
|
+
/** How the pane's own arrangements lay a page of results out. */
|
|
30
|
+
export type SearchResultsLayout = "grid" | "list";
|
|
31
|
+
/** One arrangement offered by the switch. */
|
|
32
|
+
export interface SearchView {
|
|
33
|
+
/** Stable id — what `defaultView`/`onViewChange` speak in. */
|
|
34
|
+
readonly id: string;
|
|
35
|
+
/** i18n KEY for the view's name (never a literal: the switch is chrome). */
|
|
36
|
+
readonly labelKey: string;
|
|
37
|
+
/** The glyph beside the name. Omitted, the name stands alone. */
|
|
38
|
+
readonly icon?: ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* One of the pane's own arrangements. Ignored when {@link SearchView.render}
|
|
41
|
+
* is present, which replaces the arrangement entirely.
|
|
42
|
+
*/
|
|
43
|
+
readonly layout?: SearchResultsLayout;
|
|
44
|
+
/**
|
|
45
|
+
* The whole result surface, for a view the pair cannot draw — a map, a
|
|
46
|
+
* comparison table. It receives the loaded rows; the pane keeps its four
|
|
47
|
+
* load arms around it, so "nothing found" and "we could not run this search"
|
|
48
|
+
* stay the pane's sentences rather than the slot's problem.
|
|
49
|
+
*/
|
|
50
|
+
readonly render?: SearchResultsRenderer;
|
|
51
|
+
}
|
|
52
|
+
/** The two arrangements the pair itself can draw. */
|
|
53
|
+
export declare const SEARCH_BUILTIN_VIEWS: readonly SearchView[];
|
|
54
|
+
/** The view `id` currently in force, or the first offered one. */
|
|
55
|
+
export declare function resolveView(views: readonly SearchView[], id: string | undefined): SearchView | undefined;
|
|
56
|
+
export interface ViewSwitchProps {
|
|
57
|
+
readonly views: readonly SearchView[];
|
|
58
|
+
readonly value: string;
|
|
59
|
+
readonly onChange: (id: string) => void;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The switch itself. Renders nothing for a single view: a control offering one
|
|
63
|
+
* choice is not a control, it is a label that can be clicked.
|
|
64
|
+
*/
|
|
65
|
+
export declare function ViewSwitch(props: ViewSwitchProps): ReactElement | null;
|
|
66
|
+
//# sourceMappingURL=ViewSwitch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ViewSwitch.d.ts","sourceRoot":"","sources":["../../src/default/ViewSwitch.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIrD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE,iEAAiE;AACjE,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,CAAC;AAElD,6CAA6C;AAC7C,MAAM,WAAW,UAAU;IACzB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,iEAAiE;IACjE,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,CAAC;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,qBAAqB,CAAC;CACzC;AAyCD,qDAAqD;AACrD,eAAO,MAAM,oBAAoB,EAAE,SAAS,UAAU,EAarD,CAAC;AAEF,kEAAkE;AAClE,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,EAAE,EAAE,MAAM,GAAG,SAAS,GACrB,UAAU,GAAG,SAAS,CAExB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,GAAG,IAAI,CAgBtE"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Segmented } from "antd";
|
|
3
|
+
import { useT } from "@stapel/core";
|
|
4
|
+
import { SEARCH_I18N_KEYS } from "../i18n/keys.js";
|
|
5
|
+
/** Rows — one wide row per result, the arrangement a scan reads fastest. */
|
|
6
|
+
function ListGlyph() {
|
|
7
|
+
return (_jsx(ViewGlyph, { children: _jsx("path", { d: "M4 6.5h16M4 12h16M4 17.5h16" }) }));
|
|
8
|
+
}
|
|
9
|
+
/** Cards — as many columns as fit. */
|
|
10
|
+
function GridGlyph() {
|
|
11
|
+
return (_jsxs(ViewGlyph, { children: [_jsx("rect", { x: "4", y: "4", width: "7", height: "7", rx: "1.5" }), _jsx("rect", { x: "13", y: "4", width: "7", height: "7", rx: "1.5" }), _jsx("rect", { x: "4", y: "13", width: "7", height: "7", rx: "1.5" }), _jsx("rect", { x: "13", y: "13", width: "7", height: "7", rx: "1.5" })] }));
|
|
12
|
+
}
|
|
13
|
+
function ViewGlyph(props) {
|
|
14
|
+
return (_jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", role: "img", "aria-hidden": "true", children: props.children }));
|
|
15
|
+
}
|
|
16
|
+
/** The two arrangements the pair itself can draw. */
|
|
17
|
+
export const SEARCH_BUILTIN_VIEWS = [
|
|
18
|
+
{
|
|
19
|
+
id: "list",
|
|
20
|
+
labelKey: SEARCH_I18N_KEYS.viewList,
|
|
21
|
+
icon: _jsx(ListGlyph, {}),
|
|
22
|
+
layout: "list",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "grid",
|
|
26
|
+
labelKey: SEARCH_I18N_KEYS.viewGrid,
|
|
27
|
+
icon: _jsx(GridGlyph, {}),
|
|
28
|
+
layout: "grid",
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
/** The view `id` currently in force, or the first offered one. */
|
|
32
|
+
export function resolveView(views, id) {
|
|
33
|
+
return views.find((view) => view.id === id) ?? views[0];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The switch itself. Renders nothing for a single view: a control offering one
|
|
37
|
+
* choice is not a control, it is a label that can be clicked.
|
|
38
|
+
*/
|
|
39
|
+
export function ViewSwitch(props) {
|
|
40
|
+
const t = useT();
|
|
41
|
+
if (props.views.length < 2)
|
|
42
|
+
return null;
|
|
43
|
+
return (_jsx(Segmented, { "aria-label": t(SEARCH_I18N_KEYS.viewLabel), value: props.value, "data-testid": "search-view-switch", onChange: props.onChange, options: props.views.map((view) => ({
|
|
44
|
+
value: view.id,
|
|
45
|
+
label: t(view.labelKey),
|
|
46
|
+
...(view.icon !== undefined ? { icon: view.icon } : {}),
|
|
47
|
+
})) }));
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=ViewSwitch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ViewSwitch.js","sourceRoot":"","sources":["../../src/default/ViewSwitch.tsx"],"names":[],"mappings":";AA2BA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AA4BnD,4EAA4E;AAC5E,SAAS,SAAS;IAChB,OAAO,CACL,KAAC,SAAS,cACR,eAAM,CAAC,EAAC,6BAA6B,GAAG,GAC9B,CACb,CAAC;AACJ,CAAC;AAED,sCAAsC;AACtC,SAAS,SAAS;IAChB,OAAO,CACL,MAAC,SAAS,eACR,eAAM,CAAC,EAAC,GAAG,EAAC,CAAC,EAAC,GAAG,EAAC,KAAK,EAAC,GAAG,EAAC,MAAM,EAAC,GAAG,EAAC,EAAE,EAAC,KAAK,GAAG,EAClD,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,CAAC,CAAC,CAAC,CAAC;AAC1D,CAAC;AAQD;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC;IACjB,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACxC,OAAO,CACL,KAAC,SAAS,kBACI,CAAC,CAAC,gBAAgB,CAAC,SAAS,CAAC,EACzC,KAAK,EAAE,KAAK,CAAC,KAAK,iBACN,oBAAoB,EAChC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAClC,KAAK,EAAE,IAAI,CAAC,EAAE;YACd,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;YACvB,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACxD,CAAC,CAAC,GACH,CACH,CAAC;AACJ,CAAC"}
|
package/dist/default/index.d.ts
CHANGED
|
@@ -6,37 +6,60 @@
|
|
|
6
6
|
* never pays for this bundle (enforced by size-limit and the bundle-purity
|
|
7
7
|
* test).
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Five override levers, none of which requires forking anything:
|
|
10
10
|
*
|
|
11
11
|
* 1. **`renderCard`** — the card slot. A storefront passes
|
|
12
12
|
* `<ListingCard>` from `@stapel/listings-react/default`; the generic card
|
|
13
13
|
* here is the documented default, not the intended end state (spec §3.7).
|
|
14
14
|
* `renderResults` is the level above it: the whole layout, for a container
|
|
15
15
|
* whose arrangement is not "cards in a grid".
|
|
16
|
-
* 2. **`categoryFeatures`** — the facet-label slot
|
|
17
|
-
* `{value: count}` and no
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
16
|
+
* 2. **`categoryFeatures`** — the facet-label slot, and the source of which
|
|
17
|
+
* slugs get a numeric range row. The server sends `{value: count}` and no
|
|
18
|
+
* labels; the schema that names them lives in categories, and the
|
|
19
|
+
* container hands it in (spec §6.2 item 2).
|
|
20
|
+
* 3. **`renderCategoryFilter`** — the catalogue picker. `categories-react`
|
|
21
|
+
* owns walking the tree; this pair owns the `category` parameter.
|
|
22
|
+
* 4. **`renderGeoFilter`** — the location control. `geo-react` owns the map
|
|
23
|
+
* and the geocoder; this pair owns `lat`/`lon`/`radius_km`/`bbox`, and
|
|
24
|
+
* keeps the controls that WIDEN a location a link already carries.
|
|
25
|
+
* 5. **retheming through the §68 token JSON** — every surface wraps itself
|
|
26
|
+
* in the shared `SkinTheme`, so a host's regenerated `--stapel-*` custom
|
|
21
27
|
* properties reach this skin with zero code.
|
|
28
|
+
*
|
|
29
|
+
* The pair's own `theme.tsx` and `ErrorAlert.tsx` are GONE as of 0.6.0: both
|
|
30
|
+
* were copies of a decision now stated once in `@stapel/tokens-antd/skin`
|
|
31
|
+
* (`SkinTheme`, `ErrorAlert`). A host that imported `SearchSkinTheme` imports
|
|
32
|
+
* `SkinTheme` from the substrate instead — same props, one implementation, and
|
|
33
|
+
* a runtime `data-theme` flip actually repaints it.
|
|
22
34
|
*/
|
|
23
35
|
export { SearchPage } from "./SearchPage.js";
|
|
24
|
-
export type { SearchPageProps } from "./SearchPage.js";
|
|
25
|
-
export { SearchResultsPane } from "./SearchResultsPane.js";
|
|
36
|
+
export type { SearchPageProps, SearchFiltersLayout } from "./SearchPage.js";
|
|
37
|
+
export { SearchResultsPane, RESULTS_MAX_WIDTH } from "./SearchResultsPane.js";
|
|
26
38
|
export type { SearchResultsPaneProps, SearchResultsRenderer, } from "./SearchResultsPane.js";
|
|
39
|
+
export { FilterChips, CHIP_ROW_CLASS, CHIP_ROW_STYLE_HREF, chipRowCss } from "./FilterChips.js";
|
|
40
|
+
export type { FilterChipsProps } from "./FilterChips.js";
|
|
41
|
+
export { FacetGroupControl, facetGroupShape, facetOptionNodes, FACET_VISIBLE_OPTIONS, } from "./FacetGroupControl.js";
|
|
42
|
+
export type { FacetGroupControlProps, FacetGroupShape, FacetOptionNode, } from "./FacetGroupControl.js";
|
|
27
43
|
export { FacetPanelPane } from "./FacetPanelPane.js";
|
|
28
|
-
export type { FacetPanelPaneProps } from "./FacetPanelPane.js";
|
|
29
|
-
export { RankingDisclosurePane } from "./RankingDisclosurePane.js";
|
|
44
|
+
export type { FacetPanelPaneProps, CategoryFilterSlotProps, GeoFilterSlotProps, } from "./FacetPanelPane.js";
|
|
45
|
+
export { RankingDisclosurePane, RANKING_MAX_WIDTH } from "./RankingDisclosurePane.js";
|
|
30
46
|
export type { RankingDisclosurePaneProps } from "./RankingDisclosurePane.js";
|
|
47
|
+
export { SearchBox } from "./SearchBox.js";
|
|
48
|
+
export type { SearchBoxProps } from "./SearchBox.js";
|
|
49
|
+
export { SortSelect, SORT_SELECT_MIN_WIDTH } from "./SortSelect.js";
|
|
50
|
+
export type { SortSelectProps } from "./SortSelect.js";
|
|
51
|
+
export { ViewSwitch, SEARCH_BUILTIN_VIEWS, resolveView } from "./ViewSwitch.js";
|
|
52
|
+
export type { ViewSwitchProps, SearchView, SearchResultsLayout } from "./ViewSwitch.js";
|
|
53
|
+
export { PageSizeSelect, SEARCH_PAGE_SIZES } from "./PageSizeSelect.js";
|
|
54
|
+
export type { PageSizeSelectProps } from "./PageSizeSelect.js";
|
|
55
|
+
export { LanguageSelect } from "./LanguageSelect.js";
|
|
56
|
+
export type { LanguageSelectProps } from "./LanguageSelect.js";
|
|
31
57
|
export { SearchResultCard, GENERIC_CARD_FIELDS } from "./SearchResultCard.js";
|
|
32
58
|
export type { SearchCardProps, SearchCardRenderer } from "./SearchResultCard.js";
|
|
33
59
|
export { DegradationNotice } from "./DegradationNotice.js";
|
|
34
60
|
export type { DegradationNoticeProps, DegradationNoticeVariant, } from "./DegradationNotice.js";
|
|
35
61
|
export { UrlIssueNotice } from "./UrlIssueNotice.js";
|
|
36
|
-
export {
|
|
37
|
-
export type {
|
|
38
|
-
export { ErrorAlert } from "./ErrorAlert.js";
|
|
39
|
-
export { SearchSkinTheme } from "./theme.js";
|
|
40
|
-
export type { SearchSkinThemeProps } from "./theme.js";
|
|
62
|
+
export { RangeFilterRow } from "./RangeFilterRow.js";
|
|
63
|
+
export type { RangeFilterRowProps } from "./RangeFilterRow.js";
|
|
41
64
|
export type { ThemeModeProp } from "./types.js";
|
|
42
65
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/default/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/default/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE5E,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC9E,YAAY,EACV,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAChG,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,sBAAsB,EACtB,eAAe,EACf,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EACV,mBAAmB,EACnB,uBAA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/index.js
CHANGED
|
@@ -6,31 +6,48 @@
|
|
|
6
6
|
* never pays for this bundle (enforced by size-limit and the bundle-purity
|
|
7
7
|
* test).
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Five override levers, none of which requires forking anything:
|
|
10
10
|
*
|
|
11
11
|
* 1. **`renderCard`** — the card slot. A storefront passes
|
|
12
12
|
* `<ListingCard>` from `@stapel/listings-react/default`; the generic card
|
|
13
13
|
* here is the documented default, not the intended end state (spec §3.7).
|
|
14
14
|
* `renderResults` is the level above it: the whole layout, for a container
|
|
15
15
|
* whose arrangement is not "cards in a grid".
|
|
16
|
-
* 2. **`categoryFeatures`** — the facet-label slot
|
|
17
|
-
* `{value: count}` and no
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
16
|
+
* 2. **`categoryFeatures`** — the facet-label slot, and the source of which
|
|
17
|
+
* slugs get a numeric range row. The server sends `{value: count}` and no
|
|
18
|
+
* labels; the schema that names them lives in categories, and the
|
|
19
|
+
* container hands it in (spec §6.2 item 2).
|
|
20
|
+
* 3. **`renderCategoryFilter`** — the catalogue picker. `categories-react`
|
|
21
|
+
* owns walking the tree; this pair owns the `category` parameter.
|
|
22
|
+
* 4. **`renderGeoFilter`** — the location control. `geo-react` owns the map
|
|
23
|
+
* and the geocoder; this pair owns `lat`/`lon`/`radius_km`/`bbox`, and
|
|
24
|
+
* keeps the controls that WIDEN a location a link already carries.
|
|
25
|
+
* 5. **retheming through the §68 token JSON** — every surface wraps itself
|
|
26
|
+
* in the shared `SkinTheme`, so a host's regenerated `--stapel-*` custom
|
|
21
27
|
* properties reach this skin with zero code.
|
|
28
|
+
*
|
|
29
|
+
* The pair's own `theme.tsx` and `ErrorAlert.tsx` are GONE as of 0.6.0: both
|
|
30
|
+
* were copies of a decision now stated once in `@stapel/tokens-antd/skin`
|
|
31
|
+
* (`SkinTheme`, `ErrorAlert`). A host that imported `SearchSkinTheme` imports
|
|
32
|
+
* `SkinTheme` from the substrate instead — same props, one implementation, and
|
|
33
|
+
* a runtime `data-theme` flip actually repaints it.
|
|
22
34
|
*/
|
|
23
35
|
// ── surfaces ────────────────────────────────────────────────────────────────
|
|
24
36
|
export { SearchPage } from "./SearchPage.js";
|
|
25
|
-
export { SearchResultsPane } from "./SearchResultsPane.js";
|
|
37
|
+
export { SearchResultsPane, RESULTS_MAX_WIDTH } from "./SearchResultsPane.js";
|
|
38
|
+
export { FilterChips, CHIP_ROW_CLASS, CHIP_ROW_STYLE_HREF, chipRowCss } from "./FilterChips.js";
|
|
39
|
+
export { FacetGroupControl, facetGroupShape, facetOptionNodes, FACET_VISIBLE_OPTIONS, } from "./FacetGroupControl.js";
|
|
26
40
|
export { FacetPanelPane } from "./FacetPanelPane.js";
|
|
27
|
-
export { RankingDisclosurePane } from "./RankingDisclosurePane.js";
|
|
41
|
+
export { RankingDisclosurePane, RANKING_MAX_WIDTH } from "./RankingDisclosurePane.js";
|
|
42
|
+
// ── controls, exported so a host can compose its own layout ─────────────────
|
|
43
|
+
export { SearchBox } from "./SearchBox.js";
|
|
44
|
+
export { SortSelect, SORT_SELECT_MIN_WIDTH } from "./SortSelect.js";
|
|
45
|
+
export { ViewSwitch, SEARCH_BUILTIN_VIEWS, resolveView } from "./ViewSwitch.js";
|
|
46
|
+
export { PageSizeSelect, SEARCH_PAGE_SIZES } from "./PageSizeSelect.js";
|
|
47
|
+
export { LanguageSelect } from "./LanguageSelect.js";
|
|
28
48
|
// ── parts, exported so a host can compose or wrap one ───────────────────────
|
|
29
49
|
export { SearchResultCard, GENERIC_CARD_FIELDS } from "./SearchResultCard.js";
|
|
30
50
|
export { DegradationNotice } from "./DegradationNotice.js";
|
|
31
51
|
export { UrlIssueNotice } from "./UrlIssueNotice.js";
|
|
32
|
-
export {
|
|
33
|
-
export { ErrorAlert } from "./ErrorAlert.js";
|
|
34
|
-
// ── theming ─────────────────────────────────────────────────────────────────
|
|
35
|
-
export { SearchSkinTheme } from "./theme.js";
|
|
52
|
+
export { RangeFilterRow } from "./RangeFilterRow.js";
|
|
36
53
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/default/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/default/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,+EAA+E;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAM9E,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGhG,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAOhC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAOrD,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAGtF,+EAA+E;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEhF,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,+EAA+E;AAC/E,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAK3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|