@sampleapp.ai/sdk 1.0.25 → 1.0.27
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/dist/components/chat-bar/typing-textarea.js +17 -11
- package/dist/components/chat-bar/voice-button.js +4 -22
- package/dist/components/chat-bar.js +100 -61
- package/dist/components/icons.js +155 -0
- package/dist/components/minimal-chat-bar.js +51 -0
- package/dist/components/ui/button.js +78 -30
- package/dist/index.d.ts +5 -8
- package/dist/index.es.js +1050 -6085
- package/dist/index.js +1 -0
- package/dist/index.standalone.js +85 -0
- package/dist/index.standalone.umd.js +147 -0
- package/dist/index.umd.js +300 -96
- package/dist/sdk.css +1 -0
- package/package.json +5 -3
|
@@ -10,6 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import * as React from "react";
|
|
13
|
+
// Import your scoped styles
|
|
13
14
|
// Base button styles
|
|
14
15
|
const baseButtonStyles = {
|
|
15
16
|
display: "inline-flex",
|
|
@@ -17,52 +18,53 @@ const baseButtonStyles = {
|
|
|
17
18
|
justifyContent: "center",
|
|
18
19
|
gap: "0.5rem",
|
|
19
20
|
whiteSpace: "nowrap",
|
|
20
|
-
borderRadius: "
|
|
21
|
+
borderRadius: "15px",
|
|
21
22
|
fontSize: "14px",
|
|
22
23
|
fontWeight: "500",
|
|
23
|
-
transition: "
|
|
24
|
+
transition: "all 0.15s ease-in-out",
|
|
24
25
|
outline: "none",
|
|
25
26
|
border: "none",
|
|
26
27
|
cursor: "pointer",
|
|
27
28
|
fontFamily: "inherit",
|
|
29
|
+
flexShrink: 0,
|
|
28
30
|
};
|
|
29
|
-
// Variant styles
|
|
31
|
+
// Variant styles using prefixed CSS variables with fallbacks
|
|
30
32
|
const variantStyles = {
|
|
31
33
|
default: {
|
|
32
|
-
backgroundColor: "
|
|
33
|
-
color: "
|
|
34
|
+
backgroundColor: "hsl(var(--sdk-primary, 240 5.9% 10%))",
|
|
35
|
+
color: "hsl(var(--sdk-primary-foreground, 0 0% 98%))",
|
|
34
36
|
boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
35
37
|
},
|
|
36
38
|
destructive: {
|
|
37
|
-
backgroundColor: "
|
|
38
|
-
color: "
|
|
39
|
+
backgroundColor: "hsl(var(--sdk-destructive, 0 84.2% 60.2%))",
|
|
40
|
+
color: "hsl(var(--sdk-destructive-foreground, 0 0% 98%))",
|
|
39
41
|
boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
40
42
|
},
|
|
41
43
|
outline: {
|
|
42
|
-
border: "1px solid
|
|
43
|
-
backgroundColor: "
|
|
44
|
-
color: "
|
|
44
|
+
border: "1px solid hsl(var(--sdk-border, 240 3.7% 25%))",
|
|
45
|
+
backgroundColor: "hsl(var(--sdk-secondary, 240 3.7% 15.9%))",
|
|
46
|
+
color: "hsl(var(--sdk-secondary-foreground, 0 0% 98%))",
|
|
45
47
|
boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
46
48
|
},
|
|
47
49
|
secondary: {
|
|
48
|
-
backgroundColor: "
|
|
49
|
-
color: "
|
|
50
|
+
backgroundColor: "hsl(var(--sdk-secondary, 240 4.8% 95.9%))",
|
|
51
|
+
color: "hsl(var(--sdk-secondary-foreground, 240 5.9% 10%))",
|
|
50
52
|
boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
51
53
|
},
|
|
52
54
|
ghost: {
|
|
53
55
|
backgroundColor: "transparent",
|
|
54
|
-
color: "
|
|
56
|
+
color: "hsl(var(--sdk-foreground, 240 10% 3.9%))",
|
|
55
57
|
},
|
|
56
58
|
link: {
|
|
57
59
|
backgroundColor: "transparent",
|
|
58
|
-
color: "
|
|
60
|
+
color: "hsl(var(--sdk-primary, 240 5.9% 10%))",
|
|
59
61
|
textDecoration: "underline",
|
|
60
62
|
textUnderlineOffset: "4px",
|
|
61
63
|
},
|
|
62
64
|
ghostOutline: {
|
|
63
|
-
border: "1px solid
|
|
65
|
+
border: "1px solid hsl(var(--sdk-secondary, 240 4.8% 95.9%))",
|
|
64
66
|
backgroundColor: "transparent",
|
|
65
|
-
color: "
|
|
67
|
+
color: "hsl(var(--sdk-muted-foreground, 240 3.8% 46.1%))",
|
|
66
68
|
boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
67
69
|
},
|
|
68
70
|
};
|
|
@@ -80,11 +82,13 @@ const sizeStyles = {
|
|
|
80
82
|
paddingLeft: "12px",
|
|
81
83
|
paddingRight: "12px",
|
|
82
84
|
fontSize: "12px",
|
|
85
|
+
borderRadius: "6px",
|
|
83
86
|
},
|
|
84
87
|
lg: {
|
|
85
88
|
height: "40px",
|
|
86
89
|
paddingLeft: "32px",
|
|
87
90
|
paddingRight: "32px",
|
|
91
|
+
borderRadius: "6px",
|
|
88
92
|
},
|
|
89
93
|
icon: {
|
|
90
94
|
height: "32px",
|
|
@@ -92,35 +96,64 @@ const sizeStyles = {
|
|
|
92
96
|
padding: "0",
|
|
93
97
|
},
|
|
94
98
|
};
|
|
95
|
-
// Hover styles
|
|
99
|
+
// Hover styles with CSS variables and fallbacks
|
|
96
100
|
const getHoverStyles = (variant) => {
|
|
97
101
|
switch (variant) {
|
|
98
102
|
case "default":
|
|
99
|
-
return { backgroundColor: "
|
|
103
|
+
return { backgroundColor: "hsl(var(--sdk-primary, 240 5.9% 10%) / 0.9)" };
|
|
100
104
|
case "destructive":
|
|
101
|
-
return {
|
|
105
|
+
return {
|
|
106
|
+
backgroundColor: "hsl(var(--sdk-destructive, 0 84.2% 60.2%) / 0.9)",
|
|
107
|
+
};
|
|
102
108
|
case "outline":
|
|
103
|
-
return {
|
|
109
|
+
return {
|
|
110
|
+
backgroundColor: "hsl(var(--sdk-secondary, 240 3.7% 15.9%) / 0.8)",
|
|
111
|
+
color: "hsl(var(--sdk-secondary-foreground, 0 0% 98%))",
|
|
112
|
+
};
|
|
104
113
|
case "secondary":
|
|
105
|
-
return {
|
|
114
|
+
return {
|
|
115
|
+
backgroundColor: "hsl(var(--sdk-secondary, 240 4.8% 95.9%) / 0.7)",
|
|
116
|
+
};
|
|
106
117
|
case "ghost":
|
|
107
|
-
return {
|
|
118
|
+
return {
|
|
119
|
+
backgroundColor: "hsl(var(--sdk-accent, 240 4.8% 95.9%))",
|
|
120
|
+
color: "hsl(var(--sdk-accent-foreground, 240 5.9% 10%))",
|
|
121
|
+
};
|
|
108
122
|
case "link":
|
|
109
|
-
return {};
|
|
123
|
+
return { textDecoration: "underline" };
|
|
110
124
|
case "ghostOutline":
|
|
111
|
-
return {
|
|
125
|
+
return {
|
|
126
|
+
backgroundColor: "hsl(var(--sdk-accent, 240 4.8% 95.9%))",
|
|
127
|
+
color: "hsl(var(--sdk-foreground, 240 10% 3.9%))",
|
|
128
|
+
};
|
|
112
129
|
default:
|
|
113
130
|
return {};
|
|
114
131
|
}
|
|
115
132
|
};
|
|
133
|
+
// Focus styles
|
|
134
|
+
const getFocusStyles = (variant) => {
|
|
135
|
+
const baseStyles = {
|
|
136
|
+
outline: "1px solid hsl(var(--sdk-ring, 240 10% 3.9%))",
|
|
137
|
+
outlineOffset: "1px",
|
|
138
|
+
};
|
|
139
|
+
// Preserve variant colors on focus
|
|
140
|
+
switch (variant) {
|
|
141
|
+
case "outline":
|
|
142
|
+
return Object.assign(Object.assign({}, baseStyles), { backgroundColor: "hsl(var(--sdk-secondary, 240 3.7% 15.9%))", color: "hsl(var(--sdk-secondary-foreground, 0 0% 98%))" });
|
|
143
|
+
default:
|
|
144
|
+
return baseStyles;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
116
147
|
const Button = React.forwardRef((_a, ref) => {
|
|
117
|
-
var { variant = "default", size = "default", asChild = false, style, onMouseEnter, onMouseLeave } = _a, props = __rest(_a, ["variant", "size", "asChild", "style", "onMouseEnter", "onMouseLeave"]);
|
|
148
|
+
var { variant = "default", size = "default", asChild = false, style, onMouseEnter, onMouseLeave, onFocus, onBlur, onClick } = _a, props = __rest(_a, ["variant", "size", "asChild", "style", "onMouseEnter", "onMouseLeave", "onFocus", "onBlur", "onClick"]);
|
|
118
149
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
119
|
-
const
|
|
150
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
151
|
+
const buttonStyle = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, baseButtonStyles), variantStyles[variant]), sizeStyles[size]), (isHovered ? getHoverStyles(variant) : {})), (isFocused ? getFocusStyles(variant) : {})), style);
|
|
120
152
|
// Handle disabled state
|
|
121
153
|
if (props.disabled) {
|
|
122
154
|
buttonStyle.pointerEvents = "none";
|
|
123
155
|
buttonStyle.opacity = 0.5;
|
|
156
|
+
buttonStyle.cursor = "not-allowed";
|
|
124
157
|
}
|
|
125
158
|
const handleMouseEnter = (e) => {
|
|
126
159
|
setIsHovered(true);
|
|
@@ -130,12 +163,27 @@ const Button = React.forwardRef((_a, ref) => {
|
|
|
130
163
|
setIsHovered(false);
|
|
131
164
|
onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave(e);
|
|
132
165
|
};
|
|
133
|
-
|
|
134
|
-
|
|
166
|
+
const handleFocus = (e) => {
|
|
167
|
+
setIsFocused(true);
|
|
168
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
169
|
+
};
|
|
170
|
+
const handleBlur = (e) => {
|
|
171
|
+
setIsFocused(false);
|
|
172
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
173
|
+
};
|
|
174
|
+
const handleClick = (e) => {
|
|
175
|
+
// Auto-blur after click to prevent stuck focus state
|
|
176
|
+
setTimeout(() => {
|
|
177
|
+
if (e.currentTarget) {
|
|
178
|
+
e.currentTarget.blur();
|
|
179
|
+
}
|
|
180
|
+
}, 150);
|
|
181
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
182
|
+
};
|
|
135
183
|
if (asChild) {
|
|
136
|
-
console.warn("asChild prop is not supported in the inline CSS version of Button.
|
|
184
|
+
console.warn("asChild prop is not supported in the inline CSS version of Button.");
|
|
137
185
|
}
|
|
138
|
-
return (React.createElement("button", Object.assign({ style: buttonStyle, ref: ref, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave }, props)));
|
|
186
|
+
return (React.createElement("button", Object.assign({ style: buttonStyle, ref: ref, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onFocus: handleFocus, onBlur: handleBlur, onClick: handleClick }, props)));
|
|
139
187
|
});
|
|
140
188
|
Button.displayName = "Button";
|
|
141
189
|
export { Button };
|
package/dist/index.d.ts
CHANGED
|
@@ -13,18 +13,13 @@ export declare interface BaseSettings {
|
|
|
13
13
|
[key: string]: any;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export declare const ChatBar: ({
|
|
16
|
+
export declare const ChatBar: ({ placeholder, onSubmit, playgroundUid, isSubmitting, typingTexts, shouldFocusOnMount, showModelSelector, projectUid, theme, height, deepgramApiKey, }: ChatBarProps) => default_2.JSX.Element;
|
|
17
17
|
|
|
18
18
|
export declare interface ChatBarProps {
|
|
19
|
-
|
|
19
|
+
playgroundUid: string;
|
|
20
20
|
placeholder?: string;
|
|
21
|
-
|
|
22
|
-
onSubmit: (e: default_2.FormEvent) => void;
|
|
23
|
-
isStreaming: boolean;
|
|
21
|
+
onSubmit?: (e: default_2.FormEvent) => void;
|
|
24
22
|
height: string;
|
|
25
|
-
hasPendingEnv?: boolean;
|
|
26
|
-
playgroundUid?: string;
|
|
27
|
-
hasTypingAnimation?: boolean;
|
|
28
23
|
onCancel?: () => void;
|
|
29
24
|
isSubmitting?: boolean;
|
|
30
25
|
typingTexts?: string[];
|
|
@@ -32,6 +27,8 @@ export declare interface ChatBarProps {
|
|
|
32
27
|
showModelSelector?: boolean;
|
|
33
28
|
projectUid?: string | null | undefined;
|
|
34
29
|
theme?: ThemeName;
|
|
30
|
+
deepgramApiKey?: string;
|
|
31
|
+
apiBaseUrl?: string;
|
|
35
32
|
}
|
|
36
33
|
|
|
37
34
|
export declare const ChatButton: default_2.FC<ChatButtonProps>;
|