@eifi1/ui-kit 0.17.0 → 0.18.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.
Files changed (167) hide show
  1. package/README.md +29 -4
  2. package/dist/chart.d.ts +10 -1
  3. package/dist/components/account-chips.d.ts +153 -0
  4. package/dist/components/account-chips.js +135 -0
  5. package/dist/components/account-chips.js.map +1 -0
  6. package/dist/components/account-settings-labels.d.ts +10 -2
  7. package/dist/components/account-settings-labels.js +3 -0
  8. package/dist/components/account-settings-labels.js.map +1 -1
  9. package/dist/components/amount-input.d.ts +10 -1
  10. package/dist/components/button-group.d.ts +10 -1
  11. package/dist/components/calculator.d.ts +10 -1
  12. package/dist/components/chip.d.ts +25 -1
  13. package/dist/components/chip.js +143 -6
  14. package/dist/components/chip.js.map +1 -1
  15. package/dist/components/confirm-dialog.d.ts +42 -1
  16. package/dist/components/confirm-dialog.js +36 -5
  17. package/dist/components/confirm-dialog.js.map +1 -1
  18. package/dist/components/copy-button.d.ts +10 -1
  19. package/dist/components/danger-confirm.d.ts +55 -4
  20. package/dist/components/danger-confirm.js +67 -30
  21. package/dist/components/danger-confirm.js.map +1 -1
  22. package/dist/components/data-table-cells.d.ts +1 -1
  23. package/dist/components/data-table-filter-popover.d.ts +1 -1
  24. package/dist/components/data-table-filters.d.ts +1 -1
  25. package/dist/components/data-table.d.ts +1 -1
  26. package/dist/components/data-table.js +2 -0
  27. package/dist/components/data-table.js.map +1 -1
  28. package/dist/components/facing-pair.d.ts +10 -1
  29. package/dist/components/file-button.d.ts +10 -1
  30. package/dist/components/file-dropzone.d.ts +10 -1
  31. package/dist/components/form-actions.d.ts +10 -1
  32. package/dist/components/form-actions.js +3 -0
  33. package/dist/components/form-actions.js.map +1 -1
  34. package/dist/components/money-field.d.ts +10 -1
  35. package/dist/components/number-field.d.ts +11 -2
  36. package/dist/components/number-field.js +23 -22
  37. package/dist/components/number-field.js.map +1 -1
  38. package/dist/components/number-input.d.ts +10 -1
  39. package/dist/components/numpad-sheet.d.ts +10 -1
  40. package/dist/components/passkeys-setting.d.ts +27 -1
  41. package/dist/components/passkeys-setting.js +31 -5
  42. package/dist/components/passkeys-setting.js.map +1 -1
  43. package/dist/components/progress-bar.d.ts +15 -1
  44. package/dist/components/progress-bar.js +8 -1
  45. package/dist/components/progress-bar.js.map +1 -1
  46. package/dist/components/reauth-dialog.d.ts +90 -0
  47. package/dist/components/reauth-dialog.js +158 -0
  48. package/dist/components/reauth-dialog.js.map +1 -0
  49. package/dist/components/series-chart.d.ts +10 -1
  50. package/dist/components/server-wake.d.ts +58 -0
  51. package/dist/components/server-wake.js +58 -0
  52. package/dist/components/server-wake.js.map +1 -0
  53. package/dist/components/settings-fields.d.ts +10 -1
  54. package/dist/components/share-card.d.ts +61 -0
  55. package/dist/components/share-card.js +350 -0
  56. package/dist/components/share-card.js.map +1 -0
  57. package/dist/components/status-dot.d.ts +2 -0
  58. package/dist/components/text-link.d.ts +10 -1
  59. package/dist/components/time-input.d.ts +10 -1
  60. package/dist/components/toast.d.ts +10 -1
  61. package/dist/components/toast.js +42 -2
  62. package/dist/components/toast.js.map +1 -1
  63. package/dist/components/toggle-group.js +5 -2
  64. package/dist/components/toggle-group.js.map +1 -1
  65. package/dist/components/ui.d.ts +10 -1
  66. package/dist/components/ui.js +43 -28
  67. package/dist/components/ui.js.map +1 -1
  68. package/dist/components/use-table-state.d.ts +1 -1
  69. package/dist/components/user-avatar.d.ts +2 -0
  70. package/dist/components/write-lock.d.ts +68 -0
  71. package/dist/components/write-lock.js +33 -0
  72. package/dist/components/write-lock.js.map +1 -0
  73. package/dist/{data-table-CpkWUJBY.d.ts → data-table-3mi2R3so.d.ts} +19 -1
  74. package/dist/data-table.d.ts +1 -1
  75. package/dist/hooks/use-file-drop.d.ts +10 -1
  76. package/dist/hooks/use-overlay-history.js +16 -0
  77. package/dist/hooks/use-overlay-history.js.map +1 -1
  78. package/dist/i18n/defaults.d.ts +10 -1
  79. package/dist/i18n/defaults.js +11 -1
  80. package/dist/i18n/defaults.js.map +1 -1
  81. package/dist/i18n/german.d.ts +78 -0
  82. package/dist/i18n/{locales/de.js → german.js} +59 -9
  83. package/dist/i18n/german.js.map +1 -0
  84. package/dist/i18n/kit-labels.d.ts +10 -1
  85. package/dist/i18n/kit-labels.js +5 -0
  86. package/dist/i18n/kit-labels.js.map +1 -1
  87. package/dist/i18n/locales/de-CH.d.ts +23 -8
  88. package/dist/i18n/locales/de-CH.js +7 -3
  89. package/dist/i18n/locales/de-CH.js.map +1 -1
  90. package/dist/i18n/locales/en.d.ts +10 -1
  91. package/dist/i18n/locales/es.d.ts +10 -1
  92. package/dist/i18n/locales/es.js +51 -1
  93. package/dist/i18n/locales/es.js.map +1 -1
  94. package/dist/i18n/locales/fr.d.ts +10 -1
  95. package/dist/i18n/locales/fr.js +51 -1
  96. package/dist/i18n/locales/fr.js.map +1 -1
  97. package/dist/i18n/locales/hu.d.ts +10 -1
  98. package/dist/i18n/locales/hu.js +54 -1
  99. package/dist/i18n/locales/hu.js.map +1 -1
  100. package/dist/i18n/locales/it.d.ts +10 -1
  101. package/dist/i18n/locales/it.js +51 -1
  102. package/dist/i18n/locales/it.js.map +1 -1
  103. package/dist/i18n/locales/zh.d.ts +10 -1
  104. package/dist/i18n/locales/zh.js +50 -1
  105. package/dist/i18n/locales/zh.js.map +1 -1
  106. package/dist/i18n/swiss.d.ts +3 -3
  107. package/dist/i18n/swiss.js.map +1 -1
  108. package/dist/index.d.ts +9 -4
  109. package/dist/index.js +33 -1
  110. package/dist/index.js.map +1 -1
  111. package/dist/{kit-labels-C4uB_zmg.d.ts → kit-labels-CPbsjlXr.d.ts} +229 -9
  112. package/dist/lib/server-wake.d.ts +130 -0
  113. package/dist/lib/server-wake.js +121 -0
  114. package/dist/lib/server-wake.js.map +1 -0
  115. package/dist/rhf/fields.d.ts +10 -1
  116. package/dist/rhf/form.d.ts +10 -1
  117. package/dist/rhf.d.ts +10 -1
  118. package/dist/search/global-search.d.ts +3 -1
  119. package/dist/search/global-search.js.map +1 -1
  120. package/dist/shell/app-shell.d.ts +10 -1
  121. package/dist/shell/top-bar-brand.d.ts +10 -1
  122. package/dist/shell/topbar-action-menu.d.ts +2 -0
  123. package/dist/shell.d.ts +10 -1
  124. package/dist/wizard/stepper-nav.d.ts +10 -1
  125. package/dist/wizard.d.ts +10 -1
  126. package/package.json +1 -1
  127. package/src/components/account-chips.tsx +302 -0
  128. package/src/components/account-settings-labels.ts +16 -2
  129. package/src/components/chip.tsx +239 -6
  130. package/src/components/confirm-dialog.tsx +82 -7
  131. package/src/components/danger-confirm.tsx +118 -33
  132. package/src/components/data-table.tsx +20 -0
  133. package/src/components/form-actions.tsx +22 -3
  134. package/src/components/number-field.tsx +32 -26
  135. package/src/components/passkeys-setting.tsx +68 -7
  136. package/src/components/progress-bar.tsx +21 -1
  137. package/src/components/reauth-dialog.tsx +273 -0
  138. package/src/components/server-wake.tsx +124 -0
  139. package/src/components/share-card.tsx +615 -0
  140. package/src/components/toast.tsx +72 -2
  141. package/src/components/toggle-group.tsx +5 -2
  142. package/src/components/ui.tsx +89 -32
  143. package/src/components/write-lock.tsx +96 -0
  144. package/src/hooks/use-overlay-history.ts +51 -0
  145. package/src/i18n/defaults.ts +10 -0
  146. package/src/i18n/{locales/de.ts → german.ts} +68 -13
  147. package/src/i18n/kit-labels.tsx +22 -2
  148. package/src/i18n/locales/de-CH.ts +17 -8
  149. package/src/i18n/locales/es.ts +51 -0
  150. package/src/i18n/locales/fr.ts +52 -0
  151. package/src/i18n/locales/hu.ts +55 -0
  152. package/src/i18n/locales/it.ts +51 -0
  153. package/src/i18n/locales/zh.ts +50 -0
  154. package/src/i18n/swiss.ts +3 -3
  155. package/src/index.ts +23 -1
  156. package/src/lib/server-wake.ts +270 -0
  157. package/src/search/global-search.tsx +3 -1
  158. package/dist/i18n/locales/de-CH-informal.d.ts +0 -61
  159. package/dist/i18n/locales/de-CH-informal.js +0 -8
  160. package/dist/i18n/locales/de-CH-informal.js.map +0 -1
  161. package/dist/i18n/locales/de-informal.d.ts +0 -82
  162. package/dist/i18n/locales/de-informal.js +0 -37
  163. package/dist/i18n/locales/de-informal.js.map +0 -1
  164. package/dist/i18n/locales/de.d.ts +0 -66
  165. package/dist/i18n/locales/de.js.map +0 -1
  166. package/src/i18n/locales/de-CH-informal.ts +0 -10
  167. package/src/i18n/locales/de-informal.ts +0 -61
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, ReactElement } from 'react';
3
3
  import { FieldValues, FieldPath, ControllerProps, ControllerRenderProps, ControllerFieldState } from 'react-hook-form';
4
- import { aP as SelectProps, aD as InputProps, aY as TextareaProps } from '../kit-labels-C4uB_zmg.js';
4
+ import { aQ as SelectProps, aE as InputProps, b9 as TextareaProps } from '../kit-labels-CPbsjlXr.js';
5
5
  import { NumberFieldProps } from '../components/number-field.js';
6
6
  import { DatePickerProps } from '../components/date-picker.js';
7
7
  import { CheckboxProps } from '../components/checkbox.js';
@@ -58,6 +58,15 @@ import '../components/authed-image.js';
58
58
  import '../hooks/use-authed-src.js';
59
59
  import '../components/image-grid.js';
60
60
  import '../components/lightbox.js';
61
+ import '../components/write-lock.js';
62
+ import '../components/account-chips.js';
63
+ import '../lib/format.js';
64
+ import '../data-table-3mi2R3so.js';
65
+ import '../components/data-table-sort.js';
66
+ import '../components/swipeable-row.js';
67
+ import '../components/reauth-dialog.js';
68
+ import '../components/server-wake.js';
69
+ import '../lib/server-wake.js';
61
70
  import '../components/number-input.js';
62
71
  import '../components/calculator.js';
63
72
  import '../components/numpad-sheet.js';
@@ -2,7 +2,7 @@ import * as react from 'react';
2
2
  import { ReactElement, ComponentProps } from 'react';
3
3
  import * as react_hook_form from 'react-hook-form';
4
4
  import { FieldValues, FieldPath, ControllerProps } from 'react-hook-form';
5
- import { aI as LabelProps } from '../kit-labels-C4uB_zmg.js';
5
+ import { aJ as LabelProps } from '../kit-labels-CPbsjlXr.js';
6
6
  import '../components/data-table-labels.js';
7
7
  import '../components/mini-calendar.js';
8
8
  import '../components/calendar-heatmap.js';
@@ -53,6 +53,15 @@ import '../components/authed-image.js';
53
53
  import '../hooks/use-authed-src.js';
54
54
  import '../components/image-grid.js';
55
55
  import '../components/lightbox.js';
56
+ import '../components/write-lock.js';
57
+ import '../components/account-chips.js';
58
+ import '../lib/format.js';
59
+ import '../data-table-3mi2R3so.js';
60
+ import '../components/data-table-sort.js';
61
+ import '../components/swipeable-row.js';
62
+ import '../components/reauth-dialog.js';
63
+ import '../components/server-wake.js';
64
+ import '../lib/server-wake.js';
56
65
 
57
66
  /** The form's `useForm()` return, spread in: `<Form {...form}>`. react-hook-form's own
58
67
  * `FormProvider`, under the name the shadcn file gave it. */
package/dist/rhf.d.ts CHANGED
@@ -4,7 +4,7 @@ export { RhfCheckbox, RhfCheckboxProps, RhfCombobox, RhfComboboxProps, RhfDateFi
4
4
  export { RhfLineItemCellContext, RhfLineItems, RhfLineItemsColumn, RhfLineItemsProps } from './rhf/line-items.js';
5
5
  import 'react';
6
6
  import 'react-hook-form';
7
- import './kit-labels-C4uB_zmg.js';
7
+ import './kit-labels-CPbsjlXr.js';
8
8
  import './components/data-table-labels.js';
9
9
  import './components/mini-calendar.js';
10
10
  import './components/calendar-heatmap.js';
@@ -55,6 +55,15 @@ import './components/authed-image.js';
55
55
  import './hooks/use-authed-src.js';
56
56
  import './components/image-grid.js';
57
57
  import './components/lightbox.js';
58
+ import './components/write-lock.js';
59
+ import './components/account-chips.js';
60
+ import './lib/format.js';
61
+ import './data-table-3mi2R3so.js';
62
+ import './components/data-table-sort.js';
63
+ import './components/swipeable-row.js';
64
+ import './components/reauth-dialog.js';
65
+ import './components/server-wake.js';
66
+ import './lib/server-wake.js';
58
67
  import './components/number-field.js';
59
68
  import './components/number-input.js';
60
69
  import './components/calculator.js';
@@ -27,7 +27,9 @@ interface GlobalSearchSource {
27
27
  /** Stable key — the effect that runs the source is keyed by it, not by identity. */
28
28
  id: string;
29
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
+ * `groups` is set, where it is only the home of entries that name no declared group.
31
+ * If every entry names a declared group, it is never shown: a catch-all heading such
32
+ * as "Other" is the honest value, so a stray type would still surface, labelled. */
31
33
  group: string;
32
34
  /**
33
35
  * Split ONE request into several groups — kastlan's record search answers with
@@ -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) — 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;AACnB,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB,gCAAgC,qBAAqB;AAE9E,SAAS,yBAAyB;AAiB3B,MAAM,+BAAmD;AAAA,EAC9D,SAAS;AAAA,EACT,aAAa;AAAA,EACb,UAAU,CAAC,SAAS,WAAW,IAAI;AAAA,EACnC,aAAa;AAAA,EACb,SAAS;AACX;AAoJA,SAAS,kBAA2B;AAClC,MAAI,OAAO,cAAc,YAAa,QAAO;AAC7C,QAAM,MAAM;AACZ,SAAO,wBAAwB,KAAK,IAAI,eAAe,YAAY,IAAI,YAAY,IAAI,SAAS;AAClG;AAEA,MAAM,WAAW,CAAC,SAAiB,OAAO,SAAS,OAAO,IAAI;AAC9D,MAAM,WAAW,CAAC,SAAiB;AAGnC,SAAS,UAAU,SAAyC;AAC1D,SAAO,QACJ;AAAA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a;AAAA,EAC1C;AAEA,QAAM,QAAQ,QAAQ,MAAM,gBAAgB,GAAG,CAAC,CAAC;AACjD,QAAM,OAAO,QAAQ,YAAO;AAC5B,QAAM,eAAe,gBAAgB,iBAAiB,EAAE,SAAS,IAAI,IAAI,EAAE;AAC3E,QAAM,eAAyC;AAAA,IAC7C,MAAM;AAAA,IACN,OAAO;AAAA,IACP,SAAS,EAAE,SAAS,IAAI;AAAA,IACxB;AAAA,IACA,kBAAkB;AAAA,EACpB;AAEA,SACE,iCACG;AAAA,WAAO,YAAY,aAChB,QAAQ,YAAY,IACpB,YAAY,YACV;AAAA,MAAC;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","list"]}
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 * If every entry names a declared group, it is never shown: a catch-all heading such\n * as \"Other\" is the honest value, so a stray type would still surface, labelled. */\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":";AAiP8D,SAsS1D,UAtS0D,KAsS1D,YAtS0D;AAjP9D,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;AACnB,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB,gCAAgC,qBAAqB;AAE9E,SAAS,yBAAyB;AAiB3B,MAAM,+BAAmD;AAAA,EAC9D,SAAS;AAAA,EACT,aAAa;AAAA,EACb,UAAU,CAAC,SAAS,WAAW,IAAI;AAAA,EACnC,aAAa;AAAA,EACb,SAAS;AACX;AAsJA,SAAS,kBAA2B;AAClC,MAAI,OAAO,cAAc,YAAa,QAAO;AAC7C,QAAM,MAAM;AACZ,SAAO,wBAAwB,KAAK,IAAI,eAAe,YAAY,IAAI,YAAY,IAAI,SAAS;AAClG;AAEA,MAAM,WAAW,CAAC,SAAiB,OAAO,SAAS,OAAO,IAAI;AAC9D,MAAM,WAAW,CAAC,SAAiB;AAGnC,SAAS,UAAU,SAAyC;AAC1D,SAAO,QACJ;AAAA,IAAI,CAAC,MACJ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,CAAC,GAAG,KAAK,GAAQ,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE;AAAA,MAC7G;AAAA,IACF;AAAA,EACF,EACC,KAAK,GAAQ;AAClB;AAIA,SAAS,eAAe;AACtB,wBAAsB,MAAM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IACxB;AAAA,IACA,kBAAkB;AAAA,EACpB;AAEA,SACE,iCACG;AAAA,WAAO,YAAY,aAChB,QAAQ,YAAY,IACpB,YAAY,YACV;AAAA,MAAC;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","list"]}
@@ -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 { aE as KitLinkComponent } from '../kit-labels-C4uB_zmg.js';
4
+ import { aF as KitLinkComponent } from '../kit-labels-CPbsjlXr.js';
5
5
  import '../components/data-table-labels.js';
6
6
  import '../components/mini-calendar.js';
7
7
  import '../components/calendar-heatmap.js';
@@ -51,6 +51,15 @@ import '../components/authed-image.js';
51
51
  import '../hooks/use-authed-src.js';
52
52
  import '../components/image-grid.js';
53
53
  import '../components/lightbox.js';
54
+ import '../components/write-lock.js';
55
+ import '../components/account-chips.js';
56
+ import '../lib/format.js';
57
+ import '../data-table-3mi2R3so.js';
58
+ import '../components/data-table-sort.js';
59
+ import '../components/swipeable-row.js';
60
+ import '../components/reauth-dialog.js';
61
+ import '../components/server-wake.js';
62
+ import '../lib/server-wake.js';
54
63
 
55
64
  interface AppShellSubItem {
56
65
  to: string;
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { aF as KitLinkProps, aE as KitLinkComponent } from '../kit-labels-C4uB_zmg.js';
3
+ import { aG as KitLinkProps, aF as KitLinkComponent } from '../kit-labels-CPbsjlXr.js';
4
4
  import '../components/data-table-labels.js';
5
5
  import '../components/mini-calendar.js';
6
6
  import '../components/calendar-heatmap.js';
@@ -51,6 +51,15 @@ import '../components/authed-image.js';
51
51
  import '../hooks/use-authed-src.js';
52
52
  import '../components/image-grid.js';
53
53
  import '../components/lightbox.js';
54
+ import '../components/write-lock.js';
55
+ import '../components/account-chips.js';
56
+ import '../lib/format.js';
57
+ import '../data-table-3mi2R3so.js';
58
+ import '../components/data-table-sort.js';
59
+ import '../components/swipeable-row.js';
60
+ import '../components/reauth-dialog.js';
61
+ import '../components/server-wake.js';
62
+ import '../lib/server-wake.js';
54
63
 
55
64
  interface TopBarBrandProps extends Omit<KitLinkProps, "href" | "children"> {
56
65
  /** The brand mark — an SVG, sized by the caller or `h-6 w-auto` by default. */
@@ -5,6 +5,8 @@ import { UserAvatarBadge } from '../components/user-avatar.js';
5
5
  import 'lucide-react';
6
6
  import '../components/status-dot.js';
7
7
  import '../components/progress-bar.js';
8
+ import '../components/signed-amount.js';
9
+ import '../components/stat-tile.js';
8
10
  import '../components/chip.js';
9
11
 
10
12
  /**
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-C4uB_zmg.js';
16
+ import './kit-labels-CPbsjlXr.js';
17
17
  import './components/data-table-labels.js';
18
18
  import './components/mini-calendar.js';
19
19
  import './components/calendar-heatmap.js';
@@ -63,6 +63,15 @@ import './components/authed-image.js';
63
63
  import './hooks/use-authed-src.js';
64
64
  import './components/image-grid.js';
65
65
  import './components/lightbox.js';
66
+ import './components/write-lock.js';
67
+ import './components/account-chips.js';
68
+ import './lib/format.js';
69
+ import './data-table-3mi2R3so.js';
70
+ import './components/data-table-sort.js';
71
+ import './components/swipeable-row.js';
72
+ import './components/reauth-dialog.js';
73
+ import './components/server-wake.js';
74
+ import './lib/server-wake.js';
66
75
  import './components/menu-item.js';
67
76
  import './components/user-avatar.js';
68
77
  import './components/status-dot.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-C4uB_zmg.js';
3
+ import { f as ButtonVariant } from '../kit-labels-CPbsjlXr.js';
4
4
  import { UseWizardReturn, WizardLabels } from './types.js';
5
5
  import '../components/data-table-labels.js';
6
6
  import '../components/mini-calendar.js';
@@ -51,6 +51,15 @@ import '../components/authed-image.js';
51
51
  import '../hooks/use-authed-src.js';
52
52
  import '../components/image-grid.js';
53
53
  import '../components/lightbox.js';
54
+ import '../components/write-lock.js';
55
+ import '../components/account-chips.js';
56
+ import '../lib/format.js';
57
+ import '../data-table-3mi2R3so.js';
58
+ import '../components/data-table-sort.js';
59
+ import '../components/swipeable-row.js';
60
+ import '../components/reauth-dialog.js';
61
+ import '../components/server-wake.js';
62
+ import '../lib/server-wake.js';
54
63
 
55
64
  /**
56
65
  * The chrome around a wizard: the step indicator, the step content, and the
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-C4uB_zmg.js';
9
+ import './kit-labels-CPbsjlXr.js';
10
10
  import './components/data-table-labels.js';
11
11
  import './components/mini-calendar.js';
12
12
  import './components/calendar-heatmap.js';
@@ -56,3 +56,12 @@ import './components/authed-image.js';
56
56
  import './hooks/use-authed-src.js';
57
57
  import './components/image-grid.js';
58
58
  import './components/lightbox.js';
59
+ import './components/write-lock.js';
60
+ import './components/account-chips.js';
61
+ import './lib/format.js';
62
+ import './data-table-3mi2R3so.js';
63
+ import './components/data-table-sort.js';
64
+ import './components/swipeable-row.js';
65
+ import './components/reauth-dialog.js';
66
+ import './components/server-wake.js';
67
+ import './lib/server-wake.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eifi1/ui-kit",
3
- "version": "0.17.0",
3
+ "version": "0.18.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.",