@eifi1/ui-kit 0.16.0 → 0.17.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/README.md +7 -7
- package/dist/chart.d.ts +1 -1
- package/dist/components/amount-input.d.ts +9 -1
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/button-group.d.ts +1 -1
- package/dist/components/calculator.d.ts +1 -1
- package/dist/components/copy-button.d.ts +1 -1
- package/dist/components/data-table-cells.d.ts +1 -1
- package/dist/components/data-table-filter-popover.d.ts +1 -1
- package/dist/components/data-table-filters.d.ts +1 -1
- package/dist/components/data-table.d.ts +1 -1
- package/dist/components/data-table.js +91 -3
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/facing-pair.d.ts +1 -1
- package/dist/components/file-button.d.ts +1 -1
- package/dist/components/file-button.js +7 -4
- package/dist/components/file-button.js.map +1 -1
- package/dist/components/file-dropzone.d.ts +1 -1
- package/dist/components/form-actions.d.ts +1 -1
- package/dist/components/form-actions.js +32 -1
- package/dist/components/form-actions.js.map +1 -1
- package/dist/components/line-items.d.ts +30 -6
- package/dist/components/line-items.js +77 -33
- package/dist/components/line-items.js.map +1 -1
- package/dist/components/list.d.ts +13 -1
- package/dist/components/list.js.map +1 -1
- package/dist/components/money-field.d.ts +1 -1
- package/dist/components/number-field.d.ts +1 -1
- package/dist/components/number-input.d.ts +1 -1
- package/dist/components/numpad-sheet.d.ts +1 -1
- package/dist/components/progress-bar.d.ts +11 -1
- package/dist/components/progress-bar.js +14 -4
- package/dist/components/progress-bar.js.map +1 -1
- package/dist/components/series-chart.d.ts +1 -1
- package/dist/components/settings-fields.d.ts +1 -1
- package/dist/components/signed-amount.d.ts +12 -3
- package/dist/components/signed-amount.js +6 -4
- package/dist/components/signed-amount.js.map +1 -1
- package/dist/components/text-link.d.ts +1 -1
- package/dist/components/time-input.d.ts +1 -1
- package/dist/components/ui.d.ts +1 -1
- package/dist/components/ui.js +25 -3
- package/dist/components/ui.js.map +1 -1
- package/dist/components/use-table-state.d.ts +1 -1
- package/dist/{data-table-CfVXtCeG.d.ts → data-table-CpkWUJBY.d.ts} +41 -1
- package/dist/data-table.d.ts +1 -1
- package/dist/hooks/use-file-drop.d.ts +1 -1
- package/dist/i18n/defaults.d.ts +1 -1
- package/dist/i18n/kit-labels.d.ts +1 -1
- package/dist/i18n/locales/de-CH-informal.d.ts +1 -1
- package/dist/i18n/locales/de-CH.d.ts +1 -1
- package/dist/i18n/locales/de-informal.d.ts +1 -1
- package/dist/i18n/locales/de.d.ts +1 -1
- package/dist/i18n/locales/en.d.ts +71 -0
- package/dist/i18n/locales/en.js +95 -0
- package/dist/i18n/locales/en.js.map +1 -0
- package/dist/i18n/locales/es.d.ts +1 -1
- package/dist/i18n/locales/fr.d.ts +1 -1
- package/dist/i18n/locales/hu.d.ts +1 -1
- package/dist/i18n/locales/it.d.ts +1 -1
- package/dist/i18n/locales/zh.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/{kit-labels-DE--LmCk.d.ts → kit-labels-C4uB_zmg.d.ts} +57 -5
- package/dist/rhf/fields.d.ts +1 -1
- package/dist/rhf/form.d.ts +1 -1
- package/dist/rhf/line-items.js.map +1 -1
- package/dist/rhf.d.ts +1 -1
- package/dist/search/global-search.d.ts +22 -4
- package/dist/search/global-search.js +31 -3
- package/dist/search/global-search.js.map +1 -1
- package/dist/search.d.ts +1 -1
- package/dist/shell/app-shell.d.ts +1 -1
- package/dist/shell/top-bar-brand.d.ts +1 -1
- package/dist/shell.d.ts +1 -1
- package/dist/wizard/stepper-nav.d.ts +1 -1
- package/dist/wizard.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/amount-input.tsx +8 -0
- package/src/components/data-table.tsx +165 -3
- package/src/components/file-button.tsx +12 -4
- package/src/components/form-actions.tsx +73 -3
- package/src/components/line-items.tsx +116 -40
- package/src/components/list.tsx +13 -1
- package/src/components/progress-bar.tsx +20 -4
- package/src/components/signed-amount.tsx +16 -5
- package/src/components/ui.tsx +57 -3
- package/src/i18n/locales/en.ts +116 -0
- package/src/rhf/line-items.tsx +2 -1
- package/src/search/global-search.tsx +57 -6
|
@@ -26,8 +26,20 @@ declare const DEFAULT_GLOBAL_SEARCH_LABELS: GlobalSearchLabels;
|
|
|
26
26
|
interface GlobalSearchSource {
|
|
27
27
|
/** Stable key — the effect that runs the source is keyed by it, not by identity. */
|
|
28
28
|
id: string;
|
|
29
|
-
/** The group its results are shown under (an entry's own `group` is ignored)
|
|
29
|
+
/** The group its results are shown under (an entry's own `group` is ignored) — unless
|
|
30
|
+
* `groups` is set, where it is only the home of entries that name no declared group. */
|
|
30
31
|
group: string;
|
|
32
|
+
/**
|
|
33
|
+
* Split ONE request into several groups — kastlan's record search answers with
|
|
34
|
+
* properties, units, contacts, leases and invoices at once, and one source per group
|
|
35
|
+
* meant a dedupe layer so the network still saw one request. Each entry is then shown
|
|
36
|
+
* under the group its own `group` names: a declared `key` (shown by its `label`) or a
|
|
37
|
+
* plain string (key and heading at once). The groups appear in THIS order whatever the
|
|
38
|
+
* answer's order, each kept to `limit` rows; an entry naming no declared group falls
|
|
39
|
+
* under `group`. While the request runs, or when it fails, the source shows one status
|
|
40
|
+
* line under its first group, not one per group. Unset: one group, as before.
|
|
41
|
+
*/
|
|
42
|
+
groups?: readonly (string | GlobalSearchSourceGroup)[];
|
|
31
43
|
/** Called with the trimmed query. Its results are shown AS GIVEN — the source ranked
|
|
32
44
|
* them — and never re-filtered by the index's matcher. `signal` aborts when the query
|
|
33
45
|
* moves on or the palette closes; a stale answer is dropped either way. */
|
|
@@ -36,7 +48,7 @@ interface GlobalSearchSource {
|
|
|
36
48
|
minChars?: number;
|
|
37
49
|
/** Quiet period after the last keystroke before it is asked. Default 200ms. */
|
|
38
50
|
debounceMs?: number;
|
|
39
|
-
/** Rows kept. Default: `indexOptions.groupLimit` (8). */
|
|
51
|
+
/** Rows kept — per group, when `groups` is set. Default: `indexOptions.groupLimit` (8). */
|
|
40
52
|
limit?: number;
|
|
41
53
|
/** Mask every row of this source for session replay, hints (amounts) included. An
|
|
42
54
|
* entry's own `redact` still wins. */
|
|
@@ -45,6 +57,12 @@ interface GlobalSearchSource {
|
|
|
45
57
|
* shows the palette's `error` line instead of rows. */
|
|
46
58
|
onError?: (error: unknown) => void;
|
|
47
59
|
}
|
|
60
|
+
/** One of a multi-group source's groups: the `key` its entries name in `group`, and the
|
|
61
|
+
* heading shown — so a server's type ("unit") need not be translated per entry. */
|
|
62
|
+
interface GlobalSearchSourceGroup {
|
|
63
|
+
key: string;
|
|
64
|
+
label: string;
|
|
65
|
+
}
|
|
48
66
|
/** What a custom trigger gets: everything the default button uses. */
|
|
49
67
|
interface GlobalSearchTriggerProps {
|
|
50
68
|
open: () => void;
|
|
@@ -73,7 +91,7 @@ interface GlobalSearchProps {
|
|
|
73
91
|
* neither re-indexes nor loops, and the icons and handlers used are always the latest.
|
|
74
92
|
*/
|
|
75
93
|
entries?: readonly SearchEntry[];
|
|
76
|
-
/** The async sources, each streamed into its own group. */
|
|
94
|
+
/** The async sources, each streamed into its own group — or several (`groups`). */
|
|
77
95
|
sources?: readonly GlobalSearchSource[];
|
|
78
96
|
/** What the empty query shows, under the `suggestions` heading. */
|
|
79
97
|
suggestions?: readonly GlobalSearchSuggestion[];
|
|
@@ -163,4 +181,4 @@ interface GlobalSearchProps {
|
|
|
163
181
|
*/
|
|
164
182
|
declare function GlobalSearch(props: GlobalSearchProps): react.JSX.Element;
|
|
165
183
|
|
|
166
|
-
export { DEFAULT_GLOBAL_SEARCH_LABELS, GlobalSearch, type GlobalSearchLabels, type GlobalSearchProps, type GlobalSearchSource, type GlobalSearchSuggestion, type GlobalSearchTriggerProps };
|
|
184
|
+
export { DEFAULT_GLOBAL_SEARCH_LABELS, GlobalSearch, type GlobalSearchLabels, type GlobalSearchProps, type GlobalSearchSource, type GlobalSearchSourceGroup, type GlobalSearchSuggestion, type GlobalSearchTriggerProps };
|
|
@@ -111,7 +111,17 @@ function GlobalSearchImpl({
|
|
|
111
111
|
const groupLimit = indexOptions?.groupLimit ?? 8;
|
|
112
112
|
const index = useMemo(() => createSearchIndex(list, indexOptions), [sig, optionsKey]);
|
|
113
113
|
const byId = useMemo(() => new Map(list.map((e) => [e.id, e])), [sig]);
|
|
114
|
-
const sourceKey = (sources ?? []).map(
|
|
114
|
+
const sourceKey = (sources ?? []).map(
|
|
115
|
+
(s) => [
|
|
116
|
+
s.id,
|
|
117
|
+
s.group,
|
|
118
|
+
(s.groups ?? []).map((g) => typeof g === "string" ? g : `${g.key}${g.label}`).join(""),
|
|
119
|
+
s.minChars ?? 2,
|
|
120
|
+
s.debounceMs ?? 200,
|
|
121
|
+
s.limit,
|
|
122
|
+
s.redact
|
|
123
|
+
].join("")
|
|
124
|
+
).join("");
|
|
115
125
|
const sourceList = useMemo(() => sources ?? [], [sourceKey]);
|
|
116
126
|
const suggestionsKey = (suggestions ?? []).map((s) => typeof s === "string" ? `i:${s}` : "query" in s ? `q:${s.query}` : `e:${signature([s])}`).join("");
|
|
117
127
|
const suggestionList = useMemo(() => suggestions ?? [], [suggestionsKey]);
|
|
@@ -204,10 +214,12 @@ function GlobalSearchImpl({
|
|
|
204
214
|
for (const source of sourceList) {
|
|
205
215
|
if (q.length < (source.minChars ?? 2)) continue;
|
|
206
216
|
const result = sourceResults[source.id];
|
|
217
|
+
const declared = (source.groups ?? []).map((g) => typeof g === "string" ? { key: g, label: g } : g);
|
|
207
218
|
const status = (label, icon) => ({
|
|
208
219
|
id: `src:${source.id}:status`,
|
|
209
220
|
label,
|
|
210
|
-
group
|
|
221
|
+
// One line for the one request, under the group that will head its answer.
|
|
222
|
+
group: declared[0]?.label ?? source.group,
|
|
211
223
|
icon,
|
|
212
224
|
kind: "status",
|
|
213
225
|
onSelect: noop
|
|
@@ -216,10 +228,26 @@ function GlobalSearchImpl({
|
|
|
216
228
|
out.push(status(pl.loading, /* @__PURE__ */ jsx(Loader2, { className: "size-3.5 animate-spin" })));
|
|
217
229
|
} else if (result.status === "error") {
|
|
218
230
|
out.push(status(pl.error ?? DEFAULT_COMMAND_PALETTE_LABELS.error, /* @__PURE__ */ jsx(AlertCircle, { className: "size-3.5" })));
|
|
219
|
-
} else {
|
|
231
|
+
} else if (!declared.length) {
|
|
220
232
|
for (const entry of result.entries.slice(0, source.limit ?? groupLimit)) {
|
|
221
233
|
out.push(toItem(`src:${source.id}:`, entry, source.group, source.redact ?? redactLabels));
|
|
222
234
|
}
|
|
235
|
+
} else {
|
|
236
|
+
const buckets = /* @__PURE__ */ new Map();
|
|
237
|
+
for (const g of declared) buckets.set(g.key, { label: g.label, entries: [] });
|
|
238
|
+
const rest = [];
|
|
239
|
+
for (const entry of result.entries) {
|
|
240
|
+
const bucket = entry.group === void 0 ? void 0 : buckets.get(entry.group);
|
|
241
|
+
(bucket ? bucket.entries : rest).push(entry);
|
|
242
|
+
}
|
|
243
|
+
const limit = source.limit ?? groupLimit;
|
|
244
|
+
const emit = (key, label, list2) => {
|
|
245
|
+
for (const entry of list2.slice(0, limit)) {
|
|
246
|
+
out.push(toItem(`src:${source.id}:${key}:`, entry, label, source.redact ?? redactLabels));
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
for (const [key, { label, entries: list2 }] of buckets) emit(key, label, list2);
|
|
250
|
+
emit("~", source.group, rest);
|
|
223
251
|
}
|
|
224
252
|
}
|
|
225
253
|
return ordered(out);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/search/global-search.tsx"],"sourcesContent":["import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { useHref, useInRouterContext, useNavigate } from \"react-router\";\nimport { AlertCircle, Loader2, Search } from \"lucide-react\";\nimport { Tooltip } from \"../components/tooltip\";\nimport { TOPBAR_TRIGGER_CLASS } from \"../shell/topbar-controls\";\nimport { cn } from \"../lib/cn\";\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport { CommandPalette, DEFAULT_COMMAND_PALETTE_LABELS, useCommandKey } from \"./command-palette\";\nimport type { CommandItem, CommandPaletteDensity, CommandPaletteLabels } from \"./command-palette\";\nimport { createSearchIndex } from \"./search-index\";\nimport type { SearchEntry, SearchIndexOptions } from \"./search-index\";\n\nexport interface GlobalSearchLabels {\n /** The trigger's accessible name, and the dialog's. */\n trigger: string;\n /** The field's placeholder — says WHAT can be found, which \"Search…\" does not. */\n placeholder: string;\n /** The trigger's tooltip, given the shortcut as the platform writes it (\"⌘K\",\n * \"Ctrl K\"). A function so a language can put the keys where its grammar wants. */\n shortcut: (keys: string) => string;\n /** Heading of the suggestions shown for an empty query. */\n suggestions: string;\n /** Heading for entries that name no `group`. */\n results: string;\n}\n\nexport const DEFAULT_GLOBAL_SEARCH_LABELS: GlobalSearchLabels = {\n trigger: \"Search\",\n placeholder: \"Search or jump to…\",\n shortcut: (keys) => `Search (${keys})`,\n suggestions: \"Try\",\n results: \"Results\",\n};\n\n/**\n * A place results come from that is not the static index — a server search, a\n * local-first store too large to hand over whole. Each source is its own group, with its\n * own debounce, its own \"Searching…\" line and its own failure: the static groups never\n * wait for it, and one source failing never takes another's results with it.\n */\nexport interface GlobalSearchSource {\n /** Stable key — the effect that runs the source is keyed by it, not by identity. */\n id: string;\n /** The group its results are shown under (an entry's own `group` is ignored). */\n group: string;\n /** Called with the trimmed query. Its results are shown AS GIVEN — the source ranked\n * them — and never re-filtered by the index's matcher. `signal` aborts when the query\n * moves on or the palette closes; a stale answer is dropped either way. */\n search: (query: string, signal: AbortSignal) => Promise<readonly SearchEntry[]> | readonly SearchEntry[];\n /** Shortest query it is asked for. Default 2 — one letter matches half a database. */\n minChars?: number;\n /** Quiet period after the last keystroke before it is asked. Default 200ms. */\n debounceMs?: number;\n /** Rows kept. Default: `indexOptions.groupLimit` (8). */\n limit?: number;\n /** Mask every row of this source for session replay, hints (amounts) included. An\n * entry's own `redact` still wins. */\n redact?: boolean;\n /** Told when `search` throws or rejects (not when it is aborted). The group then\n * shows the palette's `error` line instead of rows. */\n onError?: (error: unknown) => void;\n}\n\n/** What a custom trigger gets: everything the default button uses. */\nexport interface GlobalSearchTriggerProps {\n open: () => void;\n /** Resolved `trigger` label — the accessible name. */\n label: string;\n /** Resolved `shortcut(keys)` — the tooltip. */\n tooltip: string;\n /** \"⌘K\" on Apple platforms, \"Ctrl K\" elsewhere. */\n keys: string;\n /** For the trigger's `aria-keyshortcuts`. */\n ariaKeyShortcuts: string;\n}\n\n/** A suggestion for the empty query: an entry, the `id` of one in `entries`, or a query\n * to type into the field. */\nexport type GlobalSearchSuggestion = SearchEntry | string | { query: string };\n\nexport interface GlobalSearchProps {\n /**\n * The static index: pages, actions, settings rows — already filtered by the app (by\n * role, by privacy mode). Matched and ranked by {@link createSearchIndex}.\n *\n * Changing it re-runs the open search by itself. Nothing has to be stable: the index is\n * rebuilt only when the entries' TEXT changes (ids, titles, keywords, …), so a list\n * rebuilt on every render — `data = []` while a query is pending, icons as fresh JSX —\n * neither re-indexes nor loops, and the icons and handlers used are always the latest.\n */\n entries?: readonly SearchEntry[];\n /** The async sources, each streamed into its own group. */\n sources?: readonly GlobalSearchSource[];\n /** What the empty query shows, under the `suggestions` heading. */\n suggestions?: readonly GlobalSearchSuggestion[];\n /**\n * Show each suggested ENTRY under its own `group` instead of all of them under the\n * one `suggestions` heading — keksdose's empty palette listed \"Pages\" and \"Actions\"\n * apart, and one \"Try\" heading over both lost the difference. An entry with no\n * `group` and a query suggestion (`{ query }`) stay under `suggestions`. `groupOrder`\n * orders these groups as it orders the results'. Off by default.\n */\n suggestionsKeepGroups?: boolean;\n /** Groups listed here come first, in this order; the rest follow in ranking order. */\n groupOrder?: readonly string[];\n /** Ranking and capping — `groupLimit` (default 8) applies to every group. */\n indexOptions?: SearchIndexOptions;\n /**\n * How an entry's `href` is followed on a plain click or ↵. Default: react-router's\n * `navigate` when the search is rendered inside a router, else a full page load.\n */\n navigate?: (href: string) => void;\n /**\n * The browser URL of an `href`, for the row's real link (middle-/⌘-click opens a tab).\n * Default inside a router: the router's own (`#/page` under a hash router, the\n * basename prefixed under a browser router); outside one, the href itself.\n */\n hrefFor?: (href: string) => string;\n /** Register ⌘K / Ctrl K. Default true; turn it off for a second, scoped search on a\n * page that already has the app-wide one. */\n shortcut?: boolean;\n /** Controlled open state — so a button anywhere can open it. */\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** Controlled query, as on `CommandPalette` (keksdose binds it to the URL's `q`). */\n query?: string;\n onQueryChange?: (query: string) => void;\n searchOn?: \"input\" | \"submit\";\n /** Mask every row for session replay (see `CommandPalette`). A source's or an entry's\n * own `redact` wins. */\n redactLabels?: boolean;\n fullScreenOnPhone?: boolean;\n /** `\"button\"` (default): the top-bar icon button. `\"none\"`: no trigger — the shortcut\n * or a controlled `open` opens it. A function renders a trigger of your own. */\n trigger?: \"button\" | \"none\" | ((props: GlobalSearchTriggerProps) => ReactNode);\n /** Hide the default trigger below `sm` (kastlan's phone top bar has no room). */\n hideTriggerOnPhone?: boolean;\n /** Class for the default trigger button, merged over `TOPBAR_TRIGGER_CLASS`. */\n triggerClassName?: string;\n /**\n * The default trigger's magnifier, in px. Default 16 (`size-4`), as it always was;\n * 20 matches the kit's other top-bar triggers (`TopbarIconButton` draws `size-5`) and\n * keksdose's top bar, which reached into the button with `[&_svg]:size-5` for it.\n */\n triggerIconSize?: number;\n /**\n * Whether the trigger's accessible name includes the shortcut: `\"plain\"` (default)\n * names it \"Search\"; `\"withShortcut\"` names it by `labels.shortcut(keys)` —\n * \"Search (⌘K)\" on Apple platforms, \"Search (Ctrl K)\" elsewhere — the same text its\n * tooltip shows, so a speech-control user (\"click Search\") and a sighted keyboard user\n * meet the shortcut in the name itself (keksdose C25). `aria-keyshortcuts` is set\n * either way. Also reaches a custom trigger as `triggerProps.label`.\n */\n triggerName?: \"plain\" | \"withShortcut\";\n /** The palette's row height — `CommandPalette`'s `density`. Default `\"compact\"`. */\n density?: CommandPaletteDensity;\n labels?: Partial<GlobalSearchLabels>;\n /** Passed through to the palette (`empty`, `loading`, `error`, `hint`, …). */\n paletteLabels?: Partial<CommandPaletteLabels>;\n}\n\nfunction isApplePlatform(): boolean {\n if (typeof navigator === \"undefined\") return false;\n const nav = navigator as Navigator & { userAgentData?: { platform?: string } };\n return /mac|iphone|ipad|ipod/i.test(nav.userAgentData?.platform || nav.platform || nav.userAgent);\n}\n\nconst pageLoad = (href: string) => window.location.assign(href);\nconst identity = (href: string) => href;\n\n/** The entries' text, which is all the index reads — see `entries`. */\nfunction signature(entries: readonly SearchEntry[]): string {\n return entries\n .map((e) =>\n [e.id, e.title, (e.keywords ?? []).join(\"\\u0003\"), e.description, e.group, e.hint, e.href, e.weight, e.redact].join(\n \"\\u0001\",\n ),\n )\n .join(\"\\u0002\");\n}\n\n/** Focus the open palette's field again — after a suggestion typed itself into it, the\n * row that was clicked (and held focus) is gone. */\nfunction refocusField() {\n requestAnimationFrame(() => {\n const fields = document.querySelectorAll<HTMLInputElement>('[role=\"dialog\"][aria-modal=\"true\"] input[role=\"combobox\"]');\n fields[fields.length - 1]?.focus();\n });\n}\n\ninterface SourceResult {\n query: string;\n status: \"loading\" | \"done\" | \"error\";\n entries: readonly SearchEntry[];\n}\n\n/**\n * The app-wide ⌘K search, whole: the top-bar trigger, the shortcut, and a\n * {@link CommandPalette} fed from a ranked index ({@link createSearchIndex}) and any\n * number of async sources.\n *\n * Every consumer had built this out of `CommandPalette` by hand, and each copy had the\n * same holes — a substring match, no ranking, no typo tolerance, results in declaration\n * order, one monolithic provider in which the static groups waited on the slowest\n * request. This is that wrapper once:\n *\n * <GlobalSearch\n * entries={pages} // { id, title, keywords, group, href, icon }\n * sources={[{ id: \"tx\", group: \"Transactions\", search: (q, signal) => api.search(q, { signal }) }]}\n * suggestions={[\"page-budget\", \"action-new-account\"]}\n * />\n *\n * Inside a react-router tree it navigates with the router and builds its links with it;\n * outside one, pass `navigate` (or accept full page loads).\n */\nexport function GlobalSearch(props: GlobalSearchProps) {\n // Two components rather than a conditional hook: `useNavigate` throws outside a\n // router, and whether we are in one does not change over a component's life.\n const inRouter = useInRouterContext();\n if (inRouter && (!props.navigate || !props.hrefFor)) return <RoutedGlobalSearch {...props} />;\n return <GlobalSearchImpl {...props} navigate={props.navigate ?? pageLoad} hrefFor={props.hrefFor ?? identity} />;\n}\n\nfunction RoutedGlobalSearch(props: GlobalSearchProps) {\n const routerNavigate = useNavigate();\n // The router's href for \"/\" is its base (\"#/\" under a hash router, \"/app/\" under a\n // basename); every href is that base plus the path.\n const base = useHref(\"/\").replace(/\\/$/, \"\");\n const navigate = useCallback((href: string) => void routerNavigate(href), [routerNavigate]);\n const hrefFor = useCallback((href: string) => (href.startsWith(\"/\") ? base + href : href), [base]);\n return <GlobalSearchImpl {...props} navigate={props.navigate ?? navigate} hrefFor={props.hrefFor ?? hrefFor} />;\n}\n\nfunction GlobalSearchImpl({\n entries,\n sources,\n suggestions,\n suggestionsKeepGroups = false,\n groupOrder,\n indexOptions,\n navigate,\n hrefFor,\n shortcut = true,\n open: openProp,\n onOpenChange,\n query: queryProp,\n onQueryChange,\n searchOn,\n redactLabels = false,\n fullScreenOnPhone,\n trigger = \"button\",\n hideTriggerOnPhone = false,\n triggerClassName,\n triggerIconSize,\n triggerName = \"plain\",\n density,\n labels,\n paletteLabels,\n}: GlobalSearchProps & { navigate: (href: string) => void; hrefFor: (href: string) => string }) {\n const l = useKitLabels(\"globalSearch\", DEFAULT_GLOBAL_SEARCH_LABELS, labels);\n const pl = useKitLabels(\"commandPalette\", DEFAULT_COMMAND_PALETTE_LABELS, paletteLabels);\n const [ownOpen, setOwnOpen] = useState(false);\n const open = openProp ?? ownOpen;\n const [ownQuery, setOwnQuery] = useState(\"\");\n const queryControlled = queryProp !== undefined;\n const query = queryControlled ? queryProp : ownQuery;\n const q = query.trim();\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (openProp === undefined) setOwnOpen(next);\n onOpenChange?.(next);\n },\n [openProp, onOpenChange],\n );\n const setQuery = useCallback(\n (next: string) => {\n if (!queryControlled) setOwnQuery(next);\n onQueryChange?.(next);\n },\n [queryControlled, onQueryChange],\n );\n\n // Each open starts blank — unless the owner controls the query (a URL `q`). Adjusted\n // during render, React's pattern for state that follows a prop, so a controlled `open`\n // gets the same reset as the trigger does.\n const [wasOpen, setWasOpen] = useState(open);\n if (wasOpen !== open) {\n setWasOpen(open);\n if (open && !queryControlled) setOwnQuery(\"\");\n }\n\n const openSearch = useCallback(() => setOpen(true), [setOpen]);\n const noop = useCallback(() => {}, []);\n useCommandKey(shortcut ? openSearch : noop);\n\n /* ── the static index ─────────────────────────────────────────────────── */\n\n // Everything below is keyed by CONTENT, never by the identity of what the app passed:\n // inline arrays and `data = []` defaults are the norm, and an identity key would\n // re-index and re-search on every render of the app. Handlers, which can close over\n // anything, are read from refs at the moment a row is chosen — never stale.\n const list = entries ?? EMPTY;\n const sig = signature(list);\n const optionsKey = JSON.stringify(indexOptions ?? {});\n const groupLimit = indexOptions?.groupLimit ?? 8;\n // `sig` and `optionsKey` stand for `list` and `indexOptions`: same text, same index.\n /* eslint-disable react-hooks/exhaustive-deps */\n const index = useMemo(() => createSearchIndex(list, indexOptions), [sig, optionsKey]);\n const byId = useMemo(() => new Map(list.map((e) => [e.id, e])), [sig]);\n\n const sourceKey = (sources ?? [])\n .map((s) => [s.id, s.group, s.minChars ?? 2, s.debounceMs ?? 200, s.limit, s.redact].join(\"\\u0001\"))\n .join(\"\\u0002\");\n const sourceList = useMemo(() => sources ?? [], [sourceKey]);\n\n const suggestionsKey = (suggestions ?? [])\n .map((s) => (typeof s === \"string\" ? `i:${s}` : \"query\" in s ? `q:${s.query}` : `e:${signature([s])}`))\n .join(\"\\u0002\");\n const suggestionList = useMemo(() => suggestions ?? [], [suggestionsKey]);\n\n const groupOrderKey = (groupOrder ?? []).join(\"\\u0002\");\n const order = useMemo(() => groupOrder ?? [], [groupOrderKey]);\n /* eslint-enable react-hooks/exhaustive-deps */\n\n // The live objects, for the moment a row is chosen or a source is asked.\n const live = useRef({ entries: list, sources: sources ?? [], suggestions: suggestions ?? [], navigate });\n useLayoutEffect(() => {\n live.current = { entries: list, sources: sources ?? [], suggestions: suggestions ?? [], navigate };\n });\n\n /* ── the async sources ────────────────────────────────────────────────── */\n\n const [sourceResults, setSourceResults] = useState<Record<string, SourceResult>>({});\n useEffect(() => {\n const controllers: AbortController[] = [];\n const timers: ReturnType<typeof setTimeout>[] = [];\n const asked = open ? live.current.sources.filter((s) => q.length >= (s.minChars ?? 2)) : [];\n for (const source of asked) {\n const id = source.id;\n const controller = new AbortController();\n controllers.push(controller);\n timers.push(\n setTimeout(async () => {\n const settle = (result: SourceResult) => {\n if (!controller.signal.aborted) setSourceResults((prev) => ({ ...prev, [id]: result }));\n };\n try {\n const found = await source.search(q, controller.signal);\n settle({ query: q, status: \"done\", entries: found });\n } catch (error) {\n if (controller.signal.aborted) return;\n source.onError?.(error);\n settle({ query: q, status: \"error\", entries: [] });\n }\n }, source.debounceMs ?? 200),\n );\n }\n return () => {\n timers.forEach(clearTimeout);\n controllers.forEach((c) => c.abort());\n };\n }, [open, q, sourceKey]);\n\n /* ── rows ─────────────────────────────────────────────────────────────── */\n\n const toItem = useCallback(\n (prefix: string, entry: SearchEntry, group: string, redact = redactLabels): CommandItem => ({\n id: `${prefix}${entry.id}`,\n label: entry.title,\n hint: entry.hint,\n group,\n icon: entry.icon,\n redact: entry.redact ?? redact,\n href: entry.href !== undefined ? hrefFor(entry.href) : undefined,\n onSelect: () => {\n // The entry as the app has it NOW — its handler may close over newer state\n // than the one this row was built from.\n const current = live.current.entries.find((e) => e.id === entry.id) ?? entry;\n if (current.onSelect) current.onSelect();\n else if (current.href !== undefined) live.current.navigate(current.href);\n },\n }),\n [hrefFor, redactLabels],\n );\n\n // `toItem` only BUILDS `onSelect` closures here; `live` is read when a row is chosen,\n // which the compiler lint cannot tell from a read during render.\n /* eslint-disable react-hooks/refs */\n const items = useMemo((): CommandItem[] => {\n const ordered = (out: CommandItem[]) => {\n if (!order.length) return out;\n const rank = (group: string) => {\n const i = order.indexOf(group);\n return i === -1 ? order.length : i;\n };\n // Stable: within a rank, groups keep the order their best hit gave them.\n return out\n .map((item, i) => ({ item, i }))\n .sort((a, b) => rank(a.item.group) - rank(b.item.group) || a.i - b.i)\n .map(({ item }) => item);\n };\n\n if (!q) {\n const out: CommandItem[] = [];\n const groupOf = (entry: SearchEntry) =>\n suggestionsKeepGroups ? (entry.group ?? l.suggestions) : l.suggestions;\n suggestionList.forEach((s, i) => {\n if (typeof s === \"string\") {\n const entry = byId.get(s);\n if (entry) out.push(toItem(\"try:\", entry, groupOf(entry)));\n } else if (\"query\" in s) {\n out.push({\n id: `try:q${i}`,\n label: s.query,\n group: l.suggestions,\n icon: <Search className=\"size-4\" />,\n onSelect: () => {\n // The palette closes before it runs a row; a query suggestion keeps it\n // open and types itself in instead.\n setOpen(true);\n setQuery(s.query);\n refocusField();\n },\n });\n } else out.push(toItem(\"try:\", s, groupOf(s)));\n });\n // One heading has nothing to order; kept groups are ordered like results.\n return suggestionsKeepGroups ? ordered(out) : out;\n }\n\n const out = index.search(q).map((hit) => toItem(\"s:\", hit.entry, hit.entry.group ?? l.results));\n for (const source of sourceList) {\n if (q.length < (source.minChars ?? 2)) continue;\n const result = sourceResults[source.id];\n const status = (label: string, icon: ReactNode): CommandItem => ({\n id: `src:${source.id}:status`,\n label,\n group: source.group,\n icon,\n kind: \"status\",\n onSelect: noop,\n });\n // Anything but an answer to THIS query is still loading — including the previous\n // query's rows, which would otherwise sit under the new query as if they matched.\n if (!result || result.query !== q) {\n out.push(status(pl.loading, <Loader2 className=\"size-3.5 animate-spin\" />));\n } else if (result.status === \"error\") {\n out.push(status(pl.error ?? DEFAULT_COMMAND_PALETTE_LABELS.error!, <AlertCircle className=\"size-3.5\" />));\n } else {\n for (const entry of result.entries.slice(0, source.limit ?? groupLimit)) {\n out.push(toItem(`src:${source.id}:`, entry, source.group, source.redact ?? redactLabels));\n }\n }\n }\n\n return ordered(out);\n }, [q, suggestionList, suggestionsKeepGroups, byId, index, sourceList, sourceResults, order, groupLimit, toItem, l.suggestions, l.results, pl.loading, pl.error, setOpen, setQuery, noop, redactLabels]);\n /* eslint-enable react-hooks/refs */\n\n // The palette re-runs its provider on a `revision` change, never on the provider's\n // identity — and `items` is everything the provider answers with.\n const provider = useCallback(() => items, [items]);\n\n const resolvedPaletteLabels = useMemo(\n () => ({ dialog: l.trigger, placeholder: l.placeholder, ...paletteLabels }),\n [l.trigger, l.placeholder, paletteLabels],\n );\n\n const apple = useMemo(() => isApplePlatform(), []);\n const keys = apple ? \"⌘K\" : \"Ctrl K\";\n const triggerLabel = triggerName === \"withShortcut\" ? l.shortcut(keys) : l.trigger;\n const triggerProps: GlobalSearchTriggerProps = {\n open: openSearch,\n label: triggerLabel,\n tooltip: l.shortcut(keys),\n keys,\n ariaKeyShortcuts: \"Meta+K Control+K\",\n };\n\n return (\n <>\n {typeof trigger === \"function\"\n ? trigger(triggerProps)\n : trigger === \"button\" && (\n <Tooltip\n label={triggerProps.tooltip}\n side=\"bottom\"\n portal\n className={hideTriggerOnPhone ? \"hidden sm:block\" : undefined}\n >\n <button\n type=\"button\"\n onClick={openSearch}\n aria-label={triggerLabel}\n aria-keyshortcuts={triggerProps.ariaKeyShortcuts}\n aria-haspopup=\"dialog\"\n className={cn(TOPBAR_TRIGGER_CLASS, triggerClassName)}\n >\n <Search\n className={triggerIconSize === undefined ? \"size-4\" : undefined}\n style={triggerIconSize === undefined ? undefined : { width: triggerIconSize, height: triggerIconSize }}\n />\n </button>\n </Tooltip>\n )}\n <CommandPalette\n open={open}\n onClose={() => setOpen(false)}\n search={provider}\n revision={items}\n query={query}\n onQueryChange={setQuery}\n searchOn={searchOn}\n redactLabels={redactLabels}\n fullScreenOnPhone={fullScreenOnPhone}\n density={density}\n labels={resolvedPaletteLabels}\n />\n </>\n );\n}\n\nconst EMPTY: readonly SearchEntry[] = [];\n"],"mappings":";AA4N8D,SAsQ1D,UAtQ0D,KAsQ1D,YAtQ0D;A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;AAAA;AAAA,QACC,OAAO,aAAa;AAAA,QACpB,MAAK;AAAA,QACL,QAAM;AAAA,QACN,WAAW,qBAAqB,oBAAoB;AAAA,QAEpD;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,SAAS;AAAA,YACT,cAAY;AAAA,YACZ,qBAAmB,aAAa;AAAA,YAChC,iBAAc;AAAA,YACd,WAAW,GAAG,sBAAsB,gBAAgB;AAAA,YAEpD;AAAA,cAAC;AAAA;AAAA,gBACC,WAAW,oBAAoB,SAAY,WAAW;AAAA,gBACtD,OAAO,oBAAoB,SAAY,SAAY,EAAE,OAAO,iBAAiB,QAAQ,gBAAgB;AAAA;AAAA,YACvG;AAAA;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IAEN;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,SAAS,MAAM,QAAQ,KAAK;AAAA,QAC5B,QAAQ;AAAA,QACR,UAAU;AAAA,QACV;AAAA,QACA,eAAe;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,QAAQ;AAAA;AAAA,IACV;AAAA,KACF;AAEJ;AAEA,MAAM,QAAgC,CAAC;","names":["out"]}
|
|
1
|
+
{"version":3,"sources":["../../src/search/global-search.tsx"],"sourcesContent":["import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { useHref, useInRouterContext, useNavigate } from \"react-router\";\nimport { AlertCircle, Loader2, Search } from \"lucide-react\";\nimport { Tooltip } from \"../components/tooltip\";\nimport { TOPBAR_TRIGGER_CLASS } from \"../shell/topbar-controls\";\nimport { cn } from \"../lib/cn\";\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport { CommandPalette, DEFAULT_COMMAND_PALETTE_LABELS, useCommandKey } from \"./command-palette\";\nimport type { CommandItem, CommandPaletteDensity, CommandPaletteLabels } from \"./command-palette\";\nimport { createSearchIndex } from \"./search-index\";\nimport type { SearchEntry, SearchIndexOptions } from \"./search-index\";\n\nexport interface GlobalSearchLabels {\n /** The trigger's accessible name, and the dialog's. */\n trigger: string;\n /** The field's placeholder — says WHAT can be found, which \"Search…\" does not. */\n placeholder: string;\n /** The trigger's tooltip, given the shortcut as the platform writes it (\"⌘K\",\n * \"Ctrl K\"). A function so a language can put the keys where its grammar wants. */\n shortcut: (keys: string) => string;\n /** Heading of the suggestions shown for an empty query. */\n suggestions: string;\n /** Heading for entries that name no `group`. */\n results: string;\n}\n\nexport const DEFAULT_GLOBAL_SEARCH_LABELS: GlobalSearchLabels = {\n trigger: \"Search\",\n placeholder: \"Search or jump to…\",\n shortcut: (keys) => `Search (${keys})`,\n suggestions: \"Try\",\n results: \"Results\",\n};\n\n/**\n * A place results come from that is not the static index — a server search, a\n * local-first store too large to hand over whole. Each source is its own group, with its\n * own debounce, its own \"Searching…\" line and its own failure: the static groups never\n * wait for it, and one source failing never takes another's results with it.\n */\nexport interface GlobalSearchSource {\n /** Stable key — the effect that runs the source is keyed by it, not by identity. */\n id: string;\n /** The group its results are shown under (an entry's own `group` is ignored) — unless\n * `groups` is set, where it is only the home of entries that name no declared group. */\n group: string;\n /**\n * Split ONE request into several groups — kastlan's record search answers with\n * properties, units, contacts, leases and invoices at once, and one source per group\n * meant a dedupe layer so the network still saw one request. Each entry is then shown\n * under the group its own `group` names: a declared `key` (shown by its `label`) or a\n * plain string (key and heading at once). The groups appear in THIS order whatever the\n * answer's order, each kept to `limit` rows; an entry naming no declared group falls\n * under `group`. While the request runs, or when it fails, the source shows one status\n * line under its first group, not one per group. Unset: one group, as before.\n */\n groups?: readonly (string | GlobalSearchSourceGroup)[];\n /** Called with the trimmed query. Its results are shown AS GIVEN — the source ranked\n * them — and never re-filtered by the index's matcher. `signal` aborts when the query\n * moves on or the palette closes; a stale answer is dropped either way. */\n search: (query: string, signal: AbortSignal) => Promise<readonly SearchEntry[]> | readonly SearchEntry[];\n /** Shortest query it is asked for. Default 2 — one letter matches half a database. */\n minChars?: number;\n /** Quiet period after the last keystroke before it is asked. Default 200ms. */\n debounceMs?: number;\n /** Rows kept — per group, when `groups` is set. Default: `indexOptions.groupLimit` (8). */\n limit?: number;\n /** Mask every row of this source for session replay, hints (amounts) included. An\n * entry's own `redact` still wins. */\n redact?: boolean;\n /** Told when `search` throws or rejects (not when it is aborted). The group then\n * shows the palette's `error` line instead of rows. */\n onError?: (error: unknown) => void;\n}\n\n/** One of a multi-group source's groups: the `key` its entries name in `group`, and the\n * heading shown — so a server's type (\"unit\") need not be translated per entry. */\nexport interface GlobalSearchSourceGroup {\n key: string;\n label: string;\n}\n\n/** What a custom trigger gets: everything the default button uses. */\nexport interface GlobalSearchTriggerProps {\n open: () => void;\n /** Resolved `trigger` label — the accessible name. */\n label: string;\n /** Resolved `shortcut(keys)` — the tooltip. */\n tooltip: string;\n /** \"⌘K\" on Apple platforms, \"Ctrl K\" elsewhere. */\n keys: string;\n /** For the trigger's `aria-keyshortcuts`. */\n ariaKeyShortcuts: string;\n}\n\n/** A suggestion for the empty query: an entry, the `id` of one in `entries`, or a query\n * to type into the field. */\nexport type GlobalSearchSuggestion = SearchEntry | string | { query: string };\n\nexport interface GlobalSearchProps {\n /**\n * The static index: pages, actions, settings rows — already filtered by the app (by\n * role, by privacy mode). Matched and ranked by {@link createSearchIndex}.\n *\n * Changing it re-runs the open search by itself. Nothing has to be stable: the index is\n * rebuilt only when the entries' TEXT changes (ids, titles, keywords, …), so a list\n * rebuilt on every render — `data = []` while a query is pending, icons as fresh JSX —\n * neither re-indexes nor loops, and the icons and handlers used are always the latest.\n */\n entries?: readonly SearchEntry[];\n /** The async sources, each streamed into its own group — or several (`groups`). */\n sources?: readonly GlobalSearchSource[];\n /** What the empty query shows, under the `suggestions` heading. */\n suggestions?: readonly GlobalSearchSuggestion[];\n /**\n * Show each suggested ENTRY under its own `group` instead of all of them under the\n * one `suggestions` heading — keksdose's empty palette listed \"Pages\" and \"Actions\"\n * apart, and one \"Try\" heading over both lost the difference. An entry with no\n * `group` and a query suggestion (`{ query }`) stay under `suggestions`. `groupOrder`\n * orders these groups as it orders the results'. Off by default.\n */\n suggestionsKeepGroups?: boolean;\n /** Groups listed here come first, in this order; the rest follow in ranking order. */\n groupOrder?: readonly string[];\n /** Ranking and capping — `groupLimit` (default 8) applies to every group. */\n indexOptions?: SearchIndexOptions;\n /**\n * How an entry's `href` is followed on a plain click or ↵. Default: react-router's\n * `navigate` when the search is rendered inside a router, else a full page load.\n */\n navigate?: (href: string) => void;\n /**\n * The browser URL of an `href`, for the row's real link (middle-/⌘-click opens a tab).\n * Default inside a router: the router's own (`#/page` under a hash router, the\n * basename prefixed under a browser router); outside one, the href itself.\n */\n hrefFor?: (href: string) => string;\n /** Register ⌘K / Ctrl K. Default true; turn it off for a second, scoped search on a\n * page that already has the app-wide one. */\n shortcut?: boolean;\n /** Controlled open state — so a button anywhere can open it. */\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** Controlled query, as on `CommandPalette` (keksdose binds it to the URL's `q`). */\n query?: string;\n onQueryChange?: (query: string) => void;\n searchOn?: \"input\" | \"submit\";\n /** Mask every row for session replay (see `CommandPalette`). A source's or an entry's\n * own `redact` wins. */\n redactLabels?: boolean;\n fullScreenOnPhone?: boolean;\n /** `\"button\"` (default): the top-bar icon button. `\"none\"`: no trigger — the shortcut\n * or a controlled `open` opens it. A function renders a trigger of your own. */\n trigger?: \"button\" | \"none\" | ((props: GlobalSearchTriggerProps) => ReactNode);\n /** Hide the default trigger below `sm` (kastlan's phone top bar has no room). */\n hideTriggerOnPhone?: boolean;\n /** Class for the default trigger button, merged over `TOPBAR_TRIGGER_CLASS`. */\n triggerClassName?: string;\n /**\n * The default trigger's magnifier, in px. Default 16 (`size-4`), as it always was;\n * 20 matches the kit's other top-bar triggers (`TopbarIconButton` draws `size-5`) and\n * keksdose's top bar, which reached into the button with `[&_svg]:size-5` for it.\n */\n triggerIconSize?: number;\n /**\n * Whether the trigger's accessible name includes the shortcut: `\"plain\"` (default)\n * names it \"Search\"; `\"withShortcut\"` names it by `labels.shortcut(keys)` —\n * \"Search (⌘K)\" on Apple platforms, \"Search (Ctrl K)\" elsewhere — the same text its\n * tooltip shows, so a speech-control user (\"click Search\") and a sighted keyboard user\n * meet the shortcut in the name itself (keksdose C25). `aria-keyshortcuts` is set\n * either way. Also reaches a custom trigger as `triggerProps.label`.\n */\n triggerName?: \"plain\" | \"withShortcut\";\n /** The palette's row height — `CommandPalette`'s `density`. Default `\"compact\"`. */\n density?: CommandPaletteDensity;\n labels?: Partial<GlobalSearchLabels>;\n /** Passed through to the palette (`empty`, `loading`, `error`, `hint`, …). */\n paletteLabels?: Partial<CommandPaletteLabels>;\n}\n\nfunction isApplePlatform(): boolean {\n if (typeof navigator === \"undefined\") return false;\n const nav = navigator as Navigator & { userAgentData?: { platform?: string } };\n return /mac|iphone|ipad|ipod/i.test(nav.userAgentData?.platform || nav.platform || nav.userAgent);\n}\n\nconst pageLoad = (href: string) => window.location.assign(href);\nconst identity = (href: string) => href;\n\n/** The entries' text, which is all the index reads — see `entries`. */\nfunction signature(entries: readonly SearchEntry[]): string {\n return entries\n .map((e) =>\n [e.id, e.title, (e.keywords ?? []).join(\"\\u0003\"), e.description, e.group, e.hint, e.href, e.weight, e.redact].join(\n \"\\u0001\",\n ),\n )\n .join(\"\\u0002\");\n}\n\n/** Focus the open palette's field again — after a suggestion typed itself into it, the\n * row that was clicked (and held focus) is gone. */\nfunction refocusField() {\n requestAnimationFrame(() => {\n const fields = document.querySelectorAll<HTMLInputElement>('[role=\"dialog\"][aria-modal=\"true\"] input[role=\"combobox\"]');\n fields[fields.length - 1]?.focus();\n });\n}\n\ninterface SourceResult {\n query: string;\n status: \"loading\" | \"done\" | \"error\";\n entries: readonly SearchEntry[];\n}\n\n/**\n * The app-wide ⌘K search, whole: the top-bar trigger, the shortcut, and a\n * {@link CommandPalette} fed from a ranked index ({@link createSearchIndex}) and any\n * number of async sources.\n *\n * Every consumer had built this out of `CommandPalette` by hand, and each copy had the\n * same holes — a substring match, no ranking, no typo tolerance, results in declaration\n * order, one monolithic provider in which the static groups waited on the slowest\n * request. This is that wrapper once:\n *\n * <GlobalSearch\n * entries={pages} // { id, title, keywords, group, href, icon }\n * sources={[{ id: \"tx\", group: \"Transactions\", search: (q, signal) => api.search(q, { signal }) }]}\n * suggestions={[\"page-budget\", \"action-new-account\"]}\n * />\n *\n * Inside a react-router tree it navigates with the router and builds its links with it;\n * outside one, pass `navigate` (or accept full page loads).\n */\nexport function GlobalSearch(props: GlobalSearchProps) {\n // Two components rather than a conditional hook: `useNavigate` throws outside a\n // router, and whether we are in one does not change over a component's life.\n const inRouter = useInRouterContext();\n if (inRouter && (!props.navigate || !props.hrefFor)) return <RoutedGlobalSearch {...props} />;\n return <GlobalSearchImpl {...props} navigate={props.navigate ?? pageLoad} hrefFor={props.hrefFor ?? identity} />;\n}\n\nfunction RoutedGlobalSearch(props: GlobalSearchProps) {\n const routerNavigate = useNavigate();\n // The router's href for \"/\" is its base (\"#/\" under a hash router, \"/app/\" under a\n // basename); every href is that base plus the path.\n const base = useHref(\"/\").replace(/\\/$/, \"\");\n const navigate = useCallback((href: string) => void routerNavigate(href), [routerNavigate]);\n const hrefFor = useCallback((href: string) => (href.startsWith(\"/\") ? base + href : href), [base]);\n return <GlobalSearchImpl {...props} navigate={props.navigate ?? navigate} hrefFor={props.hrefFor ?? hrefFor} />;\n}\n\nfunction GlobalSearchImpl({\n entries,\n sources,\n suggestions,\n suggestionsKeepGroups = false,\n groupOrder,\n indexOptions,\n navigate,\n hrefFor,\n shortcut = true,\n open: openProp,\n onOpenChange,\n query: queryProp,\n onQueryChange,\n searchOn,\n redactLabels = false,\n fullScreenOnPhone,\n trigger = \"button\",\n hideTriggerOnPhone = false,\n triggerClassName,\n triggerIconSize,\n triggerName = \"plain\",\n density,\n labels,\n paletteLabels,\n}: GlobalSearchProps & { navigate: (href: string) => void; hrefFor: (href: string) => string }) {\n const l = useKitLabels(\"globalSearch\", DEFAULT_GLOBAL_SEARCH_LABELS, labels);\n const pl = useKitLabels(\"commandPalette\", DEFAULT_COMMAND_PALETTE_LABELS, paletteLabels);\n const [ownOpen, setOwnOpen] = useState(false);\n const open = openProp ?? ownOpen;\n const [ownQuery, setOwnQuery] = useState(\"\");\n const queryControlled = queryProp !== undefined;\n const query = queryControlled ? queryProp : ownQuery;\n const q = query.trim();\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (openProp === undefined) setOwnOpen(next);\n onOpenChange?.(next);\n },\n [openProp, onOpenChange],\n );\n const setQuery = useCallback(\n (next: string) => {\n if (!queryControlled) setOwnQuery(next);\n onQueryChange?.(next);\n },\n [queryControlled, onQueryChange],\n );\n\n // Each open starts blank — unless the owner controls the query (a URL `q`). Adjusted\n // during render, React's pattern for state that follows a prop, so a controlled `open`\n // gets the same reset as the trigger does.\n const [wasOpen, setWasOpen] = useState(open);\n if (wasOpen !== open) {\n setWasOpen(open);\n if (open && !queryControlled) setOwnQuery(\"\");\n }\n\n const openSearch = useCallback(() => setOpen(true), [setOpen]);\n const noop = useCallback(() => {}, []);\n useCommandKey(shortcut ? openSearch : noop);\n\n /* ── the static index ─────────────────────────────────────────────────── */\n\n // Everything below is keyed by CONTENT, never by the identity of what the app passed:\n // inline arrays and `data = []` defaults are the norm, and an identity key would\n // re-index and re-search on every render of the app. Handlers, which can close over\n // anything, are read from refs at the moment a row is chosen — never stale.\n const list = entries ?? EMPTY;\n const sig = signature(list);\n const optionsKey = JSON.stringify(indexOptions ?? {});\n const groupLimit = indexOptions?.groupLimit ?? 8;\n // `sig` and `optionsKey` stand for `list` and `indexOptions`: same text, same index.\n /* eslint-disable react-hooks/exhaustive-deps */\n const index = useMemo(() => createSearchIndex(list, indexOptions), [sig, optionsKey]);\n const byId = useMemo(() => new Map(list.map((e) => [e.id, e])), [sig]);\n\n const sourceKey = (sources ?? [])\n .map((s) =>\n [\n s.id,\n s.group,\n (s.groups ?? []).map((g) => (typeof g === \"string\" ? g : `${g.key}\\u0003${g.label}`)).join(\"\\u0004\"),\n s.minChars ?? 2,\n s.debounceMs ?? 200,\n s.limit,\n s.redact,\n ].join(\"\\u0001\"),\n )\n .join(\"\\u0002\");\n const sourceList = useMemo(() => sources ?? [], [sourceKey]);\n\n const suggestionsKey = (suggestions ?? [])\n .map((s) => (typeof s === \"string\" ? `i:${s}` : \"query\" in s ? `q:${s.query}` : `e:${signature([s])}`))\n .join(\"\\u0002\");\n const suggestionList = useMemo(() => suggestions ?? [], [suggestionsKey]);\n\n const groupOrderKey = (groupOrder ?? []).join(\"\\u0002\");\n const order = useMemo(() => groupOrder ?? [], [groupOrderKey]);\n /* eslint-enable react-hooks/exhaustive-deps */\n\n // The live objects, for the moment a row is chosen or a source is asked.\n const live = useRef({ entries: list, sources: sources ?? [], suggestions: suggestions ?? [], navigate });\n useLayoutEffect(() => {\n live.current = { entries: list, sources: sources ?? [], suggestions: suggestions ?? [], navigate };\n });\n\n /* ── the async sources ────────────────────────────────────────────────── */\n\n const [sourceResults, setSourceResults] = useState<Record<string, SourceResult>>({});\n useEffect(() => {\n const controllers: AbortController[] = [];\n const timers: ReturnType<typeof setTimeout>[] = [];\n const asked = open ? live.current.sources.filter((s) => q.length >= (s.minChars ?? 2)) : [];\n for (const source of asked) {\n const id = source.id;\n const controller = new AbortController();\n controllers.push(controller);\n timers.push(\n setTimeout(async () => {\n const settle = (result: SourceResult) => {\n if (!controller.signal.aborted) setSourceResults((prev) => ({ ...prev, [id]: result }));\n };\n try {\n const found = await source.search(q, controller.signal);\n settle({ query: q, status: \"done\", entries: found });\n } catch (error) {\n if (controller.signal.aborted) return;\n source.onError?.(error);\n settle({ query: q, status: \"error\", entries: [] });\n }\n }, source.debounceMs ?? 200),\n );\n }\n return () => {\n timers.forEach(clearTimeout);\n controllers.forEach((c) => c.abort());\n };\n }, [open, q, sourceKey]);\n\n /* ── rows ─────────────────────────────────────────────────────────────── */\n\n const toItem = useCallback(\n (prefix: string, entry: SearchEntry, group: string, redact = redactLabels): CommandItem => ({\n id: `${prefix}${entry.id}`,\n label: entry.title,\n hint: entry.hint,\n group,\n icon: entry.icon,\n redact: entry.redact ?? redact,\n href: entry.href !== undefined ? hrefFor(entry.href) : undefined,\n onSelect: () => {\n // The entry as the app has it NOW — its handler may close over newer state\n // than the one this row was built from.\n const current = live.current.entries.find((e) => e.id === entry.id) ?? entry;\n if (current.onSelect) current.onSelect();\n else if (current.href !== undefined) live.current.navigate(current.href);\n },\n }),\n [hrefFor, redactLabels],\n );\n\n // `toItem` only BUILDS `onSelect` closures here; `live` is read when a row is chosen,\n // which the compiler lint cannot tell from a read during render.\n /* eslint-disable react-hooks/refs */\n const items = useMemo((): CommandItem[] => {\n const ordered = (out: CommandItem[]) => {\n if (!order.length) return out;\n const rank = (group: string) => {\n const i = order.indexOf(group);\n return i === -1 ? order.length : i;\n };\n // Stable: within a rank, groups keep the order their best hit gave them.\n return out\n .map((item, i) => ({ item, i }))\n .sort((a, b) => rank(a.item.group) - rank(b.item.group) || a.i - b.i)\n .map(({ item }) => item);\n };\n\n if (!q) {\n const out: CommandItem[] = [];\n const groupOf = (entry: SearchEntry) =>\n suggestionsKeepGroups ? (entry.group ?? l.suggestions) : l.suggestions;\n suggestionList.forEach((s, i) => {\n if (typeof s === \"string\") {\n const entry = byId.get(s);\n if (entry) out.push(toItem(\"try:\", entry, groupOf(entry)));\n } else if (\"query\" in s) {\n out.push({\n id: `try:q${i}`,\n label: s.query,\n group: l.suggestions,\n icon: <Search className=\"size-4\" />,\n onSelect: () => {\n // The palette closes before it runs a row; a query suggestion keeps it\n // open and types itself in instead.\n setOpen(true);\n setQuery(s.query);\n refocusField();\n },\n });\n } else out.push(toItem(\"try:\", s, groupOf(s)));\n });\n // One heading has nothing to order; kept groups are ordered like results.\n return suggestionsKeepGroups ? ordered(out) : out;\n }\n\n const out = index.search(q).map((hit) => toItem(\"s:\", hit.entry, hit.entry.group ?? l.results));\n for (const source of sourceList) {\n if (q.length < (source.minChars ?? 2)) continue;\n const result = sourceResults[source.id];\n const declared = (source.groups ?? []).map((g) => (typeof g === \"string\" ? { key: g, label: g } : g));\n const status = (label: string, icon: ReactNode): CommandItem => ({\n id: `src:${source.id}:status`,\n label,\n // One line for the one request, under the group that will head its answer.\n group: declared[0]?.label ?? source.group,\n icon,\n kind: \"status\",\n onSelect: noop,\n });\n // Anything but an answer to THIS query is still loading — including the previous\n // query's rows, which would otherwise sit under the new query as if they matched.\n if (!result || result.query !== q) {\n out.push(status(pl.loading, <Loader2 className=\"size-3.5 animate-spin\" />));\n } else if (result.status === \"error\") {\n out.push(status(pl.error ?? DEFAULT_COMMAND_PALETTE_LABELS.error!, <AlertCircle className=\"size-3.5\" />));\n } else if (!declared.length) {\n for (const entry of result.entries.slice(0, source.limit ?? groupLimit)) {\n out.push(toItem(`src:${source.id}:`, entry, source.group, source.redact ?? redactLabels));\n }\n } else {\n // Bucket by the entry's own group, then emit in the DECLARED order — the answer's\n // order must not reshuffle the headings between keystrokes. Within a group the\n // source's ranking stands. The group key is in the row id: two record types may\n // share an id (\"1\"), and the palette keys rows by it.\n const buckets = new Map<string, { label: string; entries: SearchEntry[] }>();\n for (const g of declared) buckets.set(g.key, { label: g.label, entries: [] });\n const rest: SearchEntry[] = [];\n for (const entry of result.entries) {\n const bucket = entry.group === undefined ? undefined : buckets.get(entry.group);\n (bucket ? bucket.entries : rest).push(entry);\n }\n const limit = source.limit ?? groupLimit;\n const emit = (key: string, label: string, list: SearchEntry[]) => {\n for (const entry of list.slice(0, limit)) {\n out.push(toItem(`src:${source.id}:${key}:`, entry, label, source.redact ?? redactLabels));\n }\n };\n for (const [key, { label, entries: list }] of buckets) emit(key, label, list);\n emit(\"~\", source.group, rest);\n }\n }\n\n return ordered(out);\n }, [q, suggestionList, suggestionsKeepGroups, byId, index, sourceList, sourceResults, order, groupLimit, toItem, l.suggestions, l.results, pl.loading, pl.error, setOpen, setQuery, noop, redactLabels]);\n /* eslint-enable react-hooks/refs */\n\n // The palette re-runs its provider on a `revision` change, never on the provider's\n // identity — and `items` is everything the provider answers with.\n const provider = useCallback(() => items, [items]);\n\n const resolvedPaletteLabels = useMemo(\n () => ({ dialog: l.trigger, placeholder: l.placeholder, ...paletteLabels }),\n [l.trigger, l.placeholder, paletteLabels],\n );\n\n const apple = useMemo(() => isApplePlatform(), []);\n const keys = apple ? \"⌘K\" : \"Ctrl K\";\n const triggerLabel = triggerName === \"withShortcut\" ? l.shortcut(keys) : l.trigger;\n const triggerProps: GlobalSearchTriggerProps = {\n open: openSearch,\n label: triggerLabel,\n tooltip: l.shortcut(keys),\n keys,\n ariaKeyShortcuts: \"Meta+K Control+K\",\n };\n\n return (\n <>\n {typeof trigger === \"function\"\n ? trigger(triggerProps)\n : trigger === \"button\" && (\n <Tooltip\n label={triggerProps.tooltip}\n side=\"bottom\"\n portal\n className={hideTriggerOnPhone ? \"hidden sm:block\" : undefined}\n >\n <button\n type=\"button\"\n onClick={openSearch}\n aria-label={triggerLabel}\n aria-keyshortcuts={triggerProps.ariaKeyShortcuts}\n aria-haspopup=\"dialog\"\n className={cn(TOPBAR_TRIGGER_CLASS, triggerClassName)}\n >\n <Search\n className={triggerIconSize === undefined ? \"size-4\" : undefined}\n style={triggerIconSize === undefined ? undefined : { width: triggerIconSize, height: triggerIconSize }}\n />\n </button>\n </Tooltip>\n )}\n <CommandPalette\n open={open}\n onClose={() => setOpen(false)}\n search={provider}\n revision={items}\n query={query}\n onQueryChange={setQuery}\n searchOn={searchOn}\n redactLabels={redactLabels}\n fullScreenOnPhone={fullScreenOnPhone}\n density={density}\n labels={resolvedPaletteLabels}\n />\n </>\n );\n}\n\nconst EMPTY: readonly SearchEntry[] = [];\n"],"mappings":";AA+O8D,SAsS1D,UAtS0D,KAsS1D,YAtS0D;AA/O9D,SAAS,aAAa,WAAW,iBAAiB,SAAS,QAAQ,gBAAgB;AAEnF,SAAS,SAAS,oBAAoB,mBAAmB;AACzD,SAAS,aAAa,SAAS,cAAc;AAC7C,SAAS,eAAe;AACxB,SAAS,4BAA4B;AACrC,SAAS,UAAU;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W;AAAA,gBACtD,OAAO,oBAAoB,SAAY,SAAY,EAAE,OAAO,iBAAiB,QAAQ,gBAAgB;AAAA;AAAA,YACvG;AAAA;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IAEN;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,SAAS,MAAM,QAAQ,KAAK;AAAA,QAC5B,QAAQ;AAAA,QACR,UAAU;AAAA,QACV;AAAA,QACA,eAAe;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,QAAQ;AAAA;AAAA,IACV;AAAA,KACF;AAEJ;AAEA,MAAM,QAAgC,CAAC;","names":["out","list"]}
|
package/dist/search.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { CommandItem, CommandPalette, CommandPaletteDensity, CommandPaletteLabels, DEFAULT_COMMAND_PALETTE_LABELS, useCommandKey } from './search/command-palette.js';
|
|
2
2
|
export { SEARCH_TIER_POINTS, SearchEntry, SearchHit, SearchIndex, SearchIndexOptions, SearchMatchField, createSearchIndex, matchEntries, normalizeSearchText } from './search/search-index.js';
|
|
3
|
-
export { DEFAULT_GLOBAL_SEARCH_LABELS, GlobalSearch, GlobalSearchLabels, GlobalSearchProps, GlobalSearchSource, GlobalSearchSuggestion, GlobalSearchTriggerProps } from './search/global-search.js';
|
|
3
|
+
export { DEFAULT_GLOBAL_SEARCH_LABELS, GlobalSearch, GlobalSearchLabels, GlobalSearchProps, GlobalSearchSource, GlobalSearchSourceGroup, GlobalSearchSuggestion, GlobalSearchTriggerProps } from './search/global-search.js';
|
|
4
4
|
import 'react';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
3
3
|
import { LucideIcon } from 'lucide-react';
|
|
4
|
-
import {
|
|
4
|
+
import { aE as KitLinkComponent } from '../kit-labels-C4uB_zmg.js';
|
|
5
5
|
import '../components/data-table-labels.js';
|
|
6
6
|
import '../components/mini-calendar.js';
|
|
7
7
|
import '../components/calendar-heatmap.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { aF as KitLinkProps, aE as KitLinkComponent } from '../kit-labels-C4uB_zmg.js';
|
|
4
4
|
import '../components/data-table-labels.js';
|
|
5
5
|
import '../components/mini-calendar.js';
|
|
6
6
|
import '../components/calendar-heatmap.js';
|
package/dist/shell.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import './theme/theme-store.js';
|
|
|
13
13
|
import 'zustand/middleware';
|
|
14
14
|
import 'zustand';
|
|
15
15
|
import 'lucide-react';
|
|
16
|
-
import './kit-labels-
|
|
16
|
+
import './kit-labels-C4uB_zmg.js';
|
|
17
17
|
import './components/data-table-labels.js';
|
|
18
18
|
import './components/mini-calendar.js';
|
|
19
19
|
import './components/calendar-heatmap.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, ReactElement } from 'react';
|
|
3
|
-
import { f as ButtonVariant } from '../kit-labels-
|
|
3
|
+
import { f as ButtonVariant } from '../kit-labels-C4uB_zmg.js';
|
|
4
4
|
import { UseWizardReturn, WizardLabels } from './types.js';
|
|
5
5
|
import '../components/data-table-labels.js';
|
|
6
6
|
import '../components/mini-calendar.js';
|
package/dist/wizard.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { WizardStep, WizardStepProps } from './wizard/wizard-step.js';
|
|
|
6
6
|
export { WizardSummary } from './wizard/wizard-summary.js';
|
|
7
7
|
export { StepperNav } from './wizard/stepper-nav.js';
|
|
8
8
|
import 'react';
|
|
9
|
-
import './kit-labels-
|
|
9
|
+
import './kit-labels-C4uB_zmg.js';
|
|
10
10
|
import './components/data-table-labels.js';
|
|
11
11
|
import './components/mini-calendar.js';
|
|
12
12
|
import './components/calendar-heatmap.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eifi1/ui-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "App-agnostic shared design system: domain-free React components, theme and tokens.",
|
|
6
6
|
"_sideEffects": "The barrel (src/index.ts) re-exports EVERY component, including components/chart, which statically imports recharts. Without this field a bundler must assume each of those modules has side effects, so it cannot drop the unused ones: importing a Button from '@eifi1/ui-kit' dragged all 433KB of recharts into the consumer's ENTRY chunk, and Keksdose was preloading it on every page load, login included. Nothing in src/ imports for side effects (no bare imports, no CSS imports from JS, no module-level global writes) — the token stylesheet is its own './tokens.css' export — so this is safe. CSS is still listed so any future stylesheet survives. Re-checked when `flag-icons` left `dependencies` and tsup started emitting a `\"use client\"` banner: neither touches this. The flag stylesheet was never imported from JS in the first place (that was the finding), and a directive prologue is a string literal every bundler lifts out before it decides whether a module is inert.",
|
|
@@ -175,6 +175,14 @@ interface AmountInputProps {
|
|
|
175
175
|
* 1.789 €/l is stored as 123.46 / 1.79, and no test fails (keksdose G2, a
|
|
176
176
|
* `Numeric(18,6)` holding price and a `Numeric(18,4)` unit price). Pass the column's
|
|
177
177
|
* scale: `digits={4}`, `digits={6}`.
|
|
178
|
+
*
|
|
179
|
+
* **Set `digits` for any sub-currency scale** — not only a price: any field whose
|
|
180
|
+
* column holds more decimals than the currency's minor unit. A split line stored at
|
|
181
|
+
* the ledger's 4dp (`Numeric(18,4)`) and loaded as 12.3456 is SHOWN as 12.35, and
|
|
182
|
+
* committed as 12.35 as soon as the user tabs through it (blur settles) — so the form
|
|
183
|
+
* no longer equals what the server holds: the lines stop summing to the 4dp total,
|
|
184
|
+
* and Save is held (keksdose live #240). With a `currency`, every commit rounds to that currency's
|
|
185
|
+
* minor unit unless `digits` says otherwise: pass the column's scale (`digits={4}`).
|
|
178
186
|
*/
|
|
179
187
|
digits?: number;
|
|
180
188
|
/** The smallest amount the field settles on. A lower figure is raised to it when it
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
1
|
+
import { Fragment, useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
2
2
|
import type { CSSProperties, ReactNode, TdHTMLAttributes, ThHTMLAttributes } from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
4
|
import {
|
|
@@ -101,6 +101,26 @@ export interface DataTableColumn<T> {
|
|
|
101
101
|
* width a resize pins stay the table's, and the class list goes before
|
|
102
102
|
* `headClassName` for the same reason as in {@link cellProps}. */
|
|
103
103
|
headProps?: DataTableHeadProps;
|
|
104
|
+
/**
|
|
105
|
+
* This column's cell in the table's totals row — a `<tfoot>` on a wide screen, a
|
|
106
|
+
* labelled summary card under the list on a phone. kastlan's trial balance is why
|
|
107
|
+
* it exists: it hand-built a debit/credit/balance strip in a `div` UNDER the table,
|
|
108
|
+
* which lined up with no column, dropped out of the table's semantics, and stayed
|
|
109
|
+
* put when the user hid or resized the columns it was summing.
|
|
110
|
+
*
|
|
111
|
+
* `rows` is every row that passes the current filters (in the current sort order),
|
|
112
|
+
* NOT just the page on screen: a total that changes when the user pages is not a
|
|
113
|
+
* total, and the trial balance has to balance on page 1 as much as on page 7. The
|
|
114
|
+
* page is the second argument for the rare "subtotal of this page" footer.
|
|
115
|
+
*
|
|
116
|
+
* Under `serverPagination` the table only ever holds one page, so both arguments are
|
|
117
|
+
* that page — a server-side table computes its totals on the server and returns
|
|
118
|
+
* them here (`footer: () => fmt(response.totalDebit)`), ignoring the arguments.
|
|
119
|
+
*
|
|
120
|
+
* The cell takes the column's `className` (so a `text-end` amount column totals
|
|
121
|
+
* end-aligned), its resized width, and drops out with the column when it is hidden.
|
|
122
|
+
*/
|
|
123
|
+
footer?: (rows: T[], page: T[]) => ReactNode;
|
|
104
124
|
}
|
|
105
125
|
|
|
106
126
|
/** A `data-*` attribute, typed so `{ "data-private": "" }` needs no cast. */
|
|
@@ -466,6 +486,26 @@ export interface DataTableProps<T> {
|
|
|
466
486
|
* pages set a search box in a `div` above the card, outside the frame it filters).
|
|
467
487
|
*/
|
|
468
488
|
toolbar?: ReactNode;
|
|
489
|
+
/**
|
|
490
|
+
* The totals row's name — "Total", "Summe", "Totals as of 30 June". It is the row's
|
|
491
|
+
* header: rendered as a `<th scope="row">` in the first visible column that has no
|
|
492
|
+
* `footer` of its own (falling back to the first visible column if every one has a
|
|
493
|
+
* value), so a screen reader reads "Total, Debit, 12 400.00" for the cell beside it.
|
|
494
|
+
* On a phone it heads the summary card, which is also named by it.
|
|
495
|
+
*
|
|
496
|
+
* There is no built-in default word: a new kit label key is a silent English string
|
|
497
|
+
* in every translated app (see `missingDataTableLabels`), and the caller has the
|
|
498
|
+
* word in its own catalogue already. Without it the row is unlabelled on screen —
|
|
499
|
+
* pass one.
|
|
500
|
+
*/
|
|
501
|
+
footerLabel?: ReactNode;
|
|
502
|
+
/**
|
|
503
|
+
* Show the totals row. Default: shown when any column declares a `footer`. Set
|
|
504
|
+
* false to drop it without touching the column definitions (a "show totals"
|
|
505
|
+
* switch). The row is also left out while there are no rows to total — a row of
|
|
506
|
+
* zeroes under "No results" says nothing the empty state has not.
|
|
507
|
+
*/
|
|
508
|
+
footer?: boolean;
|
|
469
509
|
}
|
|
470
510
|
|
|
471
511
|
/** One entry of {@link DataTableProps.rowActions}. */
|
|
@@ -590,6 +630,15 @@ function logicalAlign(className: string | undefined): string | undefined {
|
|
|
590
630
|
);
|
|
591
631
|
}
|
|
592
632
|
|
|
633
|
+
/**
|
|
634
|
+
* A totals-row cell: pinned to the scroller's bottom edge, on the header's surface.
|
|
635
|
+
* The rule above it is an inset shadow rather than a `border-t`: the table collapses
|
|
636
|
+
* its borders, and a collapsed border belongs to the TABLE, not the cell, so it stays
|
|
637
|
+
* behind at the bottom of the rows while the sticky cell rides over them.
|
|
638
|
+
*/
|
|
639
|
+
const FOOTER_CELL =
|
|
640
|
+
"sticky bottom-0 z-10 bg-[var(--bg-surface-2)] shadow-[inset_0_2px_0_var(--border-strong)]";
|
|
641
|
+
|
|
593
642
|
/** Whether a column is end-aligned — the header then puts its filter button first. */
|
|
594
643
|
const END_ALIGN = /(^|\s)text-end(?=\s|$)/;
|
|
595
644
|
|
|
@@ -801,6 +850,8 @@ export function DataTable<T>({
|
|
|
801
850
|
className,
|
|
802
851
|
rowActions,
|
|
803
852
|
toolbar,
|
|
853
|
+
footerLabel,
|
|
854
|
+
footer: footerProp,
|
|
804
855
|
}: DataTableProps<T>) {
|
|
805
856
|
const compact = density === "compact";
|
|
806
857
|
const minimal = chrome === "minimal";
|
|
@@ -1192,7 +1243,7 @@ export function DataTable<T>({
|
|
|
1192
1243
|
// `setWidths` is called once, when the drag ends.
|
|
1193
1244
|
const resizing = useRef<Resize | null>(null);
|
|
1194
1245
|
|
|
1195
|
-
/** Every cell in one column, header first. `data-col` rather than a cell index:
|
|
1246
|
+
/** Every cell in one column, header first, totals row included. `data-col` rather than a cell index:
|
|
1196
1247
|
* an expanded row holds a single `colSpan` cell, so the nth `<td>` of a row is
|
|
1197
1248
|
* not reliably the nth column. */
|
|
1198
1249
|
const columnCells = (key: string): HTMLElement[] => {
|
|
@@ -1202,7 +1253,7 @@ export function DataTable<T>({
|
|
|
1202
1253
|
if (!table) return [th];
|
|
1203
1254
|
return [
|
|
1204
1255
|
th,
|
|
1205
|
-
...Array.from(table.querySelectorAll<HTMLElement>("tbody [data-col]")).filter(
|
|
1256
|
+
...Array.from(table.querySelectorAll<HTMLElement>("tbody [data-col], tfoot [data-col]")).filter(
|
|
1206
1257
|
(el) => el.dataset.col === key,
|
|
1207
1258
|
),
|
|
1208
1259
|
];
|
|
@@ -1309,6 +1360,21 @@ export function DataTable<T>({
|
|
|
1309
1360
|
const totalCount = columns.length;
|
|
1310
1361
|
// Spans the full row width including the optional leading selection column.
|
|
1311
1362
|
const totalColSpan = visibleCount + (selection ? 1 : 0);
|
|
1363
|
+
|
|
1364
|
+
// ---- Totals row ----
|
|
1365
|
+
// `sorted`, not `slice`: the totals are of everything the filters let through, so
|
|
1366
|
+
// paging does not move them — see `DataTableColumn.footer`. In server mode `sorted`
|
|
1367
|
+
// IS the page (the table holds nothing else), which the prop's note spells out.
|
|
1368
|
+
const hasFooterColumns = columns.some((c) => c.footer);
|
|
1369
|
+
const showFooter = footerProp !== false && hasFooterColumns && sorted.length > 0;
|
|
1370
|
+
// The row header sits in the first visible column that has nothing of its own to
|
|
1371
|
+
// show — so hiding the "Account" column moves "Total" into "Name" rather than
|
|
1372
|
+
// dropping it — and on the first visible column when every one carries a value.
|
|
1373
|
+
const footerLabelCol = showFooter
|
|
1374
|
+
? (visibleColumns.find((c) => !c.footer && c.key !== ROW_ACTIONS_KEY) ?? visibleColumns[0])
|
|
1375
|
+
: undefined;
|
|
1376
|
+
const footerValue = (col: DataTableColumn<T>) => col.footer?.(sorted, slice);
|
|
1377
|
+
const footerHeadingId = useId();
|
|
1312
1378
|
// The actions column is the table's own, not one the user can hide: out of the count.
|
|
1313
1379
|
const columnsCountLabel = rowActions
|
|
1314
1380
|
? labels.columnsCount(visibleCount - 1, totalCount - 1)
|
|
@@ -1725,6 +1791,49 @@ export function DataTable<T>({
|
|
|
1725
1791
|
</li>
|
|
1726
1792
|
)}
|
|
1727
1793
|
</ul>
|
|
1794
|
+
{/* The phone's totals: a summary card after the list rather than one more
|
|
1795
|
+
`<li>` in it. The list reveals rows in chunks as it is scrolled, so a last
|
|
1796
|
+
item would sit mid-list until the end was reached; outside it, and under
|
|
1797
|
+
`fillHeight` outside the scroller too, the totals stay in view the way the
|
|
1798
|
+
sticky `<tfoot>` keeps them in view on a wide screen. Named by
|
|
1799
|
+
`footerLabel` so it is announced as what it is, not as a stray list of
|
|
1800
|
+
numbers; `mobileHidden` columns stay hidden here as on the cards. */}
|
|
1801
|
+
{showFooter && mobileColumns.some((c) => c.footer) && (
|
|
1802
|
+
<section
|
|
1803
|
+
data-table-footer=""
|
|
1804
|
+
aria-labelledby={footerLabel != null ? footerHeadingId : undefined}
|
|
1805
|
+
className={cn(
|
|
1806
|
+
"border-t-2 border-[var(--border-strong)] bg-[var(--bg-surface-2)]",
|
|
1807
|
+
compact ? "px-3 py-2" : "px-4 py-3",
|
|
1808
|
+
isLoading && "opacity-60 transition-opacity",
|
|
1809
|
+
)}
|
|
1810
|
+
>
|
|
1811
|
+
{footerLabel != null && (
|
|
1812
|
+
<div id={footerHeadingId} className={cn("font-semibold", compact ? "mb-1 text-sm" : "mb-2")}>
|
|
1813
|
+
{footerLabel}
|
|
1814
|
+
</div>
|
|
1815
|
+
)}
|
|
1816
|
+
<dl
|
|
1817
|
+
className={cn(
|
|
1818
|
+
"grid grid-cols-[auto_1fr] gap-x-3",
|
|
1819
|
+
compact ? "gap-y-0.5 text-xs" : "gap-y-1 text-sm",
|
|
1820
|
+
)}
|
|
1821
|
+
>
|
|
1822
|
+
{mobileColumns
|
|
1823
|
+
.filter((c) => c.footer)
|
|
1824
|
+
.map((col) => (
|
|
1825
|
+
<Fragment key={col.key}>
|
|
1826
|
+
<dt className="self-center text-xs uppercase tracking-wide text-[var(--text-muted)]">
|
|
1827
|
+
{col.header}
|
|
1828
|
+
</dt>
|
|
1829
|
+
<dd className="min-w-0 self-center font-semibold text-[var(--text-primary)]">
|
|
1830
|
+
{footerValue(col)}
|
|
1831
|
+
</dd>
|
|
1832
|
+
</Fragment>
|
|
1833
|
+
))}
|
|
1834
|
+
</dl>
|
|
1835
|
+
</section>
|
|
1836
|
+
)}
|
|
1728
1837
|
{/* Client-side mobile lists scroll endlessly (sentinel above); only
|
|
1729
1838
|
server-paginated tables keep the pager here. */}
|
|
1730
1839
|
{isServer && (
|
|
@@ -2166,6 +2275,59 @@ export function DataTable<T>({
|
|
|
2166
2275
|
</tr>
|
|
2167
2276
|
)}
|
|
2168
2277
|
</tbody>
|
|
2278
|
+
{showFooter && (
|
|
2279
|
+
// Sticky to the scroller's bottom edge for the same reason the header is
|
|
2280
|
+
// sticky to its top: the body scrolls inside a bounded wrapper, and a
|
|
2281
|
+
// total that scrolls away with the last row is a total nobody sees on a
|
|
2282
|
+
// 25-row page. Each cell carries its own background and its own `sticky`,
|
|
2283
|
+
// as the header's do — `position: sticky` on a `<tfoot>` is not reliable.
|
|
2284
|
+
<tfoot
|
|
2285
|
+
data-table-footer=""
|
|
2286
|
+
className={cn(
|
|
2287
|
+
"font-semibold text-[var(--text-primary)]",
|
|
2288
|
+
isLoading && "opacity-60 transition-opacity",
|
|
2289
|
+
)}
|
|
2290
|
+
>
|
|
2291
|
+
<tr>
|
|
2292
|
+
{/* The selection column has nothing to total: an empty cell keeps the
|
|
2293
|
+
values under their own headers. */}
|
|
2294
|
+
{selection && (
|
|
2295
|
+
<td
|
|
2296
|
+
className={cn(
|
|
2297
|
+
FOOTER_CELL,
|
|
2298
|
+
compact ? "w-8 px-2 py-1" : "w-10 px-3 py-2",
|
|
2299
|
+
)}
|
|
2300
|
+
/>
|
|
2301
|
+
)}
|
|
2302
|
+
{visibleColumns.map((col) => {
|
|
2303
|
+
const width = widths[col.key];
|
|
2304
|
+
const pinned = width ? { width, minWidth: width, maxWidth: width } : undefined;
|
|
2305
|
+
const isLabel = col === footerLabelCol;
|
|
2306
|
+
const Cell = isLabel ? "th" : "td";
|
|
2307
|
+
return (
|
|
2308
|
+
<Cell
|
|
2309
|
+
key={col.key}
|
|
2310
|
+
data-col={col.key}
|
|
2311
|
+
scope={isLabel ? "row" : undefined}
|
|
2312
|
+
style={pinned}
|
|
2313
|
+
className={cn(
|
|
2314
|
+
FOOTER_CELL,
|
|
2315
|
+
"align-top",
|
|
2316
|
+
compact ? "px-2 py-1" : "px-3 py-2",
|
|
2317
|
+
width && "overflow-hidden text-ellipsis",
|
|
2318
|
+
// A `<th>` centres by default; the label reads from the start
|
|
2319
|
+
// like the cells above it, unless the column says otherwise.
|
|
2320
|
+
isLabel && "text-start",
|
|
2321
|
+
logicalAlign(col.className),
|
|
2322
|
+
)}
|
|
2323
|
+
>
|
|
2324
|
+
{col.footer ? footerValue(col) : isLabel ? footerLabel : null}
|
|
2325
|
+
</Cell>
|
|
2326
|
+
);
|
|
2327
|
+
})}
|
|
2328
|
+
</tr>
|
|
2329
|
+
</tfoot>
|
|
2330
|
+
)}
|
|
2169
2331
|
</table>
|
|
2170
2332
|
</div>
|
|
2171
2333
|
{!unpaged && (
|