@sampleapp.ai/sdk 1.0.24 → 1.0.26
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 +150 -0
- package/dist/components/chat-bar/voice-button/voice-icon.js +129 -0
- package/dist/components/chat-bar/voice-button.js +24 -0
- package/dist/components/chat-bar/voice-overlay.js +190 -0
- package/dist/components/chat-bar.js +580 -0
- package/dist/components/icons.js +155 -0
- package/dist/components/minimal-chat-bar.js +51 -0
- package/dist/components/ui/button.js +189 -0
- package/dist/components/ui/card.js +77 -0
- package/dist/components/ui/textarea.js +68 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.es.js +1430 -94
- package/dist/index.js +5 -1
- package/dist/index.standalone.js +87 -0
- package/dist/index.standalone.umd.js +147 -0
- package/dist/index.umd.js +319 -34
- package/dist/sdk.css +1 -0
- package/dist/themes.js +189 -0
- package/package.json +9 -3
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React from "react";
|
|
3
|
+
// Loader/Spinner Icon Component
|
|
4
|
+
export const LoaderIcon = ({ size = 20, className = "", style = {}, }) => {
|
|
5
|
+
return (React.createElement(React.Fragment, null,
|
|
6
|
+
React.createElement("style", null, `
|
|
7
|
+
@keyframes icon-spin {
|
|
8
|
+
from { transform: rotate(0deg); }
|
|
9
|
+
to { transform: rotate(360deg); }
|
|
10
|
+
}
|
|
11
|
+
`),
|
|
12
|
+
React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: `lucide lucide-loader-circle ${className}`, style: Object.assign({ animation: "icon-spin 1s linear infinite" }, style) },
|
|
13
|
+
React.createElement("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }))));
|
|
14
|
+
};
|
|
15
|
+
// Arrow Up Icon Component
|
|
16
|
+
export const ArrowUpIcon = ({ size = 20, className = "", style = {}, }) => {
|
|
17
|
+
return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: `lucide lucide-arrow-up ${className}`, style: Object.assign({}, style) },
|
|
18
|
+
React.createElement("path", { d: "m5 12 7-7 7 7" }),
|
|
19
|
+
React.createElement("path", { d: "M12 19V5" })));
|
|
20
|
+
};
|
|
21
|
+
export const VoiceIcon = ({ isRecording = false, isTranscribing = false, size = 20, style = {}, }) => {
|
|
22
|
+
const containerStyle = Object.assign({ position: "relative", width: `${size}px`, height: `${Math.floor(size * 0.8)}px`, display: "flex", alignItems: "center", justifyContent: "center" }, style);
|
|
23
|
+
if (isTranscribing) {
|
|
24
|
+
return (React.createElement(React.Fragment, null,
|
|
25
|
+
React.createElement("style", null, `
|
|
26
|
+
@keyframes icon-spin {
|
|
27
|
+
from { transform: rotate(0deg); }
|
|
28
|
+
to { transform: rotate(360deg); }
|
|
29
|
+
}
|
|
30
|
+
`),
|
|
31
|
+
React.createElement("div", { style: containerStyle },
|
|
32
|
+
React.createElement("div", { style: {
|
|
33
|
+
width: `${Math.floor(size * 0.6)}px`,
|
|
34
|
+
height: `${Math.floor(size * 0.6)}px`,
|
|
35
|
+
border: "2px solid currentColor",
|
|
36
|
+
borderTop: "2px solid transparent",
|
|
37
|
+
borderRadius: "50%",
|
|
38
|
+
animation: "icon-spin 1s linear infinite",
|
|
39
|
+
} }))));
|
|
40
|
+
}
|
|
41
|
+
if (isRecording) {
|
|
42
|
+
return (React.createElement(React.Fragment, null,
|
|
43
|
+
React.createElement("style", null, `
|
|
44
|
+
@keyframes icon-pulse {
|
|
45
|
+
0%, 100% { transform: scale(1); }
|
|
46
|
+
50% { transform: scale(0.95); }
|
|
47
|
+
}
|
|
48
|
+
`),
|
|
49
|
+
React.createElement("div", { style: containerStyle },
|
|
50
|
+
React.createElement("div", { style: {
|
|
51
|
+
width: `${Math.floor(size * 0.6)}px`,
|
|
52
|
+
height: `${Math.floor(size * 0.6)}px`,
|
|
53
|
+
backgroundColor: "currentColor",
|
|
54
|
+
borderRadius: "2px",
|
|
55
|
+
animation: "icon-pulse 1s ease-in-out infinite",
|
|
56
|
+
} }))));
|
|
57
|
+
}
|
|
58
|
+
// Default voice icon with sound wave animation
|
|
59
|
+
const barWidth = Math.max(1, Math.floor(size * 0.075));
|
|
60
|
+
const gap = Math.max(1, Math.floor(size * 0.1));
|
|
61
|
+
return (React.createElement(React.Fragment, null,
|
|
62
|
+
React.createElement("style", null, `
|
|
63
|
+
@keyframes wave1 {
|
|
64
|
+
0%, 100% {
|
|
65
|
+
transform: scaleY(0.4);
|
|
66
|
+
opacity: 0.6;
|
|
67
|
+
}
|
|
68
|
+
50% {
|
|
69
|
+
transform: scaleY(0.8);
|
|
70
|
+
opacity: 0.9;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@keyframes wave2 {
|
|
75
|
+
0%, 100% {
|
|
76
|
+
transform: scaleY(0.5);
|
|
77
|
+
opacity: 0.7;
|
|
78
|
+
}
|
|
79
|
+
50% {
|
|
80
|
+
transform: scaleY(1);
|
|
81
|
+
opacity: 1;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@keyframes wave3 {
|
|
86
|
+
0%, 100% {
|
|
87
|
+
transform: scaleY(0.6);
|
|
88
|
+
opacity: 0.8;
|
|
89
|
+
}
|
|
90
|
+
50% {
|
|
91
|
+
transform: scaleY(1);
|
|
92
|
+
opacity: 1;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@keyframes wave4 {
|
|
97
|
+
0%, 100% {
|
|
98
|
+
transform: scaleY(0.5);
|
|
99
|
+
opacity: 0.7;
|
|
100
|
+
}
|
|
101
|
+
50% {
|
|
102
|
+
transform: scaleY(0.9);
|
|
103
|
+
opacity: 1;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@keyframes wave5 {
|
|
108
|
+
0%, 100% {
|
|
109
|
+
transform: scaleY(0.4);
|
|
110
|
+
opacity: 0.6;
|
|
111
|
+
}
|
|
112
|
+
50% {
|
|
113
|
+
transform: scaleY(0.7);
|
|
114
|
+
opacity: 0.9;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
`),
|
|
118
|
+
React.createElement("div", { style: containerStyle },
|
|
119
|
+
React.createElement("div", { style: { display: "flex", alignItems: "center", gap: `${gap}px` } },
|
|
120
|
+
React.createElement("div", { style: {
|
|
121
|
+
width: `${barWidth}px`,
|
|
122
|
+
height: `${Math.floor(size * 0.4)}px`,
|
|
123
|
+
backgroundColor: "currentColor",
|
|
124
|
+
borderRadius: "999px",
|
|
125
|
+
animation: "wave1 1.8s ease-in-out infinite",
|
|
126
|
+
} }),
|
|
127
|
+
React.createElement("div", { style: {
|
|
128
|
+
width: `${barWidth}px`,
|
|
129
|
+
height: `${Math.floor(size * 0.6)}px`,
|
|
130
|
+
backgroundColor: "currentColor",
|
|
131
|
+
borderRadius: "999px",
|
|
132
|
+
animation: "wave2 2.1s ease-in-out infinite",
|
|
133
|
+
} }),
|
|
134
|
+
React.createElement("div", { style: {
|
|
135
|
+
width: `${barWidth}px`,
|
|
136
|
+
height: `${Math.floor(size * 0.8)}px`,
|
|
137
|
+
backgroundColor: "currentColor",
|
|
138
|
+
borderRadius: "999px",
|
|
139
|
+
animation: "wave3 1.6s ease-in-out infinite",
|
|
140
|
+
} }),
|
|
141
|
+
React.createElement("div", { style: {
|
|
142
|
+
width: `${barWidth}px`,
|
|
143
|
+
height: `${Math.floor(size * 0.6)}px`,
|
|
144
|
+
backgroundColor: "currentColor",
|
|
145
|
+
borderRadius: "999px",
|
|
146
|
+
animation: "wave4 1.9s ease-in-out infinite",
|
|
147
|
+
} }),
|
|
148
|
+
React.createElement("div", { style: {
|
|
149
|
+
width: `${barWidth}px`,
|
|
150
|
+
height: `${Math.floor(size * 0.4)}px`,
|
|
151
|
+
backgroundColor: "currentColor",
|
|
152
|
+
borderRadius: "999px",
|
|
153
|
+
animation: "wave5 2.2s ease-in-out infinite",
|
|
154
|
+
} })))));
|
|
155
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// src/components/MinimalChatBar.tsx
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
export const MinimalChatBar = ({ placeholder = "Ask anything...", onSubmit, theme = "light", }) => {
|
|
4
|
+
const [message, setMessage] = useState("");
|
|
5
|
+
const handleSubmit = (e) => {
|
|
6
|
+
e.preventDefault();
|
|
7
|
+
if (message.trim()) {
|
|
8
|
+
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(message.trim());
|
|
9
|
+
setMessage("");
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
return (React.createElement("div", { style: {
|
|
13
|
+
width: "100%",
|
|
14
|
+
maxWidth: "600px",
|
|
15
|
+
margin: "0 auto",
|
|
16
|
+
} },
|
|
17
|
+
React.createElement("form", { onSubmit: handleSubmit, style: {
|
|
18
|
+
display: "flex",
|
|
19
|
+
gap: "8px",
|
|
20
|
+
padding: "12px",
|
|
21
|
+
border: theme === "dark" ? "1px solid #333" : "1px solid #ccc",
|
|
22
|
+
borderRadius: "8px",
|
|
23
|
+
backgroundColor: theme === "dark" ? "#1a1a1a" : "#ffffff",
|
|
24
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
|
|
25
|
+
} },
|
|
26
|
+
React.createElement("input", { type: "text", value: message, onChange: (e) => setMessage(e.target.value), placeholder: placeholder, style: {
|
|
27
|
+
flex: 1,
|
|
28
|
+
padding: "8px 12px",
|
|
29
|
+
border: "1px solid #ddd",
|
|
30
|
+
borderRadius: "4px",
|
|
31
|
+
fontSize: "14px",
|
|
32
|
+
outline: "none",
|
|
33
|
+
backgroundColor: theme === "dark" ? "#333" : "#fff",
|
|
34
|
+
color: theme === "dark" ? "#fff" : "#000",
|
|
35
|
+
} }),
|
|
36
|
+
React.createElement("button", { type: "submit", disabled: !message.trim(), style: {
|
|
37
|
+
padding: "8px 16px",
|
|
38
|
+
backgroundColor: message.trim() ? "#007bff" : "#ccc",
|
|
39
|
+
color: "white",
|
|
40
|
+
border: "none",
|
|
41
|
+
borderRadius: "4px",
|
|
42
|
+
cursor: message.trim() ? "pointer" : "not-allowed",
|
|
43
|
+
fontSize: "14px",
|
|
44
|
+
} }, "Send")),
|
|
45
|
+
React.createElement("p", { style: {
|
|
46
|
+
fontSize: "12px",
|
|
47
|
+
color: "#666",
|
|
48
|
+
textAlign: "center",
|
|
49
|
+
marginTop: "8px",
|
|
50
|
+
} }, "SDK Version: @sampleapp.ai/sdk v1.0.25")));
|
|
51
|
+
};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import * as React from "react";
|
|
13
|
+
// Import your scoped styles
|
|
14
|
+
// Base button styles
|
|
15
|
+
const baseButtonStyles = {
|
|
16
|
+
display: "inline-flex",
|
|
17
|
+
alignItems: "center",
|
|
18
|
+
justifyContent: "center",
|
|
19
|
+
gap: "0.5rem",
|
|
20
|
+
whiteSpace: "nowrap",
|
|
21
|
+
borderRadius: "15px",
|
|
22
|
+
fontSize: "14px",
|
|
23
|
+
fontWeight: "500",
|
|
24
|
+
transition: "all 0.15s ease-in-out",
|
|
25
|
+
outline: "none",
|
|
26
|
+
border: "none",
|
|
27
|
+
cursor: "pointer",
|
|
28
|
+
fontFamily: "inherit",
|
|
29
|
+
flexShrink: 0,
|
|
30
|
+
};
|
|
31
|
+
// Variant styles using prefixed CSS variables with fallbacks
|
|
32
|
+
const variantStyles = {
|
|
33
|
+
default: {
|
|
34
|
+
backgroundColor: "hsl(var(--sdk-primary, 240 5.9% 10%))",
|
|
35
|
+
color: "hsl(var(--sdk-primary-foreground, 0 0% 98%))",
|
|
36
|
+
boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
37
|
+
},
|
|
38
|
+
destructive: {
|
|
39
|
+
backgroundColor: "hsl(var(--sdk-destructive, 0 84.2% 60.2%))",
|
|
40
|
+
color: "hsl(var(--sdk-destructive-foreground, 0 0% 98%))",
|
|
41
|
+
boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
42
|
+
},
|
|
43
|
+
outline: {
|
|
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%))",
|
|
47
|
+
boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
48
|
+
},
|
|
49
|
+
secondary: {
|
|
50
|
+
backgroundColor: "hsl(var(--sdk-secondary, 240 4.8% 95.9%))",
|
|
51
|
+
color: "hsl(var(--sdk-secondary-foreground, 240 5.9% 10%))",
|
|
52
|
+
boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
53
|
+
},
|
|
54
|
+
ghost: {
|
|
55
|
+
backgroundColor: "transparent",
|
|
56
|
+
color: "hsl(var(--sdk-foreground, 240 10% 3.9%))",
|
|
57
|
+
},
|
|
58
|
+
link: {
|
|
59
|
+
backgroundColor: "transparent",
|
|
60
|
+
color: "hsl(var(--sdk-primary, 240 5.9% 10%))",
|
|
61
|
+
textDecoration: "underline",
|
|
62
|
+
textUnderlineOffset: "4px",
|
|
63
|
+
},
|
|
64
|
+
ghostOutline: {
|
|
65
|
+
border: "1px solid hsl(var(--sdk-secondary, 240 4.8% 95.9%))",
|
|
66
|
+
backgroundColor: "transparent",
|
|
67
|
+
color: "hsl(var(--sdk-muted-foreground, 240 3.8% 46.1%))",
|
|
68
|
+
boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
// Size styles
|
|
72
|
+
const sizeStyles = {
|
|
73
|
+
default: {
|
|
74
|
+
height: "36px",
|
|
75
|
+
paddingLeft: "16px",
|
|
76
|
+
paddingRight: "16px",
|
|
77
|
+
paddingTop: "8px",
|
|
78
|
+
paddingBottom: "8px",
|
|
79
|
+
},
|
|
80
|
+
sm: {
|
|
81
|
+
height: "32px",
|
|
82
|
+
paddingLeft: "12px",
|
|
83
|
+
paddingRight: "12px",
|
|
84
|
+
fontSize: "12px",
|
|
85
|
+
borderRadius: "6px",
|
|
86
|
+
},
|
|
87
|
+
lg: {
|
|
88
|
+
height: "40px",
|
|
89
|
+
paddingLeft: "32px",
|
|
90
|
+
paddingRight: "32px",
|
|
91
|
+
borderRadius: "6px",
|
|
92
|
+
},
|
|
93
|
+
icon: {
|
|
94
|
+
height: "32px",
|
|
95
|
+
width: "32px",
|
|
96
|
+
padding: "0",
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
// Hover styles with CSS variables and fallbacks
|
|
100
|
+
const getHoverStyles = (variant) => {
|
|
101
|
+
switch (variant) {
|
|
102
|
+
case "default":
|
|
103
|
+
return { backgroundColor: "hsl(var(--sdk-primary, 240 5.9% 10%) / 0.9)" };
|
|
104
|
+
case "destructive":
|
|
105
|
+
return {
|
|
106
|
+
backgroundColor: "hsl(var(--sdk-destructive, 0 84.2% 60.2%) / 0.9)",
|
|
107
|
+
};
|
|
108
|
+
case "outline":
|
|
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
|
+
};
|
|
113
|
+
case "secondary":
|
|
114
|
+
return {
|
|
115
|
+
backgroundColor: "hsl(var(--sdk-secondary, 240 4.8% 95.9%) / 0.7)",
|
|
116
|
+
};
|
|
117
|
+
case "ghost":
|
|
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
|
+
};
|
|
122
|
+
case "link":
|
|
123
|
+
return { textDecoration: "underline" };
|
|
124
|
+
case "ghostOutline":
|
|
125
|
+
return {
|
|
126
|
+
backgroundColor: "hsl(var(--sdk-accent, 240 4.8% 95.9%))",
|
|
127
|
+
color: "hsl(var(--sdk-foreground, 240 10% 3.9%))",
|
|
128
|
+
};
|
|
129
|
+
default:
|
|
130
|
+
return {};
|
|
131
|
+
}
|
|
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
|
+
};
|
|
147
|
+
const Button = React.forwardRef((_a, ref) => {
|
|
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"]);
|
|
149
|
+
const [isHovered, setIsHovered] = React.useState(false);
|
|
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);
|
|
152
|
+
// Handle disabled state
|
|
153
|
+
if (props.disabled) {
|
|
154
|
+
buttonStyle.pointerEvents = "none";
|
|
155
|
+
buttonStyle.opacity = 0.5;
|
|
156
|
+
buttonStyle.cursor = "not-allowed";
|
|
157
|
+
}
|
|
158
|
+
const handleMouseEnter = (e) => {
|
|
159
|
+
setIsHovered(true);
|
|
160
|
+
onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter(e);
|
|
161
|
+
};
|
|
162
|
+
const handleMouseLeave = (e) => {
|
|
163
|
+
setIsHovered(false);
|
|
164
|
+
onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave(e);
|
|
165
|
+
};
|
|
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
|
+
};
|
|
183
|
+
if (asChild) {
|
|
184
|
+
console.warn("asChild prop is not supported in the inline CSS version of Button.");
|
|
185
|
+
}
|
|
186
|
+
return (React.createElement("button", Object.assign({ style: buttonStyle, ref: ref, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onFocus: handleFocus, onBlur: handleBlur, onClick: handleClick }, props)));
|
|
187
|
+
});
|
|
188
|
+
Button.displayName = "Button";
|
|
189
|
+
export { Button };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import * as React from "react";
|
|
13
|
+
// Card component styles
|
|
14
|
+
const cardStyles = {
|
|
15
|
+
borderRadius: "12px",
|
|
16
|
+
border: "1px solid #e2e8f0",
|
|
17
|
+
backgroundColor: "#ffffff",
|
|
18
|
+
color: "#0f172a",
|
|
19
|
+
boxShadow: "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
|
|
20
|
+
};
|
|
21
|
+
const cardHeaderStyles = {
|
|
22
|
+
display: "flex",
|
|
23
|
+
flexDirection: "column",
|
|
24
|
+
gap: "6px",
|
|
25
|
+
padding: "24px",
|
|
26
|
+
};
|
|
27
|
+
const cardTitleStyles = {
|
|
28
|
+
fontWeight: "500",
|
|
29
|
+
lineHeight: "1",
|
|
30
|
+
fontSize: "18px",
|
|
31
|
+
};
|
|
32
|
+
const cardDescriptionStyles = {
|
|
33
|
+
fontSize: "14px",
|
|
34
|
+
color: "#64748b",
|
|
35
|
+
lineHeight: "1.4",
|
|
36
|
+
};
|
|
37
|
+
const cardContentStyles = {
|
|
38
|
+
padding: "24px",
|
|
39
|
+
paddingTop: "0",
|
|
40
|
+
};
|
|
41
|
+
const cardFooterStyles = {
|
|
42
|
+
display: "flex",
|
|
43
|
+
alignItems: "center",
|
|
44
|
+
padding: "24px",
|
|
45
|
+
paddingTop: "0",
|
|
46
|
+
};
|
|
47
|
+
const Card = React.forwardRef((_a, ref) => {
|
|
48
|
+
var { style } = _a, props = __rest(_a, ["style"]);
|
|
49
|
+
return (React.createElement("div", Object.assign({ ref: ref, style: Object.assign(Object.assign({}, cardStyles), style) }, props)));
|
|
50
|
+
});
|
|
51
|
+
Card.displayName = "Card";
|
|
52
|
+
const CardHeader = React.forwardRef((_a, ref) => {
|
|
53
|
+
var { style } = _a, props = __rest(_a, ["style"]);
|
|
54
|
+
return (React.createElement("div", Object.assign({ ref: ref, style: Object.assign(Object.assign({}, cardHeaderStyles), style) }, props)));
|
|
55
|
+
});
|
|
56
|
+
CardHeader.displayName = "CardHeader";
|
|
57
|
+
const CardTitle = React.forwardRef((_a, ref) => {
|
|
58
|
+
var { style } = _a, props = __rest(_a, ["style"]);
|
|
59
|
+
return (React.createElement("div", Object.assign({ ref: ref, style: Object.assign(Object.assign({}, cardTitleStyles), style) }, props)));
|
|
60
|
+
});
|
|
61
|
+
CardTitle.displayName = "CardTitle";
|
|
62
|
+
const CardDescription = React.forwardRef((_a, ref) => {
|
|
63
|
+
var { style } = _a, props = __rest(_a, ["style"]);
|
|
64
|
+
return (React.createElement("div", Object.assign({ ref: ref, style: Object.assign(Object.assign({}, cardDescriptionStyles), style) }, props)));
|
|
65
|
+
});
|
|
66
|
+
CardDescription.displayName = "CardDescription";
|
|
67
|
+
const CardContent = React.forwardRef((_a, ref) => {
|
|
68
|
+
var { style } = _a, props = __rest(_a, ["style"]);
|
|
69
|
+
return (React.createElement("div", Object.assign({ ref: ref, style: Object.assign(Object.assign({}, cardContentStyles), style) }, props)));
|
|
70
|
+
});
|
|
71
|
+
CardContent.displayName = "CardContent";
|
|
72
|
+
const CardFooter = React.forwardRef((_a, ref) => {
|
|
73
|
+
var { style } = _a, props = __rest(_a, ["style"]);
|
|
74
|
+
return (React.createElement("div", Object.assign({ ref: ref, style: Object.assign(Object.assign({}, cardFooterStyles), style) }, props)));
|
|
75
|
+
});
|
|
76
|
+
CardFooter.displayName = "CardFooter";
|
|
77
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import * as React from "react";
|
|
13
|
+
// Base textarea styles
|
|
14
|
+
const baseTextareaStyles = {
|
|
15
|
+
display: "flex",
|
|
16
|
+
minHeight: "60px",
|
|
17
|
+
width: "100%",
|
|
18
|
+
borderRadius: "6px",
|
|
19
|
+
border: "1px solid #e2e8f0",
|
|
20
|
+
backgroundColor: "transparent",
|
|
21
|
+
paddingLeft: "12px",
|
|
22
|
+
paddingRight: "12px",
|
|
23
|
+
paddingTop: "8px",
|
|
24
|
+
paddingBottom: "8px",
|
|
25
|
+
fontSize: "14px",
|
|
26
|
+
boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
27
|
+
outline: "none",
|
|
28
|
+
fontFamily: "inherit",
|
|
29
|
+
resize: "vertical",
|
|
30
|
+
transition: "border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out",
|
|
31
|
+
};
|
|
32
|
+
// Focus styles
|
|
33
|
+
const focusStyles = {
|
|
34
|
+
borderColor: "#0f172a",
|
|
35
|
+
boxShadow: "0 0 0 1px #0f172a",
|
|
36
|
+
};
|
|
37
|
+
// Placeholder styles (applied via CSS custom properties)
|
|
38
|
+
const placeholderColor = "#64748b";
|
|
39
|
+
const Textarea = React.forwardRef((_a, ref) => {
|
|
40
|
+
var { style, onFocus, onBlur } = _a, props = __rest(_a, ["style", "onFocus", "onBlur"]);
|
|
41
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
42
|
+
const textareaStyle = Object.assign(Object.assign(Object.assign(Object.assign({}, baseTextareaStyles), (isFocused ? focusStyles : {})), style), {
|
|
43
|
+
// Handle placeholder color via CSS custom property
|
|
44
|
+
// @ts-ignore - CSS custom properties are valid
|
|
45
|
+
"--placeholder-color": placeholderColor });
|
|
46
|
+
// Handle disabled state
|
|
47
|
+
if (props.disabled) {
|
|
48
|
+
textareaStyle.cursor = "not-allowed";
|
|
49
|
+
textareaStyle.opacity = 0.5;
|
|
50
|
+
}
|
|
51
|
+
const handleFocus = (e) => {
|
|
52
|
+
setIsFocused(true);
|
|
53
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
54
|
+
};
|
|
55
|
+
const handleBlur = (e) => {
|
|
56
|
+
setIsFocused(false);
|
|
57
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
58
|
+
};
|
|
59
|
+
return (React.createElement(React.Fragment, null,
|
|
60
|
+
React.createElement("style", null, `
|
|
61
|
+
.textarea-with-placeholder::placeholder {
|
|
62
|
+
color: var(--placeholder-color);
|
|
63
|
+
}
|
|
64
|
+
`),
|
|
65
|
+
React.createElement("textarea", Object.assign({ className: "textarea-with-placeholder", style: textareaStyle, ref: ref, onFocus: handleFocus, onBlur: handleBlur }, props))));
|
|
66
|
+
});
|
|
67
|
+
Textarea.displayName = "Textarea";
|
|
68
|
+
export { Textarea };
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,24 @@ export declare interface BaseSettings {
|
|
|
13
13
|
[key: string]: any;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
export declare const ChatBar: ({ placeholder, onSubmit, hasPendingEnv, playgroundUid, isSubmitting, typingTexts, shouldFocusOnMount, showModelSelector, projectUid, theme, height, }: ChatBarProps) => default_2.JSX.Element;
|
|
17
|
+
|
|
18
|
+
export declare interface ChatBarProps {
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
onSubmit?: (e: default_2.FormEvent) => void;
|
|
21
|
+
height: string;
|
|
22
|
+
hasPendingEnv?: boolean;
|
|
23
|
+
playgroundUid?: string;
|
|
24
|
+
hasTypingAnimation?: boolean;
|
|
25
|
+
onCancel?: () => void;
|
|
26
|
+
isSubmitting?: boolean;
|
|
27
|
+
typingTexts?: string[];
|
|
28
|
+
shouldFocusOnMount?: boolean;
|
|
29
|
+
showModelSelector?: boolean;
|
|
30
|
+
projectUid?: string | null | undefined;
|
|
31
|
+
theme?: ThemeName;
|
|
32
|
+
}
|
|
33
|
+
|
|
16
34
|
export declare const ChatButton: default_2.FC<ChatButtonProps>;
|
|
17
35
|
|
|
18
36
|
declare interface ChatButtonProps {
|
|
@@ -20,6 +38,10 @@ declare interface ChatButtonProps {
|
|
|
20
38
|
onClick?: () => void;
|
|
21
39
|
}
|
|
22
40
|
|
|
41
|
+
export declare const DEFAULT_THEME: ThemeName;
|
|
42
|
+
|
|
43
|
+
export declare const getTheme: (themeName?: ThemeName) => ThemeColors;
|
|
44
|
+
|
|
23
45
|
export declare const ModalSearchAndChat: default_2.FC<ModalSearchAndChatProps>;
|
|
24
46
|
|
|
25
47
|
declare interface ModalSearchAndChatProps {
|
|
@@ -47,4 +69,35 @@ export declare interface SDKSettings {
|
|
|
47
69
|
aiChatSettings?: AiChatSettings;
|
|
48
70
|
}
|
|
49
71
|
|
|
72
|
+
export declare interface ThemeColors {
|
|
73
|
+
primary: string;
|
|
74
|
+
shadow: {
|
|
75
|
+
light: string;
|
|
76
|
+
dark: string;
|
|
77
|
+
};
|
|
78
|
+
gradient: string;
|
|
79
|
+
placeholderText: {
|
|
80
|
+
light: string;
|
|
81
|
+
dark: string;
|
|
82
|
+
};
|
|
83
|
+
tabHint: {
|
|
84
|
+
text: {
|
|
85
|
+
light: string;
|
|
86
|
+
dark: string;
|
|
87
|
+
};
|
|
88
|
+
bg: {
|
|
89
|
+
light: string;
|
|
90
|
+
dark: string;
|
|
91
|
+
};
|
|
92
|
+
border: {
|
|
93
|
+
light: string;
|
|
94
|
+
dark: string;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export declare type ThemeName = "ocean" | "autumn" | "mint" | "sunset" | "lavender" | "forest" | "coral";
|
|
100
|
+
|
|
101
|
+
export declare const themes: Record<ThemeName, ThemeColors>;
|
|
102
|
+
|
|
50
103
|
export { }
|