@paubox/ui 1.18.2 → 1.19.1
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/index.esm.js +2141 -989
- package/package.json +1 -1
- package/src/index.d.ts +1 -0
- package/src/lib/Inputs/index.d.ts +0 -1
- package/src/lib/SearchOmnibox/SearchOmnibox.d.ts +67 -0
- package/src/lib/Inputs/Search.d.ts +0 -9
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export * from './lib/Popper/Popper';
|
|
|
14
14
|
export * from './lib/RadioButton/RadioButton';
|
|
15
15
|
export * from './lib/RadioGroup/RadioGroup';
|
|
16
16
|
export * from './lib/SearchBar/SearchBar';
|
|
17
|
+
export * from './lib/SearchOmnibox/SearchOmnibox';
|
|
17
18
|
export * from './lib/Table/Table';
|
|
18
19
|
export * from './lib/Toggle/Toggle';
|
|
19
20
|
export * from './lib/Tooltip/Tooltip';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identifier for which search bar in the dashboard a request originated from.
|
|
3
|
+
* Matches the `SearchBar` enum in pb_search (Rust) so the same string is wire-compatible
|
|
4
|
+
* for both `bar=` query params and request bodies.
|
|
5
|
+
*/
|
|
6
|
+
export type SearchBarKey = 'inbound_mail_log' | 'inbound_quarantine' | 'inbound_quarantine_history' | 'outbound_mail_log' | 'outbound_quarantine' | 'outbound_quarantine_history' | 'outbound_senders_encrypted' | 'outbound_senders_not_encrypted' | 'outbound_senders_inactive' | 'inbound_rulesets' | 'inbound_relays' | 'inbound_execprotect' | 'inbound_execprotect_notifications' | 'inbound_tags' | 'mail_archive' | 'mail_archive_excluded_users' | 'dlp_rules' | 'dlp_excluded_users' | 'email_api_mail_log' | 'email_api_settings' | 'email_api_webhooks' | 'paubox_forms' | 'users';
|
|
7
|
+
export interface SearchOmniboxResult {
|
|
8
|
+
message_id: string;
|
|
9
|
+
customer_id: string;
|
|
10
|
+
from: string;
|
|
11
|
+
to: string[];
|
|
12
|
+
subject: string;
|
|
13
|
+
direction: string;
|
|
14
|
+
/** ISO 8601 */
|
|
15
|
+
timestamp: string;
|
|
16
|
+
/** Subject with matched terms wrapped in `<em>` (will be sanitized before render) */
|
|
17
|
+
highlight_subject?: string;
|
|
18
|
+
/** Body snippet with matched terms wrapped in `<em>` (will be sanitized before render) */
|
|
19
|
+
highlight_body?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface SearchOmniboxProps {
|
|
22
|
+
/** Which search bar this represents — scopes Redis history and applies implicit OpenSearch filters */
|
|
23
|
+
bar: SearchBarKey;
|
|
24
|
+
/** Placeholder when input is empty (e.g. "Search mail log (try from:, to:, subject:)") */
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Base URL of the pb_search service (no trailing slash).
|
|
28
|
+
* Required when `mode='remote'` or `withHistory !== false`. Ignored otherwise.
|
|
29
|
+
*/
|
|
30
|
+
pbSearchBaseUrl?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Returns the current Bearer token to send to pb_search.
|
|
33
|
+
* Required when `mode='remote'` or `withHistory !== false`. Ignored otherwise.
|
|
34
|
+
*/
|
|
35
|
+
getAuthToken?: () => Promise<string> | string;
|
|
36
|
+
/**
|
|
37
|
+
* 'remote' (default for mail bars) — autocomplete dropdown fetches results from pb_search.
|
|
38
|
+
* 'local' — autocomplete dropdown filters `localCandidates` client-side; recent searches still come from Redis (unless `withHistory` is false).
|
|
39
|
+
*/
|
|
40
|
+
mode?: 'remote' | 'local';
|
|
41
|
+
/**
|
|
42
|
+
* Whether to use Redis-backed recent-search history. Defaults to `true`.
|
|
43
|
+
*
|
|
44
|
+
* When `false`:
|
|
45
|
+
* - No `/recent_searches` calls are made (no focus fetch, no prefix fetch, no record-on-pick, no delete)
|
|
46
|
+
* - The recent-searches dropdown view is suppressed (input must be non-empty for the dropdown to open)
|
|
47
|
+
* - Ghost-text tab autocomplete is disabled (it's sourced from recent searches)
|
|
48
|
+
*
|
|
49
|
+
* Set this to `false` for config / list pages that don't need per-user history.
|
|
50
|
+
* Pairs naturally with `mode='local'` to keep the component fully decoupled
|
|
51
|
+
* from pb_search.
|
|
52
|
+
*/
|
|
53
|
+
withHistory?: boolean;
|
|
54
|
+
/** Remote mode: called when user clicks a result row in the dropdown. */
|
|
55
|
+
onResultClick?: (result: SearchOmniboxResult) => void;
|
|
56
|
+
/** Called when user presses Enter (or clicks the "All results" footer) to commit a full search. */
|
|
57
|
+
onSubmitFullSearch?: (query: string) => void;
|
|
58
|
+
/** Local mode only: candidate strings to filter against (e.g. ruleset names, usernames). */
|
|
59
|
+
localCandidates?: string[];
|
|
60
|
+
/** Local mode: fires when the (debounced) query changes; let the page filter its own table. */
|
|
61
|
+
onLocalQueryChange?: (query: string) => void;
|
|
62
|
+
/** Test id prefix; defaults to `search-omnibox`. */
|
|
63
|
+
testId?: string;
|
|
64
|
+
/** Optional initial query (e.g. when restoring from URL state). */
|
|
65
|
+
initialQuery?: string;
|
|
66
|
+
}
|
|
67
|
+
export declare const SearchOmnibox: ({ bar, placeholder, pbSearchBaseUrl, getAuthToken, mode, withHistory, onResultClick, onSubmitFullSearch, localCandidates, onLocalQueryChange, testId, initialQuery, }: SearchOmniboxProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export interface SearchProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
2
|
-
sz?: 'sm' | 'lg';
|
|
3
|
-
clearable?: boolean;
|
|
4
|
-
loading: boolean;
|
|
5
|
-
setLoading?: (value: boolean) => void;
|
|
6
|
-
setSearchValue: (value: string) => void;
|
|
7
|
-
}
|
|
8
|
-
export declare const loadingWheelStyle: import("@emotion/react").SerializedStyles;
|
|
9
|
-
export declare const Search: ({ loading, setLoading, setSearchValue, clearable, sz, ...props }: SearchProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|