@sampleapp.ai/sdk 1.0.23 → 1.0.25

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.
@@ -0,0 +1,141 @@
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 button styles
14
+ const baseButtonStyles = {
15
+ display: "inline-flex",
16
+ alignItems: "center",
17
+ justifyContent: "center",
18
+ gap: "0.5rem",
19
+ whiteSpace: "nowrap",
20
+ borderRadius: "6px",
21
+ fontSize: "14px",
22
+ fontWeight: "500",
23
+ transition: "colors 0.15s ease-in-out",
24
+ outline: "none",
25
+ border: "none",
26
+ cursor: "pointer",
27
+ fontFamily: "inherit",
28
+ };
29
+ // Variant styles
30
+ const variantStyles = {
31
+ default: {
32
+ backgroundColor: "#0f172a",
33
+ color: "#f8fafc",
34
+ boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
35
+ },
36
+ destructive: {
37
+ backgroundColor: "#dc2626",
38
+ color: "#fef2f2",
39
+ boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
40
+ },
41
+ outline: {
42
+ border: "1px solid #e2e8f0",
43
+ backgroundColor: "transparent",
44
+ color: "#0f172a",
45
+ boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
46
+ },
47
+ secondary: {
48
+ backgroundColor: "#f1f5f9",
49
+ color: "#0f172a",
50
+ boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
51
+ },
52
+ ghost: {
53
+ backgroundColor: "transparent",
54
+ color: "#0f172a",
55
+ },
56
+ link: {
57
+ backgroundColor: "transparent",
58
+ color: "#0f172a",
59
+ textDecoration: "underline",
60
+ textUnderlineOffset: "4px",
61
+ },
62
+ ghostOutline: {
63
+ border: "1px solid #f1f5f9",
64
+ backgroundColor: "transparent",
65
+ color: "#64748b",
66
+ boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
67
+ },
68
+ };
69
+ // Size styles
70
+ const sizeStyles = {
71
+ default: {
72
+ height: "36px",
73
+ paddingLeft: "16px",
74
+ paddingRight: "16px",
75
+ paddingTop: "8px",
76
+ paddingBottom: "8px",
77
+ },
78
+ sm: {
79
+ height: "32px",
80
+ paddingLeft: "12px",
81
+ paddingRight: "12px",
82
+ fontSize: "12px",
83
+ },
84
+ lg: {
85
+ height: "40px",
86
+ paddingLeft: "32px",
87
+ paddingRight: "32px",
88
+ },
89
+ icon: {
90
+ height: "32px",
91
+ width: "32px",
92
+ padding: "0",
93
+ },
94
+ };
95
+ // Hover styles
96
+ const getHoverStyles = (variant) => {
97
+ switch (variant) {
98
+ case "default":
99
+ return { backgroundColor: "#1e293b" };
100
+ case "destructive":
101
+ return { backgroundColor: "#b91c1c" };
102
+ case "outline":
103
+ return { backgroundColor: "#f1f5f9", color: "#0f172a" };
104
+ case "secondary":
105
+ return { backgroundColor: "#e2e8f0" };
106
+ case "ghost":
107
+ return { backgroundColor: "#f1f5f9", color: "#0f172a" };
108
+ case "link":
109
+ return {};
110
+ case "ghostOutline":
111
+ return { backgroundColor: "#f1f5f9", color: "#0f172a" };
112
+ default:
113
+ return {};
114
+ }
115
+ };
116
+ 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"]);
118
+ const [isHovered, setIsHovered] = React.useState(false);
119
+ const buttonStyle = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, baseButtonStyles), variantStyles[variant]), sizeStyles[size]), (isHovered ? getHoverStyles(variant) : {})), style);
120
+ // Handle disabled state
121
+ if (props.disabled) {
122
+ buttonStyle.pointerEvents = "none";
123
+ buttonStyle.opacity = 0.5;
124
+ }
125
+ const handleMouseEnter = (e) => {
126
+ setIsHovered(true);
127
+ onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter(e);
128
+ };
129
+ const handleMouseLeave = (e) => {
130
+ setIsHovered(false);
131
+ onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave(e);
132
+ };
133
+ // Note: asChild functionality removed for pure inline CSS approach
134
+ // If you need slot-like behavior, consider implementing it separately
135
+ if (asChild) {
136
+ console.warn("asChild prop is not supported in the inline CSS version of Button. Consider using a wrapper component instead.");
137
+ }
138
+ return (React.createElement("button", Object.assign({ style: buttonStyle, ref: ref, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave }, props)));
139
+ });
140
+ Button.displayName = "Button";
141
+ 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,27 @@ export declare interface BaseSettings {
13
13
  [key: string]: any;
14
14
  }
15
15
 
16
+ export declare const ChatBar: ({ query, placeholder, setQuery, onSubmit, isStreaming, height, hasPendingEnv, playgroundUid, hasTypingAnimation, isSubmitting, onCancel, typingTexts, shouldFocusOnMount, showModelSelector, projectUid, theme, }: ChatBarProps) => default_2.JSX.Element;
17
+
18
+ export declare interface ChatBarProps {
19
+ query: string;
20
+ placeholder?: string;
21
+ setQuery: (query: string) => void;
22
+ onSubmit: (e: default_2.FormEvent) => void;
23
+ isStreaming: boolean;
24
+ height: string;
25
+ hasPendingEnv?: boolean;
26
+ playgroundUid?: string;
27
+ hasTypingAnimation?: boolean;
28
+ onCancel?: () => void;
29
+ isSubmitting?: boolean;
30
+ typingTexts?: string[];
31
+ shouldFocusOnMount?: boolean;
32
+ showModelSelector?: boolean;
33
+ projectUid?: string | null | undefined;
34
+ theme?: ThemeName;
35
+ }
36
+
16
37
  export declare const ChatButton: default_2.FC<ChatButtonProps>;
17
38
 
18
39
  declare interface ChatButtonProps {
@@ -20,6 +41,10 @@ declare interface ChatButtonProps {
20
41
  onClick?: () => void;
21
42
  }
22
43
 
44
+ export declare const DEFAULT_THEME: ThemeName;
45
+
46
+ export declare const getTheme: (themeName?: ThemeName) => ThemeColors;
47
+
23
48
  export declare const ModalSearchAndChat: default_2.FC<ModalSearchAndChatProps>;
24
49
 
25
50
  declare interface ModalSearchAndChatProps {
@@ -47,4 +72,35 @@ export declare interface SDKSettings {
47
72
  aiChatSettings?: AiChatSettings;
48
73
  }
49
74
 
75
+ export declare interface ThemeColors {
76
+ primary: string;
77
+ shadow: {
78
+ light: string;
79
+ dark: string;
80
+ };
81
+ gradient: string;
82
+ placeholderText: {
83
+ light: string;
84
+ dark: string;
85
+ };
86
+ tabHint: {
87
+ text: {
88
+ light: string;
89
+ dark: string;
90
+ };
91
+ bg: {
92
+ light: string;
93
+ dark: string;
94
+ };
95
+ border: {
96
+ light: string;
97
+ dark: string;
98
+ };
99
+ };
100
+ }
101
+
102
+ export declare type ThemeName = "ocean" | "autumn" | "mint" | "sunset" | "lavender" | "forest" | "coral";
103
+
104
+ export declare const themes: Record<ThemeName, ThemeColors>;
105
+
50
106
  export { }