@usecrow/ui 0.1.2 → 0.1.4
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/index.cjs +42 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +43 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -687,7 +687,10 @@ var DEFAULT_WIDGET_STYLES = {
|
|
|
687
687
|
typography: {
|
|
688
688
|
fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
689
689
|
fontSize: 14,
|
|
690
|
-
headerFontSize: 16
|
|
690
|
+
headerFontSize: 16,
|
|
691
|
+
fontWeight: 400,
|
|
692
|
+
lineHeight: 1.5,
|
|
693
|
+
letterSpacing: 0
|
|
691
694
|
},
|
|
692
695
|
// ═══════════════════════════════════════════════════════════
|
|
693
696
|
// ANIMATIONS
|
|
@@ -702,7 +705,6 @@ var DEFAULT_WIDGET_STYLES = {
|
|
|
702
705
|
dimensions: {
|
|
703
706
|
width: 400,
|
|
704
707
|
maxHeight: 600,
|
|
705
|
-
previewHeight: 700,
|
|
706
708
|
messagesMaxHeight: 350,
|
|
707
709
|
borderRadius: 24,
|
|
708
710
|
padding: 20
|
|
@@ -765,7 +767,10 @@ var DEFAULT_COPILOT_STYLES = {
|
|
|
765
767
|
typography: {
|
|
766
768
|
fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
767
769
|
fontSize: 14,
|
|
768
|
-
headerFontSize: 16
|
|
770
|
+
headerFontSize: 16,
|
|
771
|
+
fontWeight: 400,
|
|
772
|
+
lineHeight: 1.5,
|
|
773
|
+
letterSpacing: 0
|
|
769
774
|
},
|
|
770
775
|
// ═══════════════════════════════════════════════════════════
|
|
771
776
|
// ANIMATIONS
|
|
@@ -885,6 +890,9 @@ function stylesToCSSVariables(styles2) {
|
|
|
885
890
|
"--crow-font-family": styles2.typography.fontFamily,
|
|
886
891
|
"--crow-font-size": `${styles2.typography.fontSize}px`,
|
|
887
892
|
"--crow-header-font-size": `${styles2.typography.headerFontSize}px`,
|
|
893
|
+
"--crow-font-weight": `${styles2.typography.fontWeight}`,
|
|
894
|
+
"--crow-line-height": `${styles2.typography.lineHeight}`,
|
|
895
|
+
"--crow-letter-spacing": `${styles2.typography.letterSpacing}px`,
|
|
888
896
|
// Animations
|
|
889
897
|
"--crow-animation-duration": `${styles2.animations.duration}s`,
|
|
890
898
|
"--crow-animation-easing": styles2.animations.easing
|
|
@@ -1120,9 +1128,27 @@ var GlassCard = React3.forwardRef(
|
|
|
1120
1128
|
}
|
|
1121
1129
|
);
|
|
1122
1130
|
GlassCard.displayName = "GlassCard";
|
|
1131
|
+
var GOOGLE_FONTS_MAP = {
|
|
1132
|
+
'"Inter", sans-serif': "Inter:wght@300;400;500;600;700",
|
|
1133
|
+
'"Roboto", sans-serif': "Roboto:wght@300;400;500;700",
|
|
1134
|
+
'"Open Sans", sans-serif': "Open+Sans:wght@300;400;500;600;700",
|
|
1135
|
+
'"Poppins", sans-serif': "Poppins:wght@300;400;500;600;700",
|
|
1136
|
+
'"Montserrat", sans-serif': "Montserrat:wght@300;400;500;600;700"
|
|
1137
|
+
};
|
|
1123
1138
|
var WidgetShell = React3.forwardRef(
|
|
1124
1139
|
({ children, className }, ref) => {
|
|
1125
1140
|
const { styles: styles2, variant } = useWidgetStyleContext();
|
|
1141
|
+
React3.useEffect(() => {
|
|
1142
|
+
const fontParam = GOOGLE_FONTS_MAP[styles2.typography.fontFamily];
|
|
1143
|
+
if (!fontParam) return;
|
|
1144
|
+
const linkId = `crow-google-font-${fontParam.split(":")[0]}`;
|
|
1145
|
+
if (document.getElementById(linkId)) return;
|
|
1146
|
+
const link = document.createElement("link");
|
|
1147
|
+
link.id = linkId;
|
|
1148
|
+
link.rel = "stylesheet";
|
|
1149
|
+
link.href = `https://fonts.googleapis.com/css2?family=${fontParam}&display=swap`;
|
|
1150
|
+
document.head.appendChild(link);
|
|
1151
|
+
}, [styles2.typography.fontFamily]);
|
|
1126
1152
|
const baseStyle = {
|
|
1127
1153
|
borderRadius: styles2.dimensions.borderRadius,
|
|
1128
1154
|
padding: styles2.dimensions.padding,
|
|
@@ -1131,18 +1157,21 @@ var WidgetShell = React3.forwardRef(
|
|
|
1131
1157
|
color: styles2.colors.text,
|
|
1132
1158
|
boxShadow: styles2.shadows.widget,
|
|
1133
1159
|
fontFamily: styles2.typography.fontFamily,
|
|
1134
|
-
fontSize: styles2.typography.fontSize
|
|
1160
|
+
fontSize: styles2.typography.fontSize,
|
|
1161
|
+
fontWeight: styles2.typography.fontWeight,
|
|
1162
|
+
lineHeight: styles2.typography.lineHeight,
|
|
1163
|
+
letterSpacing: styles2.typography.letterSpacing
|
|
1135
1164
|
};
|
|
1136
1165
|
if (variant === "embedded") {
|
|
1137
1166
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1138
1167
|
GlassCard,
|
|
1139
1168
|
{
|
|
1140
1169
|
ref,
|
|
1141
|
-
className: `crow-flex crow-flex-col crow-shadow-2xl crow-gap-3
|
|
1170
|
+
className: `crow-flex crow-flex-col crow-shadow-2xl crow-gap-3 ${className ?? ""}`,
|
|
1142
1171
|
style: {
|
|
1143
1172
|
...baseStyle,
|
|
1144
|
-
|
|
1145
|
-
|
|
1173
|
+
width: `min(${styles2.dimensions.width}px, calc(100vw - 32px))`,
|
|
1174
|
+
height: `min(${styles2.dimensions.maxHeight}px, calc(100vh - 120px))`
|
|
1146
1175
|
},
|
|
1147
1176
|
children
|
|
1148
1177
|
}
|
|
@@ -1525,7 +1554,7 @@ function MessageBubble({
|
|
|
1525
1554
|
border: `1px solid ${styles2.colors.userBorder}`
|
|
1526
1555
|
},
|
|
1527
1556
|
children: [
|
|
1528
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "crow-
|
|
1557
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "crow-whitespace-pre-wrap", children: message.isBot ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1529
1558
|
StreamingText,
|
|
1530
1559
|
{
|
|
1531
1560
|
content: message.content,
|
|
@@ -2256,7 +2285,7 @@ function CrowWidget({
|
|
|
2256
2285
|
onExit: handleExitWorkflow
|
|
2257
2286
|
}
|
|
2258
2287
|
) }),
|
|
2259
|
-
/* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: (chat.messages.length > 0 || conversations.isLoadingHistory) && /* @__PURE__ */ jsxRuntime.jsx(MessagesContainer, { ref: messagesContainerRef, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2288
|
+
/* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: (chat.messages.length > 0 || conversations.isLoadingHistory) && /* @__PURE__ */ jsxRuntime.jsx(MessagesContainer, { ref: messagesContainerRef, maxHeight: styles2.dimensions.messagesMaxHeight, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2260
2289
|
MessageList,
|
|
2261
2290
|
{
|
|
2262
2291
|
messages: chat.messages,
|
|
@@ -2306,7 +2335,7 @@ function CrowWidget({
|
|
|
2306
2335
|
onExit: handleExitWorkflow
|
|
2307
2336
|
}
|
|
2308
2337
|
) }),
|
|
2309
|
-
/* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: (chat.messages.length > 0 || conversations.isLoadingHistory) && /* @__PURE__ */ jsxRuntime.jsx(MessagesContainer, { ref: messagesContainerRef, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2338
|
+
/* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: (chat.messages.length > 0 || conversations.isLoadingHistory) && /* @__PURE__ */ jsxRuntime.jsx(MessagesContainer, { ref: messagesContainerRef, maxHeight: styles2.dimensions.messagesMaxHeight, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2310
2339
|
MessageList,
|
|
2311
2340
|
{
|
|
2312
2341
|
messages: chat.messages,
|
|
@@ -2446,6 +2475,9 @@ function CrowCopilot({
|
|
|
2446
2475
|
width: widthStyle,
|
|
2447
2476
|
fontFamily: styles2.typography.fontFamily,
|
|
2448
2477
|
fontSize: styles2.typography.fontSize,
|
|
2478
|
+
fontWeight: styles2.typography.fontWeight,
|
|
2479
|
+
lineHeight: styles2.typography.lineHeight,
|
|
2480
|
+
letterSpacing: styles2.typography.letterSpacing,
|
|
2449
2481
|
background: styles2.colors.background,
|
|
2450
2482
|
borderColor: styles2.colors.border
|
|
2451
2483
|
},
|