@kelet-ai/feedback-ui 1.1.3 → 1.2.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 +140 -70
- package/dist/components/vote-feedback.d.ts +1 -1
- package/dist/contexts/kelet.d.ts +20 -0
- package/dist/feedback-ui.es.js +270 -263
- package/dist/feedback-ui.es.js.map +1 -1
- package/dist/feedback-ui.es.min.js +850 -838
- package/dist/feedback-ui.es.min.js.map +1 -1
- package/dist/feedback-ui.umd.js +269 -262
- package/dist/feedback-ui.umd.js.map +1 -1
- package/dist/feedback-ui.umd.min.js +11 -11
- package/dist/feedback-ui.umd.min.js.map +1 -1
- package/dist/hooks/feedback-state/diff-utils.d.ts +1 -1
- package/dist/hooks/feedback-state/types.d.ts +5 -5
- package/dist/index.d.ts +1 -1
- package/dist/types/index.d.ts +16 -9
- package/package.json +2 -1
|
@@ -11,7 +11,7 @@ export interface FeedbackStateOptions<T> {
|
|
|
11
11
|
*/
|
|
12
12
|
debounceMs?: number;
|
|
13
13
|
/**
|
|
14
|
-
* Format for the diff output in the
|
|
14
|
+
* Format for the diff output in the value field
|
|
15
15
|
* @default 'git'
|
|
16
16
|
*/
|
|
17
17
|
diffType?: DiffType;
|
|
@@ -28,12 +28,12 @@ export interface FeedbackStateOptions<T> {
|
|
|
28
28
|
*/
|
|
29
29
|
onFeedback?: FeedbackHandler;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
* @default Automatic determination based on diff percentage (>50% =
|
|
31
|
+
* Score classification - static score or function to determine score based on changes
|
|
32
|
+
* @default Automatic determination based on diff percentage (>50% = 0, ≤50% = 1)
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
score?: number | ((before: T, after: T, diffPercentage: number) => number);
|
|
35
35
|
/**
|
|
36
|
-
* Default trigger name for state changes when no
|
|
36
|
+
* Default trigger name for state changes when no trigger is specified in setState/dispatch
|
|
37
37
|
* @default 'auto_state_change'
|
|
38
38
|
*/
|
|
39
39
|
default_trigger_name?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { VoteFeedback } from './components';
|
|
2
2
|
export type { FeedbackData, VoteFeedbackRootProps, UpvoteButtonProps, DownvoteButtonProps, PopoverProps, TextareaProps, SubmitButtonProps, } from './types';
|
|
3
|
-
export { KeletProvider, KeletContext, useKelet, useDefaultFeedbackHandler, } from './contexts/kelet';
|
|
3
|
+
export { KeletProvider, KeletContext, useKelet, useKeletSignal, useDefaultFeedbackHandler, } from './contexts/kelet';
|
|
4
4
|
export { useFeedbackState } from './hooks/feedback-state';
|
|
5
5
|
export type { FeedbackStateOptions, DiffType } from './hooks/feedback-state';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -19,18 +19,24 @@ export interface CapturedEvent {
|
|
|
19
19
|
/** Key pressed for keyboard events */
|
|
20
20
|
key?: string;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Signal kind — what type of signal this is
|
|
24
|
+
*/
|
|
25
|
+
export type SignalKind = "feedback" | "edit";
|
|
22
26
|
/**
|
|
23
27
|
* Feedback data structure returned by the component
|
|
24
28
|
*/
|
|
25
29
|
export interface FeedbackData {
|
|
26
30
|
session_id: string;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
explanation?: string;
|
|
30
|
-
source?: 'IMPLICIT' | 'EXPLICIT';
|
|
31
|
-
correction?: string;
|
|
32
|
-
selection?: string;
|
|
31
|
+
kind: SignalKind;
|
|
32
|
+
source: "human";
|
|
33
33
|
trigger_name?: string;
|
|
34
|
+
score?: number;
|
|
35
|
+
value?: string;
|
|
36
|
+
confidence?: number;
|
|
37
|
+
metadata?: Record<string, any>;
|
|
38
|
+
timestamp?: string;
|
|
39
|
+
trace_id?: string;
|
|
34
40
|
}
|
|
35
41
|
/**
|
|
36
42
|
* Props for the root VoteFeedback component
|
|
@@ -41,14 +47,15 @@ export interface VoteFeedbackRootProps {
|
|
|
41
47
|
onFeedback?: (data: FeedbackData) => void | Promise<void>;
|
|
42
48
|
defaultText?: string;
|
|
43
49
|
session_id: string | (() => string);
|
|
44
|
-
|
|
50
|
+
metadata?: Record<string, any>;
|
|
45
51
|
trigger_name?: string;
|
|
52
|
+
trace_id?: string;
|
|
46
53
|
}
|
|
47
54
|
/**
|
|
48
55
|
* Props for the upvote button
|
|
49
56
|
* Headless - you provide your own styling and content
|
|
50
57
|
*/
|
|
51
|
-
export interface UpvoteButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>,
|
|
58
|
+
export interface UpvoteButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
|
|
52
59
|
asChild?: boolean;
|
|
53
60
|
children: ReactNode | (({ isSelected }: {
|
|
54
61
|
isSelected: boolean;
|
|
@@ -58,7 +65,7 @@ export interface UpvoteButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonE
|
|
|
58
65
|
* Props for the downvote button
|
|
59
66
|
* Headless - you provide your own styling and content
|
|
60
67
|
*/
|
|
61
|
-
export interface DownvoteButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>,
|
|
68
|
+
export interface DownvoteButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
|
|
62
69
|
asChild?: boolean;
|
|
63
70
|
children: ReactNode | (({ isSelected }: {
|
|
64
71
|
isSelected: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kelet-ai/feedback-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/kelet-ai/feedback-ui.git"
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"module": "./dist/feedback-ui.es.js",
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@chromatic-com/storybook": "^4.1.1",
|
|
12
|
+
"@ianvs/prettier-plugin-sort-imports": "^4.7.1",
|
|
12
13
|
"@radix-ui/react-popover": "^1.1.15",
|
|
13
14
|
"@radix-ui/react-slot": "^1.2.3",
|
|
14
15
|
"@storybook/addon-a11y": "^9.1.5",
|