@brainfish-ai/components 0.6.5-alpha.3 → 0.7.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 +94 -7
- package/dist/button.d.ts +16 -0
- package/dist/card.d.ts +17 -0
- package/dist/chat-search.d.ts +404 -0
- package/dist/collapsible.d.ts +10 -0
- package/dist/combobox.d.ts +18 -0
- package/dist/command.d.ts +90 -0
- package/dist/components/chat-search.d.ts +2 -0
- package/dist/components/combobox.d.ts +2 -0
- package/dist/components/date-picker.d.ts +2 -0
- package/dist/components/feedback.d.ts +2 -0
- package/dist/components/filter.d.ts +2 -0
- package/dist/components/generating-star.d.ts +6 -0
- package/dist/components/markdown.d.ts +2 -0
- package/dist/components/select.d.ts +2 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/command.d.ts +80 -0
- package/dist/components/ui/dialog.d.ts +19 -0
- package/dist/components/ui/dropdown-menu.d.ts +27 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/label.d.ts +5 -0
- package/dist/components/ui/popover.d.ts +7 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/switch.d.ts +4 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/tooltip.d.ts +13 -0
- package/dist/date-picker.d.ts +12 -0
- package/dist/dialog.d.ts +30 -0
- package/dist/dropdown-menu.d.ts +43 -0
- package/dist/esm/ChatSearch.css +1 -0
- package/dist/esm/chunks/ChatSearch.BD2RqFhC.js +5855 -0
- package/dist/esm/chunks/ChatSearch.BD2RqFhC.js.map +1 -0
- package/dist/esm/chunks/FormattedMessage.DPRps9mh.js +39493 -0
- package/dist/esm/chunks/FormattedMessage.DPRps9mh.js.map +1 -0
- package/dist/esm/chunks/combobox.D30-HM1I.js +65 -0
- package/dist/esm/chunks/combobox.D30-HM1I.js.map +1 -0
- package/dist/esm/chunks/date-picker.Ca8jXimG.js +46 -0
- package/dist/esm/chunks/date-picker.Ca8jXimG.js.map +1 -0
- package/dist/esm/chunks/feedback.NWn6_mYe.js +209 -0
- package/dist/esm/chunks/feedback.NWn6_mYe.js.map +1 -0
- package/dist/esm/chunks/filters.Dy3yDv4K.js +264 -0
- package/dist/esm/chunks/filters.Dy3yDv4K.js.map +1 -0
- package/dist/esm/chunks/generating-star.C6eGHpse.js +106 -0
- package/dist/esm/chunks/generating-star.C6eGHpse.js.map +1 -0
- package/dist/esm/chunks/simpleSelect.BiVUOs29.js +97 -0
- package/dist/esm/chunks/simpleSelect.BiVUOs29.js.map +1 -0
- package/dist/esm/chunks/utils.DmKr1Ojo.js +54 -0
- package/dist/esm/chunks/utils.DmKr1Ojo.js.map +1 -0
- package/dist/esm/components/chat-search.js +2 -0
- package/dist/esm/components/chat-search.js.map +1 -0
- package/dist/esm/components/combobox.js +2 -0
- package/dist/esm/components/combobox.js.map +1 -0
- package/dist/esm/components/date-picker.js +2 -0
- package/dist/esm/components/date-picker.js.map +1 -0
- package/dist/esm/components/feedback.js +2 -0
- package/dist/esm/components/feedback.js.map +1 -0
- package/dist/esm/components/filter.js +2 -0
- package/dist/esm/components/filter.js.map +1 -0
- package/dist/esm/components/generating-star.js +2 -0
- package/dist/esm/components/generating-star.js.map +1 -0
- package/dist/esm/components/markdown.js +2 -0
- package/dist/esm/components/markdown.js.map +1 -0
- package/dist/esm/components/select.js +2 -0
- package/dist/esm/components/select.js.map +1 -0
- package/dist/esm/components/ui/button.js +166 -0
- package/dist/esm/components/ui/button.js.map +1 -0
- package/dist/esm/components/ui/card.js +51 -0
- package/dist/esm/components/ui/card.js.map +1 -0
- package/dist/esm/components/ui/collapsible.js +34 -0
- package/dist/esm/components/ui/collapsible.js.map +1 -0
- package/dist/esm/components/ui/command.js +103 -0
- package/dist/esm/components/ui/command.js.map +1 -0
- package/dist/esm/components/ui/dialog.js +87 -0
- package/dist/esm/components/ui/dialog.js.map +1 -0
- package/dist/esm/components/ui/dropdown-menu.js +132 -0
- package/dist/esm/components/ui/dropdown-menu.js.map +1 -0
- package/dist/esm/components/ui/input.js +23 -0
- package/dist/esm/components/ui/input.js.map +1 -0
- package/dist/esm/components/ui/label.js +20 -0
- package/dist/esm/components/ui/label.js.map +1 -0
- package/dist/esm/components/ui/popover.js +24 -0
- package/dist/esm/components/ui/popover.js.map +1 -0
- package/dist/esm/components/ui/scroll-area.js +34 -0
- package/dist/esm/components/ui/scroll-area.js.map +1 -0
- package/dist/esm/components/ui/switch.js +27 -0
- package/dist/esm/components/ui/switch.js.map +1 -0
- package/dist/esm/components/ui/textarea.js +20 -0
- package/dist/esm/components/ui/textarea.js.map +1 -0
- package/dist/esm/components/ui/tooltip.js +34 -0
- package/dist/esm/components/ui/tooltip.js.map +1 -0
- package/dist/esm/date-picker.css +1 -0
- package/dist/esm/index.css +1 -4
- package/dist/esm/index.js +176 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/feedback.d.ts +21 -0
- package/dist/filter.d.ts +76 -0
- package/dist/generating-star.d.ts +10 -0
- package/dist/index.d.ts +919 -810
- package/dist/input.d.ts +5 -0
- package/dist/label.d.ts +8 -0
- package/dist/markdown.d.ts +54 -0
- package/dist/popover.d.ts +12 -0
- package/dist/scroll-area.d.ts +8 -0
- package/dist/select.d.ts +20 -0
- package/dist/stats.html +4949 -0
- package/dist/switch.d.ts +6 -0
- package/dist/textarea.d.ts +5 -0
- package/dist/tooltip.d.ts +18 -0
- package/package.json +20 -16
- package/dist/esm/index.css.map +0 -1
- package/stats.html +0 -4949
package/README.md
CHANGED
|
@@ -1,27 +1,114 @@
|
|
|
1
1
|
# Brainfish Components
|
|
2
2
|
|
|
3
|
-
Brainfish Components is a React component library
|
|
3
|
+
Brainfish Components is a React component library that supports both bulk imports and individual component imports (similar to shadcn/ui) for optimal tree-shaking and bundle size optimization.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
|
+
```bash
|
|
8
|
+
npm install @brainfish-ai/components
|
|
9
|
+
# or
|
|
10
|
+
yarn add @brainfish-ai/components
|
|
7
11
|
```
|
|
8
|
-
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### Individual Component Imports (Recommended)
|
|
16
|
+
|
|
17
|
+
Import only the components you need for optimal bundle size:
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
// Import individual UI components
|
|
21
|
+
import { Button } from '@brainfish-ai/components/ui/button';
|
|
22
|
+
import { Dialog } from '@brainfish-ai/components/ui/dialog';
|
|
23
|
+
import { Input } from '@brainfish-ai/components/ui/input';
|
|
24
|
+
|
|
25
|
+
// Import other components
|
|
26
|
+
import { ChatSearch } from '@brainfish-ai/components/chat-search';
|
|
27
|
+
import { DatePicker } from '@brainfish-ai/components/date-picker';
|
|
28
|
+
import { Filter } from '@brainfish-ai/components/filter';
|
|
29
|
+
|
|
30
|
+
function MyApp() {
|
|
31
|
+
return (
|
|
32
|
+
<div>
|
|
33
|
+
<Button>Click me</Button>
|
|
34
|
+
<Input placeholder="Enter text..." />
|
|
35
|
+
<DatePicker />
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Bulk Import (Legacy)
|
|
42
|
+
|
|
43
|
+
Import all components at once (larger bundle size):
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { Button, Dialog, Input, ChatSearch } from '@brainfish-ai/components';
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Available Individual Imports
|
|
50
|
+
|
|
51
|
+
#### UI Components
|
|
52
|
+
- `@brainfish-ai/components/ui/button`
|
|
53
|
+
- `@brainfish-ai/components/ui/card`
|
|
54
|
+
- `@brainfish-ai/components/ui/collapsible`
|
|
55
|
+
- `@brainfish-ai/components/ui/command`
|
|
56
|
+
- `@brainfish-ai/components/ui/dialog`
|
|
57
|
+
- `@brainfish-ai/components/ui/dropdown-menu`
|
|
58
|
+
- `@brainfish-ai/components/ui/input`
|
|
59
|
+
- `@brainfish-ai/components/ui/label`
|
|
60
|
+
- `@brainfish-ai/components/ui/popover`
|
|
61
|
+
- `@brainfish-ai/components/ui/scroll-area`
|
|
62
|
+
- `@brainfish-ai/components/ui/switch`
|
|
63
|
+
- `@brainfish-ai/components/ui/textarea`
|
|
64
|
+
- `@brainfish-ai/components/ui/tooltip`
|
|
65
|
+
|
|
66
|
+
#### Complex Components
|
|
67
|
+
- `@brainfish-ai/components/chat-search`
|
|
68
|
+
- `@brainfish-ai/components/combobox`
|
|
69
|
+
- `@brainfish-ai/components/date-picker`
|
|
70
|
+
- `@brainfish-ai/components/feedback`
|
|
71
|
+
- `@brainfish-ai/components/filter`
|
|
72
|
+
- `@brainfish-ai/components/generating-star`
|
|
73
|
+
- `@brainfish-ai/components/markdown`
|
|
74
|
+
- `@brainfish-ai/components/select`
|
|
75
|
+
|
|
76
|
+
### Styles
|
|
77
|
+
|
|
78
|
+
Don't forget to import the CSS:
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
import '@brainfish-ai/components/styles.css';
|
|
9
82
|
```
|
|
10
83
|
|
|
11
|
-
##
|
|
84
|
+
## Development
|
|
12
85
|
|
|
13
|
-
|
|
86
|
+
### Getting started
|
|
14
87
|
|
|
88
|
+
```bash
|
|
89
|
+
yarn install
|
|
15
90
|
```
|
|
91
|
+
|
|
92
|
+
### Developing
|
|
93
|
+
|
|
94
|
+
To start developing run:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
16
97
|
yarn start
|
|
17
98
|
```
|
|
18
99
|
|
|
19
100
|
This will build a version of your library, run the watcher and also run Storybook.
|
|
20
|
-
To open Storybook manually open your Browser and navigate to [http://localhost:
|
|
101
|
+
To open Storybook manually open your Browser and navigate to [http://localhost:6006](http://localhost:6006).
|
|
21
102
|
Start developing your components in `src/components` folder and update the `src/index.js` file accordingly.
|
|
22
103
|
Always provide an `YourComponent.story.tsx` file, so your component will show up in Storybook.
|
|
23
104
|
|
|
24
|
-
|
|
105
|
+
### Building
|
|
106
|
+
|
|
107
|
+
Build the library with individual component exports:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
yarn build:components
|
|
111
|
+
```
|
|
25
112
|
|
|
26
113
|
## Linting and Code formating for Typescript
|
|
27
114
|
|
package/dist/button.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ClassProp } from 'class-variance-authority/dist/types';
|
|
2
|
+
import * as React_2 from 'react';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
export declare const Button: React_2.ForwardRefExoticComponent<ButtonProps & React_2.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
|
|
7
|
+
export declare interface ButtonProps extends React_2.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export declare const buttonVariants: (props?: ({
|
|
12
|
+
variant?: "link" | "dark" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
13
|
+
size?: "default" | "icon" | "sm" | "lg" | null | undefined;
|
|
14
|
+
} & ClassProp) | undefined) => string;
|
|
15
|
+
|
|
16
|
+
export { }
|
package/dist/card.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React_2 from 'react';
|
|
2
|
+
|
|
3
|
+
export declare function Card({ className, ...props }: React_2.ComponentProps<'div'>): React_2.JSX.Element;
|
|
4
|
+
|
|
5
|
+
export declare function CardAction({ className, ...props }: React_2.ComponentProps<'div'>): React_2.JSX.Element;
|
|
6
|
+
|
|
7
|
+
export declare function CardContent({ className, ...props }: React_2.ComponentProps<'div'>): React_2.JSX.Element;
|
|
8
|
+
|
|
9
|
+
export declare function CardDescription({ className, ...props }: React_2.ComponentProps<'div'>): React_2.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export declare function CardFooter({ className, ...props }: React_2.ComponentProps<'div'>): React_2.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export declare function CardHeader({ className, ...props }: React_2.ComponentProps<'div'>): React_2.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export declare function CardTitle({ className, ...props }: React_2.ComponentProps<'div'>): React_2.JSX.Element;
|
|
16
|
+
|
|
17
|
+
export { }
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
import { default as default_2 } from 'react';
|
|
2
|
+
import { JSONSchemaType } from 'ajv';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
declare type Action = {
|
|
6
|
+
id: string;
|
|
7
|
+
type: ActionType;
|
|
8
|
+
action: {
|
|
9
|
+
version: string;
|
|
10
|
+
options: {
|
|
11
|
+
title?: string;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
declare type ActionButtonsBlock = {
|
|
18
|
+
id: string;
|
|
19
|
+
type: 'action-buttons';
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
declare type ActionInput = {
|
|
23
|
+
name: string;
|
|
24
|
+
required: boolean;
|
|
25
|
+
schema: {
|
|
26
|
+
type: string;
|
|
27
|
+
title: string;
|
|
28
|
+
description: string;
|
|
29
|
+
oneOf?: {
|
|
30
|
+
const: string;
|
|
31
|
+
title: string;
|
|
32
|
+
}[];
|
|
33
|
+
};
|
|
34
|
+
type: string;
|
|
35
|
+
ui: {
|
|
36
|
+
type: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
declare type ActionInputFormBlock = {
|
|
41
|
+
id: string;
|
|
42
|
+
type: 'action-input-form';
|
|
43
|
+
state: 'ready' | 'processing' | 'completed';
|
|
44
|
+
actionId: string;
|
|
45
|
+
initialValues: ActionInputs;
|
|
46
|
+
schema: ActionInputsSchema;
|
|
47
|
+
onSubmit?: (inputs: ActionInputs) => void;
|
|
48
|
+
inputs: ActionInput[];
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
declare type ActionInputs = Record<string, ActionInputValue>;
|
|
52
|
+
|
|
53
|
+
declare type ActionInputsSchema = JSONSchemaType<ActionInputs>;
|
|
54
|
+
|
|
55
|
+
declare type ActionInputValue = string | number | boolean | null;
|
|
56
|
+
|
|
57
|
+
declare enum ActionType {
|
|
58
|
+
CallPhone = "call_phone",
|
|
59
|
+
OpenUrl = "open_url",
|
|
60
|
+
SendEmail = "send_email",
|
|
61
|
+
RunCallback = "run_callback"
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare type AddActionButtons = {
|
|
65
|
+
type: typeof AnswersActions.ADD_ACTION_BUTTONS;
|
|
66
|
+
payload: {
|
|
67
|
+
searchIntentId: string;
|
|
68
|
+
actions: Array<{
|
|
69
|
+
id: string;
|
|
70
|
+
type: string;
|
|
71
|
+
action: {
|
|
72
|
+
version: string;
|
|
73
|
+
options: {
|
|
74
|
+
title?: string;
|
|
75
|
+
[key: string]: any;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
}>;
|
|
79
|
+
index?: number;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export declare interface Answer {
|
|
84
|
+
id: string;
|
|
85
|
+
state: AnswerState;
|
|
86
|
+
question: string;
|
|
87
|
+
blocks: AnswerBlock[];
|
|
88
|
+
searchResults?: SearchResult[];
|
|
89
|
+
followUpQuestions?: string[];
|
|
90
|
+
searchQueryId?: string;
|
|
91
|
+
feedback?: FeedbackResponse;
|
|
92
|
+
isUncertain?: boolean;
|
|
93
|
+
uncertaintyLanguage?: string | null;
|
|
94
|
+
uncertaintyFallbackText?: string;
|
|
95
|
+
searchIntentId?: string;
|
|
96
|
+
actions?: Action[];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
declare type AnswerBlock = MarkdownTextBlock | ActionButtonsBlock | ActionInputFormBlock;
|
|
100
|
+
|
|
101
|
+
declare type AnswerListAction = SetAnswers | ClearAll | AppendNewAnswer | SetSearchResults | AppendAnswerChunk | SetAnswerError | SetUserFeedback | ClearUserFeedback | SetFollowUpQuestions | AppendBlock | CompleteAnswer | MarkAsUncertain | InvokeAction | GetActionInputs | AddActionButtons;
|
|
102
|
+
|
|
103
|
+
declare const AnswersActions: {
|
|
104
|
+
readonly SET_ANSWERS: "answers/set_answers";
|
|
105
|
+
readonly CLEAR_ALL: "answers/clear_all";
|
|
106
|
+
readonly APPEND_NEW_ANSWER: "answers/create_empty_answer";
|
|
107
|
+
readonly APPEND_BLOCK: "answers/append_block";
|
|
108
|
+
readonly APPEND_ANSWER_CHUNK: "answers/append_stream_chunk";
|
|
109
|
+
readonly SET_SEARCH_RESULTS: "answers/update_search_results";
|
|
110
|
+
readonly SET_FOLLOW_UP_QUESTIONS: "answers/set_follow_up_questions";
|
|
111
|
+
readonly COMPLETE_ANSWER: "answers/finish_streaming";
|
|
112
|
+
readonly SET_ANSWER_ERROR: "answers/set_error_state";
|
|
113
|
+
readonly SET_USER_FEEDBACK: "answers/set_user_feedback";
|
|
114
|
+
readonly CLEAR_USER_FEEDBACK: "answers/clear_user_feedback";
|
|
115
|
+
readonly MARK_AS_UNCERTAIN: "answers/mark_as_uncertain";
|
|
116
|
+
readonly GET_ACTION_INPUTS: "answers/request_action_inputs";
|
|
117
|
+
readonly INVOKE_ACTION: "answers/invoke_action";
|
|
118
|
+
readonly ADD_ACTION_BUTTONS: "answers/add_action_buttons";
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
declare type AnswerState = 'fetching-search-results' | 'fetching-stream' | 'streaming' | 'getting-action-inputs' | 'completed';
|
|
122
|
+
|
|
123
|
+
declare type AppendAnswerChunk = {
|
|
124
|
+
type: typeof AnswersActions.APPEND_ANSWER_CHUNK;
|
|
125
|
+
payload: {
|
|
126
|
+
text: string;
|
|
127
|
+
index?: number;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
declare type AppendBlock = {
|
|
132
|
+
type: typeof AnswersActions.APPEND_BLOCK;
|
|
133
|
+
payload: {
|
|
134
|
+
block: AnswerBlock;
|
|
135
|
+
index?: number;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
declare type AppendNewAnswer = {
|
|
140
|
+
type: typeof AnswersActions.APPEND_NEW_ANSWER;
|
|
141
|
+
payload: {
|
|
142
|
+
id?: string;
|
|
143
|
+
query: string;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export declare const ChatSearch: default_2.ForwardRefExoticComponent<ChatSearchProps & default_2.RefAttributes<ChatSearchHandle>>;
|
|
148
|
+
|
|
149
|
+
declare interface ChatSearchContextProps {
|
|
150
|
+
query: string;
|
|
151
|
+
setQuery: default_2.Dispatch<default_2.SetStateAction<string>>;
|
|
152
|
+
queryId: string;
|
|
153
|
+
setQueryId: default_2.Dispatch<default_2.SetStateAction<string>>;
|
|
154
|
+
followUpQuery: string;
|
|
155
|
+
setFollowUpQuery: default_2.Dispatch<default_2.SetStateAction<string>>;
|
|
156
|
+
isSearching: boolean;
|
|
157
|
+
setIsSearching: default_2.Dispatch<default_2.SetStateAction<boolean>>;
|
|
158
|
+
showResults: boolean;
|
|
159
|
+
setShowResults: default_2.Dispatch<default_2.SetStateAction<boolean>>;
|
|
160
|
+
answers: Answer[];
|
|
161
|
+
answerListDispatch: default_2.Dispatch<AnswerListAction>;
|
|
162
|
+
activeAnswerIndex: number;
|
|
163
|
+
setActiveAnswerIndex: default_2.Dispatch<default_2.SetStateAction<number>>;
|
|
164
|
+
conversationId: string | undefined;
|
|
165
|
+
setConversationId: (id: string) => void;
|
|
166
|
+
clearConversationId: () => void;
|
|
167
|
+
isLoadingConversation: boolean;
|
|
168
|
+
setIsLoadingConversation: default_2.Dispatch<default_2.SetStateAction<boolean>>;
|
|
169
|
+
loadError: string;
|
|
170
|
+
setLoadError: default_2.Dispatch<default_2.SetStateAction<string>>;
|
|
171
|
+
showMobileCloseWidgetButton: boolean;
|
|
172
|
+
setShowMobileCloseWidgetButton: default_2.Dispatch<default_2.SetStateAction<boolean>>;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export declare interface ChatSearchHandle {
|
|
176
|
+
createNewThread: (firstQuery?: string) => void;
|
|
177
|
+
showFollowUpThread: (show: boolean) => void;
|
|
178
|
+
subscribeToStateChanges: (callback: (state: ChatSearchState) => void) => () => void;
|
|
179
|
+
focusSearchField: () => void;
|
|
180
|
+
showCloseButton: (showButton: boolean) => void;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export declare interface ChatSearchProps {
|
|
184
|
+
suggestions?: Suggestion[];
|
|
185
|
+
collections?: Array<{
|
|
186
|
+
id: string;
|
|
187
|
+
name: string;
|
|
188
|
+
}>;
|
|
189
|
+
selectedCollectionId?: string;
|
|
190
|
+
onCollectionChange?: (collectionId: string) => void;
|
|
191
|
+
searchEndpoint: string;
|
|
192
|
+
answerEndpoint: string;
|
|
193
|
+
answerStreamEndpoint: string;
|
|
194
|
+
feedbackEndpoint?: string;
|
|
195
|
+
feedbackReasonEndpoint?: string;
|
|
196
|
+
loadConversationEndpoint?: string;
|
|
197
|
+
followUpQuestionsEndpoint?: string;
|
|
198
|
+
autocompleteEndpoint?: string;
|
|
199
|
+
disableFollowUpQuestions?: boolean;
|
|
200
|
+
disableImageAttachment?: boolean;
|
|
201
|
+
disableFeedback?: boolean;
|
|
202
|
+
disclaimer?: string;
|
|
203
|
+
offset?: number;
|
|
204
|
+
headers?: Record<string, string>;
|
|
205
|
+
textConfig?: TextConfig;
|
|
206
|
+
searchPath?: string;
|
|
207
|
+
className?: string;
|
|
208
|
+
onToggleSizeButtonClick?: () => void;
|
|
209
|
+
trackEvent?: (eventName: string, data?: Record<string, any>) => void;
|
|
210
|
+
featureFlags?: FeatureFlags;
|
|
211
|
+
onCloseWidget?: () => void;
|
|
212
|
+
isWidgetMode?: boolean;
|
|
213
|
+
nextBestActions?: NextBestAction[];
|
|
214
|
+
bodyActionButtons?: NextBestAction[];
|
|
215
|
+
onNextBestActionClick?: ({ action, searchQueryId, query, answer, }: {
|
|
216
|
+
action: NextBestAction;
|
|
217
|
+
searchQueryId: string;
|
|
218
|
+
query: string;
|
|
219
|
+
answer: string;
|
|
220
|
+
}) => void;
|
|
221
|
+
userData?: Record<string, unknown> | null;
|
|
222
|
+
redirectRules?: RedirectRule[];
|
|
223
|
+
secretAttributes?: string;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export declare const ChatSearchProvider: default_2.FC<{
|
|
227
|
+
children: ReactNode;
|
|
228
|
+
searchPath?: string;
|
|
229
|
+
}>;
|
|
230
|
+
|
|
231
|
+
export declare interface ChatSearchState {
|
|
232
|
+
showResults: boolean;
|
|
233
|
+
answers: Answer[];
|
|
234
|
+
isLoading: boolean;
|
|
235
|
+
error?: string;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
declare type ClearAll = {
|
|
239
|
+
type: typeof AnswersActions.CLEAR_ALL;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
declare type ClearUserFeedback = {
|
|
243
|
+
type: typeof AnswersActions.CLEAR_USER_FEEDBACK;
|
|
244
|
+
payload: {
|
|
245
|
+
index?: number;
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
export declare interface Collection {
|
|
250
|
+
id: string;
|
|
251
|
+
name: string;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
declare type CompleteAnswer = {
|
|
255
|
+
type: typeof AnswersActions.COMPLETE_ANSWER;
|
|
256
|
+
payload: {
|
|
257
|
+
index?: number;
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
declare type FeatureFlags = {
|
|
262
|
+
[key: string]: boolean | string | number;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
declare type FeedbackResponse = 'accept' | 'reject';
|
|
266
|
+
|
|
267
|
+
declare type GetActionInputs = {
|
|
268
|
+
type: typeof AnswersActions.GET_ACTION_INPUTS;
|
|
269
|
+
payload: {
|
|
270
|
+
searchIntentId: string;
|
|
271
|
+
actionId: string;
|
|
272
|
+
inputs: ActionInput[];
|
|
273
|
+
schema: JSONSchema<ActionInputs>;
|
|
274
|
+
initialValues: ActionInputs;
|
|
275
|
+
onSubmit: (parameters: ActionInputs) => void;
|
|
276
|
+
index?: number;
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
declare type InvokeAction = {
|
|
281
|
+
type: typeof AnswersActions.INVOKE_ACTION;
|
|
282
|
+
payload: {
|
|
283
|
+
index?: number;
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
declare type JSONSchema<T> = JSONSchemaType<T>;
|
|
288
|
+
|
|
289
|
+
declare type MarkAsUncertain = {
|
|
290
|
+
type: typeof AnswersActions.MARK_AS_UNCERTAIN;
|
|
291
|
+
payload: {
|
|
292
|
+
uncertaintyText: string;
|
|
293
|
+
index?: number;
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
declare type MarkdownTextBlock = {
|
|
298
|
+
id: string;
|
|
299
|
+
type: 'markdown-text';
|
|
300
|
+
text: string;
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
declare type NextBestAction = {
|
|
304
|
+
id?: string;
|
|
305
|
+
label: string;
|
|
306
|
+
type: NextBestActionType;
|
|
307
|
+
icon?: string | UrlString;
|
|
308
|
+
value: any;
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
declare enum NextBestActionType {
|
|
312
|
+
Link = "link",
|
|
313
|
+
Email = "email",
|
|
314
|
+
Phone = "phone",
|
|
315
|
+
Callback = "callback",
|
|
316
|
+
Function = "function"
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Defines a URL redirect rule with pattern matching
|
|
321
|
+
* @example { source: '/knowledge/:id/:path', destination: '/knowledge/test/:path' }
|
|
322
|
+
*/
|
|
323
|
+
declare type RedirectRule = {
|
|
324
|
+
source: string;
|
|
325
|
+
destination: string;
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
declare interface SearchResult {
|
|
329
|
+
id: string;
|
|
330
|
+
title: string;
|
|
331
|
+
url: string;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
declare type SetAnswerError = {
|
|
335
|
+
type: typeof AnswersActions.SET_ANSWER_ERROR;
|
|
336
|
+
payload: {
|
|
337
|
+
error: string;
|
|
338
|
+
index?: number;
|
|
339
|
+
};
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
declare type SetAnswers = {
|
|
343
|
+
type: typeof AnswersActions.SET_ANSWERS;
|
|
344
|
+
payload: {
|
|
345
|
+
answers: Answer[];
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
declare type SetFollowUpQuestions = {
|
|
350
|
+
type: typeof AnswersActions.SET_FOLLOW_UP_QUESTIONS;
|
|
351
|
+
payload: {
|
|
352
|
+
questions: string[];
|
|
353
|
+
index?: number;
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
declare type SetSearchResults = {
|
|
358
|
+
type: typeof AnswersActions.SET_SEARCH_RESULTS;
|
|
359
|
+
payload: {
|
|
360
|
+
searchQueryId: string;
|
|
361
|
+
results: SearchResult[];
|
|
362
|
+
index?: number;
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
declare type SetUserFeedback = {
|
|
367
|
+
type: typeof AnswersActions.SET_USER_FEEDBACK;
|
|
368
|
+
payload: {
|
|
369
|
+
feedback: FeedbackResponse;
|
|
370
|
+
index?: number;
|
|
371
|
+
};
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
declare interface Suggestion {
|
|
375
|
+
id: string;
|
|
376
|
+
question: string;
|
|
377
|
+
conversationId?: string;
|
|
378
|
+
messageCount?: number;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
declare interface TextConfig {
|
|
382
|
+
headerText?: string;
|
|
383
|
+
searchPlaceholder?: string;
|
|
384
|
+
attachImageText?: string;
|
|
385
|
+
allDocumentsText?: string;
|
|
386
|
+
loadingSearchText?: string;
|
|
387
|
+
loadingAnswerText?: string;
|
|
388
|
+
errorText?: string;
|
|
389
|
+
followUpPlaceholder?: string;
|
|
390
|
+
positiveAnswerText?: string;
|
|
391
|
+
negativeAnswerText?: string;
|
|
392
|
+
suggestionsTitle?: string;
|
|
393
|
+
uncertaintyFallbackText?: Record<string, string>;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
declare type UrlString = string & {
|
|
397
|
+
__url: never;
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
export declare const useChatSearch: () => ChatSearchContextProps;
|
|
401
|
+
|
|
402
|
+
export declare const useIsChatSearchDirty: () => boolean;
|
|
403
|
+
|
|
404
|
+
export { }
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
2
|
+
import { default as default_2 } from 'react';
|
|
3
|
+
|
|
4
|
+
export declare const Collapsible: default_2.ForwardRefExoticComponent<CollapsiblePrimitive.CollapsibleProps & default_2.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
|
|
6
|
+
export declare const CollapsibleContent: default_2.FC<CollapsiblePrimitive.CollapsibleContentProps>;
|
|
7
|
+
|
|
8
|
+
export declare const CollapsibleTrigger: default_2.ForwardRefExoticComponent<CollapsiblePrimitive.CollapsibleTriggerProps & default_2.RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
|
|
10
|
+
export { }
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React_2 from 'react';
|
|
2
|
+
|
|
3
|
+
export declare function Combobox({ options, defaultValueLabel, placeholder, noResultsLabel, className, onOpenChange, onChange, }: ComboboxProps): React_2.JSX.Element;
|
|
4
|
+
|
|
5
|
+
export declare interface ComboboxProps {
|
|
6
|
+
options: {
|
|
7
|
+
value: string;
|
|
8
|
+
label: string;
|
|
9
|
+
}[];
|
|
10
|
+
defaultValueLabel: string;
|
|
11
|
+
placeholder: string;
|
|
12
|
+
noResultsLabel: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
onOpenChange?: (open: boolean) => void;
|
|
15
|
+
onChange?: (value: string) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { }
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { DialogProps } from '@radix-ui/react-dialog';
|
|
2
|
+
import * as React_2 from 'react';
|
|
3
|
+
|
|
4
|
+
export declare const Command: React_2.ForwardRefExoticComponent<Omit<{
|
|
5
|
+
children?: React_2.ReactNode;
|
|
6
|
+
} & Pick<Pick<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React_2.HTMLAttributes<HTMLDivElement>> & {
|
|
7
|
+
ref?: React_2.Ref<HTMLDivElement> | undefined;
|
|
8
|
+
} & {
|
|
9
|
+
asChild?: boolean | undefined;
|
|
10
|
+
}, "key" | keyof React_2.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
11
|
+
label?: string | undefined;
|
|
12
|
+
shouldFilter?: boolean | undefined;
|
|
13
|
+
filter?: ((value: string, search: string, keywords?: string[] | undefined) => number) | undefined;
|
|
14
|
+
defaultValue?: string | undefined;
|
|
15
|
+
value?: string | undefined;
|
|
16
|
+
onValueChange?: ((value: string) => void) | undefined;
|
|
17
|
+
loop?: boolean | undefined;
|
|
18
|
+
disablePointerSelection?: boolean | undefined;
|
|
19
|
+
vimBindings?: boolean | undefined;
|
|
20
|
+
} & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
21
|
+
|
|
22
|
+
export declare const CommandDialog: ({ children, ...props }: DialogProps) => React_2.JSX.Element;
|
|
23
|
+
|
|
24
|
+
export declare const CommandEmpty: React_2.ForwardRefExoticComponent<Omit<{
|
|
25
|
+
children?: React_2.ReactNode;
|
|
26
|
+
} & Pick<Pick<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React_2.HTMLAttributes<HTMLDivElement>> & {
|
|
27
|
+
ref?: React_2.Ref<HTMLDivElement> | undefined;
|
|
28
|
+
} & {
|
|
29
|
+
asChild?: boolean | undefined;
|
|
30
|
+
}, "key" | keyof React_2.HTMLAttributes<HTMLDivElement> | "asChild"> & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
31
|
+
|
|
32
|
+
export declare const CommandGroup: React_2.ForwardRefExoticComponent<Omit<{
|
|
33
|
+
children?: React_2.ReactNode;
|
|
34
|
+
} & Omit<Pick<Pick<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React_2.HTMLAttributes<HTMLDivElement>> & {
|
|
35
|
+
ref?: React_2.Ref<HTMLDivElement> | undefined;
|
|
36
|
+
} & {
|
|
37
|
+
asChild?: boolean | undefined;
|
|
38
|
+
}, "key" | keyof React_2.HTMLAttributes<HTMLDivElement> | "asChild">, "heading" | "value"> & {
|
|
39
|
+
heading?: React_2.ReactNode;
|
|
40
|
+
value?: string | undefined;
|
|
41
|
+
forceMount?: boolean | undefined;
|
|
42
|
+
} & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
43
|
+
|
|
44
|
+
export declare const CommandInput: React_2.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<React_2.DetailedHTMLProps<React_2.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof React_2.InputHTMLAttributes<HTMLInputElement>> & {
|
|
45
|
+
ref?: React_2.Ref<HTMLInputElement> | undefined;
|
|
46
|
+
} & {
|
|
47
|
+
asChild?: boolean | undefined;
|
|
48
|
+
}, "key" | "asChild" | keyof React_2.InputHTMLAttributes<HTMLInputElement>>, "onChange" | "type" | "value"> & {
|
|
49
|
+
value?: string | undefined;
|
|
50
|
+
onValueChange?: ((search: string) => void) | undefined;
|
|
51
|
+
} & React_2.RefAttributes<HTMLInputElement>, "ref"> & React_2.RefAttributes<HTMLInputElement>>;
|
|
52
|
+
|
|
53
|
+
export declare const CommandItem: React_2.ForwardRefExoticComponent<Omit<{
|
|
54
|
+
children?: React_2.ReactNode;
|
|
55
|
+
} & Omit<Pick<Pick<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React_2.HTMLAttributes<HTMLDivElement>> & {
|
|
56
|
+
ref?: React_2.Ref<HTMLDivElement> | undefined;
|
|
57
|
+
} & {
|
|
58
|
+
asChild?: boolean | undefined;
|
|
59
|
+
}, "key" | keyof React_2.HTMLAttributes<HTMLDivElement> | "asChild">, "onSelect" | "disabled" | "value"> & {
|
|
60
|
+
disabled?: boolean | undefined;
|
|
61
|
+
onSelect?: ((value: string) => void) | undefined;
|
|
62
|
+
value?: string | undefined;
|
|
63
|
+
keywords?: string[] | undefined;
|
|
64
|
+
forceMount?: boolean | undefined;
|
|
65
|
+
} & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
66
|
+
|
|
67
|
+
export declare const CommandList: React_2.ForwardRefExoticComponent<Omit<{
|
|
68
|
+
children?: React_2.ReactNode;
|
|
69
|
+
} & Pick<Pick<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React_2.HTMLAttributes<HTMLDivElement>> & {
|
|
70
|
+
ref?: React_2.Ref<HTMLDivElement> | undefined;
|
|
71
|
+
} & {
|
|
72
|
+
asChild?: boolean | undefined;
|
|
73
|
+
}, "key" | keyof React_2.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
74
|
+
label?: string | undefined;
|
|
75
|
+
} & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
76
|
+
|
|
77
|
+
export declare const CommandSeparator: React_2.ForwardRefExoticComponent<Omit<Pick<Pick<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React_2.HTMLAttributes<HTMLDivElement>> & {
|
|
78
|
+
ref?: React_2.Ref<HTMLDivElement> | undefined;
|
|
79
|
+
} & {
|
|
80
|
+
asChild?: boolean | undefined;
|
|
81
|
+
}, "key" | keyof React_2.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
82
|
+
alwaysRender?: boolean | undefined;
|
|
83
|
+
} & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
84
|
+
|
|
85
|
+
export declare const CommandShortcut: {
|
|
86
|
+
({ className, ...props }: React_2.HTMLAttributes<HTMLSpanElement>): React_2.JSX.Element;
|
|
87
|
+
displayName: string;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export { }
|