@echothink-ui/search 0.1.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 (40) hide show
  1. package/README.md +5 -0
  2. package/dist/components/AgentSearchSuggestion.d.ts +2 -0
  3. package/dist/components/AppCommandSearch.d.ts +2 -0
  4. package/dist/components/AppDomainSearch.d.ts +2 -0
  5. package/dist/components/EntitySearchInput.d.ts +4 -0
  6. package/dist/components/GlobalCommandPalette.d.ts +4 -0
  7. package/dist/components/ProjectCommandPalette.d.ts +2 -0
  8. package/dist/components/RecentItems.d.ts +2 -0
  9. package/dist/components/ResourceSearch.d.ts +2 -0
  10. package/dist/components/SavedSearches.d.ts +2 -0
  11. package/dist/components/SearchFacetPanel.d.ts +2 -0
  12. package/dist/components/SearchResultsPanel.d.ts +2 -0
  13. package/dist/components/SemanticSearchResult.d.ts +2 -0
  14. package/dist/components/searchUtils.d.ts +3 -0
  15. package/dist/components/types.d.ts +175 -0
  16. package/dist/index.cjs +1224 -0
  17. package/dist/index.cjs.map +1 -0
  18. package/dist/index.css +1460 -0
  19. package/dist/index.css.map +1 -0
  20. package/dist/index.d.ts +16 -0
  21. package/dist/index.js +1185 -0
  22. package/dist/index.js.map +1 -0
  23. package/package.json +43 -0
  24. package/src/components/AgentSearchSuggestion.tsx +44 -0
  25. package/src/components/AppCommandSearch.tsx +163 -0
  26. package/src/components/AppDomainSearch.tsx +90 -0
  27. package/src/components/EntitySearchInput.tsx +165 -0
  28. package/src/components/GlobalCommandPalette.tsx +182 -0
  29. package/src/components/ProjectCommandPalette.tsx +24 -0
  30. package/src/components/RecentItems.tsx +136 -0
  31. package/src/components/ResourceSearch.tsx +27 -0
  32. package/src/components/SavedSearches.tsx +27 -0
  33. package/src/components/SearchFacetPanel.tsx +100 -0
  34. package/src/components/SearchResultsPanel.tsx +327 -0
  35. package/src/components/SemanticSearchResult.tsx +52 -0
  36. package/src/components/searchUtils.ts +20 -0
  37. package/src/components/types.ts +208 -0
  38. package/src/index.test.tsx +254 -0
  39. package/src/index.tsx +55 -0
  40. package/src/styles.css +1716 -0
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # @echothink-ui/search
2
+
3
+ Search package for EchoThink app-domain websites.
4
+
5
+ This package is part of the EchoThink-UI app-domain library. It is designed for normal website app domains rendered inside EchoThink Studio's Chromium shell, not for implementing the studio browser chrome itself.
@@ -0,0 +1,2 @@
1
+ import type { AgentSearchSuggestionProps } from "./types";
2
+ export declare function AgentSearchSuggestion({ suggestion, className, onClick, ...props }: AgentSearchSuggestionProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { AppCommandSearchProps } from "./types";
2
+ export declare function AppCommandSearch({ value, defaultValue, placeholder, commands, kbdHint, scopeLabel, emptyText, onChange, onSelect, onSubmit, onKeyDown, className, ...props }: AppCommandSearchProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { AppDomainSearchProps } from "./types";
2
+ export declare function AppDomainSearch({ appDomainRef, placeholder, className, suggestions, value, defaultValue, onChange, onSearch, onSelect, open: _open, defaultOpen: _defaultOpen, loading: _loading, emptyText: _emptyText, onOpenChange: _onOpenChange, ...props }: AppDomainSearchProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import type { EntitySearchInputProps } from "./types";
2
+ export declare function EntitySearchInput({ placeholder, onSearch, suggestions, value, defaultValue, onChange, onSelect, suggestionsLabel, resultsLabel, loadingLabel, open, defaultOpen, loading, emptyText, onOpenChange, className, onBlur, onKeyDown, "data-eth-component": dataEthComponent, ...props }: EntitySearchInputProps & {
3
+ "data-eth-component"?: string;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import type { GlobalCommandPaletteProps } from "./types";
2
+ export declare function GlobalCommandPalette({ open, onClose, commands, heading, contextLabel, query, searchPlaceholder, onQueryChange, className, "data-eth-component": dataEthComponent, ...props }: GlobalCommandPaletteProps & {
3
+ "data-eth-component"?: string;
4
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ import type { ProjectCommandPaletteProps } from "./types";
2
+ export declare function ProjectCommandPalette({ projectRef, className, contextLabel, heading, searchPlaceholder, ...props }: ProjectCommandPaletteProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { RecentItemsProps } from "./types";
2
+ export declare function RecentItems({ items, emptyText, onSelect, className, "aria-label": ariaLabel, ...props }: RecentItemsProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { ResourceSearchProps } from "./types";
2
+ export declare function ResourceSearch({ resourceScope, placeholder, emptyText, suggestionsLabel, resultsLabel, loadingLabel, className, ...props }: ResourceSearchProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { SavedSearchesProps } from "./types";
2
+ export declare function SavedSearches({ searches, onRun, onDelete, className, ...props }: SavedSearchesProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { SearchFacetPanelProps } from "./types";
2
+ export declare function SearchFacetPanel({ facets, selected, onChange, className, "aria-label": ariaLabel, ...props }: SearchFacetPanelProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { SearchResultsPanelProps } from "./types";
2
+ export declare function SearchResultsPanel({ groups, query, totalCount, isLoading, emptyLabel, className, onResultSelect, onSelect, ...props }: SearchResultsPanelProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { SemanticSearchResultProps } from "./types";
2
+ export declare function SemanticSearchResult({ result, className, ...props }: SemanticSearchResultProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import type { CommandItem } from "./types";
2
+ export declare function filterCommands(commands: CommandItem[], query: string): CommandItem[];
3
+ export declare function groupBy<T>(items: T[], getKey: (item: T) => string): [string, T[]][];
@@ -0,0 +1,175 @@
1
+ import type * as React from "react";
2
+ export interface CommandItem {
3
+ id: string;
4
+ label: string;
5
+ hint?: string;
6
+ group?: string;
7
+ shortcut?: string;
8
+ onSelect: () => void;
9
+ }
10
+ export type AppCommandKind = "app-domain" | "resource" | "action";
11
+ export interface AppCommandItem {
12
+ id: string;
13
+ label: string;
14
+ description?: React.ReactNode;
15
+ domain?: string;
16
+ kind?: AppCommandKind;
17
+ shortcut?: string;
18
+ status?: React.ReactNode;
19
+ onSelect?: () => void;
20
+ }
21
+ export interface AppCommandSearchProps extends Omit<React.HTMLAttributes<HTMLElement>, "defaultValue" | "onChange" | "onSelect" | "onSubmit"> {
22
+ value?: string;
23
+ defaultValue?: string;
24
+ placeholder?: string;
25
+ commands?: AppCommandItem[];
26
+ kbdHint?: React.ReactNode;
27
+ scopeLabel?: React.ReactNode;
28
+ emptyText?: React.ReactNode;
29
+ onChange?: (value: string) => void;
30
+ onSelect?: (id: string) => void;
31
+ onSubmit?: (value: string) => void;
32
+ }
33
+ export interface GlobalCommandPaletteProps extends Omit<React.HTMLAttributes<HTMLElement>, "onSelect"> {
34
+ open: boolean;
35
+ onClose: () => void;
36
+ commands: CommandItem[];
37
+ heading?: React.ReactNode;
38
+ contextLabel?: React.ReactNode;
39
+ query?: string;
40
+ searchPlaceholder?: string;
41
+ onQueryChange?: (query: string) => void;
42
+ }
43
+ export interface ProjectCommandPaletteProps extends GlobalCommandPaletteProps {
44
+ projectRef: string;
45
+ }
46
+ export type SearchResultMetadata = React.ReactNode | {
47
+ label?: React.ReactNode;
48
+ value?: React.ReactNode;
49
+ };
50
+ export interface SearchResultItem {
51
+ id?: string;
52
+ label?: string;
53
+ title?: string;
54
+ name?: string;
55
+ description?: React.ReactNode;
56
+ excerpt?: React.ReactNode;
57
+ href?: string;
58
+ url?: string;
59
+ entityType?: string;
60
+ type?: string;
61
+ meta?: SearchResultMetadata | SearchResultMetadata[];
62
+ metadata?: SearchResultMetadata | SearchResultMetadata[];
63
+ owner?: React.ReactNode;
64
+ status?: React.ReactNode;
65
+ updatedAt?: React.ReactNode;
66
+ version?: string | number;
67
+ }
68
+ export interface SearchResultGroup {
69
+ id?: string;
70
+ label?: string;
71
+ title?: string;
72
+ type?: string;
73
+ entityType?: string;
74
+ count?: number;
75
+ results?: SearchResultItem[];
76
+ items?: SearchResultItem[];
77
+ }
78
+ export interface SearchResultsPanelProps extends Omit<React.HTMLAttributes<HTMLElement>, "onSelect"> {
79
+ groups?: SearchResultGroup[];
80
+ query?: string;
81
+ totalCount?: number;
82
+ isLoading?: boolean;
83
+ emptyLabel?: React.ReactNode;
84
+ onResultSelect?: (result: SearchResultItem, group: SearchResultGroup) => void;
85
+ onSelect?: (id: string) => void;
86
+ }
87
+ export interface SearchFacetOption {
88
+ value: string;
89
+ label: string;
90
+ count?: number;
91
+ disabled?: boolean;
92
+ }
93
+ export interface SearchFacet {
94
+ id: string;
95
+ label: string;
96
+ options: SearchFacetOption[];
97
+ }
98
+ export interface SearchFacetPanelProps extends Omit<React.HTMLAttributes<HTMLElement>, "onChange"> {
99
+ facets: SearchFacet[];
100
+ selected: Record<string, string[]>;
101
+ onChange: (selected: Record<string, string[]>) => void;
102
+ }
103
+ export interface SavedSearch extends Record<string, unknown> {
104
+ id: string;
105
+ label: string;
106
+ query: string;
107
+ updatedAt: string;
108
+ }
109
+ export interface SavedSearchesProps extends React.HTMLAttributes<HTMLElement> {
110
+ searches: SavedSearch[];
111
+ onRun?: (id: string) => void;
112
+ onDelete?: (id: string) => void;
113
+ }
114
+ export interface RecentItem extends Record<string, unknown> {
115
+ id: string;
116
+ label: string;
117
+ kind: string;
118
+ description?: React.ReactNode;
119
+ href?: string;
120
+ visitedAt: string;
121
+ }
122
+ export interface RecentItemsProps extends Omit<React.HTMLAttributes<HTMLElement>, "onSelect"> {
123
+ items: RecentItem[];
124
+ emptyText?: React.ReactNode;
125
+ onSelect?: (id: string) => void;
126
+ }
127
+ export interface EntitySuggestion {
128
+ id: string;
129
+ label: string;
130
+ kind?: string;
131
+ meta?: React.ReactNode;
132
+ }
133
+ export interface EntitySearchInputProps extends Omit<React.HTMLAttributes<HTMLElement>, "defaultValue" | "onChange" | "onSelect"> {
134
+ placeholder?: string;
135
+ value?: string;
136
+ defaultValue?: string;
137
+ onSearch?: (q: string) => void;
138
+ suggestions?: EntitySuggestion[];
139
+ suggestionsLabel?: string;
140
+ resultsLabel?: React.ReactNode;
141
+ loadingLabel?: React.ReactNode;
142
+ open?: boolean;
143
+ defaultOpen?: boolean;
144
+ loading?: boolean;
145
+ emptyText?: React.ReactNode;
146
+ onChange?: (value: string) => void;
147
+ onOpenChange?: (open: boolean) => void;
148
+ onSelect?: (suggestion: EntitySuggestion) => void;
149
+ }
150
+ export interface AppDomainSearchProps extends EntitySearchInputProps {
151
+ appDomainRef?: string;
152
+ }
153
+ export interface ResourceSearchProps extends EntitySearchInputProps {
154
+ resourceScope?: string;
155
+ }
156
+ export interface SemanticSearchResultProps extends React.HTMLAttributes<HTMLElement> {
157
+ result: {
158
+ id: string;
159
+ snippet: string;
160
+ highlights?: Array<[number, number]>;
161
+ evidence: Array<{
162
+ id: string;
163
+ label: string;
164
+ href?: string;
165
+ }>;
166
+ };
167
+ }
168
+ export interface AgentSearchSuggestionProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
169
+ suggestion: {
170
+ id: string;
171
+ label: string;
172
+ rationale?: string;
173
+ onSelect?: () => void;
174
+ };
175
+ }