@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.d.cts CHANGED
@@ -44,6 +44,12 @@ interface TypographyConfig {
44
44
  fontSize?: number;
45
45
  /** Header font size in pixels */
46
46
  headerFontSize?: number;
47
+ /** Font weight (400 = normal, 500 = medium, 600 = semi-bold, 700 = bold) */
48
+ fontWeight?: number;
49
+ /** Line height multiplier (e.g., 1.5) */
50
+ lineHeight?: number;
51
+ /** Letter spacing in pixels */
52
+ letterSpacing?: number;
47
53
  }
48
54
  interface AnimationsConfig {
49
55
  /** Animation duration in seconds */
@@ -54,7 +60,7 @@ interface AnimationsConfig {
54
60
  interface WidgetDimensionsConfig {
55
61
  /** Widget width in pixels */
56
62
  width?: number;
57
- /** Max height for floating widget in pixels */
63
+ /** Max height for widget in pixels */
58
64
  maxHeight?: number;
59
65
  /** Border radius in pixels */
60
66
  borderRadius?: number;
@@ -62,8 +68,6 @@ interface WidgetDimensionsConfig {
62
68
  padding?: number;
63
69
  /** Messages container max height in pixels */
64
70
  messagesMaxHeight?: number;
65
- /** Fixed height for preview/embedded mode in pixels */
66
- previewHeight?: number;
67
71
  }
68
72
  interface WidgetPositionConfig {
69
73
  /** Distance from right edge in pixels */
package/dist/index.d.ts CHANGED
@@ -44,6 +44,12 @@ interface TypographyConfig {
44
44
  fontSize?: number;
45
45
  /** Header font size in pixels */
46
46
  headerFontSize?: number;
47
+ /** Font weight (400 = normal, 500 = medium, 600 = semi-bold, 700 = bold) */
48
+ fontWeight?: number;
49
+ /** Line height multiplier (e.g., 1.5) */
50
+ lineHeight?: number;
51
+ /** Letter spacing in pixels */
52
+ letterSpacing?: number;
47
53
  }
48
54
  interface AnimationsConfig {
49
55
  /** Animation duration in seconds */
@@ -54,7 +60,7 @@ interface AnimationsConfig {
54
60
  interface WidgetDimensionsConfig {
55
61
  /** Widget width in pixels */
56
62
  width?: number;
57
- /** Max height for floating widget in pixels */
63
+ /** Max height for widget in pixels */
58
64
  maxHeight?: number;
59
65
  /** Border radius in pixels */
60
66
  borderRadius?: number;
@@ -62,8 +68,6 @@ interface WidgetDimensionsConfig {
62
68
  padding?: number;
63
69
  /** Messages container max height in pixels */
64
70
  messagesMaxHeight?: number;
65
- /** Fixed height for preview/embedded mode in pixels */
66
- previewHeight?: number;
67
71
  }
68
72
  interface WidgetPositionConfig {
69
73
  /** Distance from right edge in pixels */
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import React3, { createContext, forwardRef, useRef, useCallback, useEffect, useContext, useState, useMemo, useLayoutEffect } from 'react';
1
+ import React3, { createContext, forwardRef, useEffect, useRef, useCallback, useContext, useState, useMemo, useLayoutEffect } from 'react';
2
2
  import { motion, AnimatePresence } from 'framer-motion';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { Square, ArrowUp, ChevronDown, Check, MessageCircle, Plus, History, ChevronUp, Brain, ChevronRight, Loader2, X } from 'lucide-react';
@@ -661,7 +661,10 @@ var DEFAULT_WIDGET_STYLES = {
661
661
  typography: {
662
662
  fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
663
663
  fontSize: 14,
664
- headerFontSize: 16
664
+ headerFontSize: 16,
665
+ fontWeight: 400,
666
+ lineHeight: 1.5,
667
+ letterSpacing: 0
665
668
  },
666
669
  // ═══════════════════════════════════════════════════════════
667
670
  // ANIMATIONS
@@ -676,7 +679,6 @@ var DEFAULT_WIDGET_STYLES = {
676
679
  dimensions: {
677
680
  width: 400,
678
681
  maxHeight: 600,
679
- previewHeight: 700,
680
682
  messagesMaxHeight: 350,
681
683
  borderRadius: 24,
682
684
  padding: 20
@@ -739,7 +741,10 @@ var DEFAULT_COPILOT_STYLES = {
739
741
  typography: {
740
742
  fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
741
743
  fontSize: 14,
742
- headerFontSize: 16
744
+ headerFontSize: 16,
745
+ fontWeight: 400,
746
+ lineHeight: 1.5,
747
+ letterSpacing: 0
743
748
  },
744
749
  // ═══════════════════════════════════════════════════════════
745
750
  // ANIMATIONS
@@ -859,6 +864,9 @@ function stylesToCSSVariables(styles2) {
859
864
  "--crow-font-family": styles2.typography.fontFamily,
860
865
  "--crow-font-size": `${styles2.typography.fontSize}px`,
861
866
  "--crow-header-font-size": `${styles2.typography.headerFontSize}px`,
867
+ "--crow-font-weight": `${styles2.typography.fontWeight}`,
868
+ "--crow-line-height": `${styles2.typography.lineHeight}`,
869
+ "--crow-letter-spacing": `${styles2.typography.letterSpacing}px`,
862
870
  // Animations
863
871
  "--crow-animation-duration": `${styles2.animations.duration}s`,
864
872
  "--crow-animation-easing": styles2.animations.easing
@@ -1094,9 +1102,27 @@ var GlassCard = forwardRef(
1094
1102
  }
1095
1103
  );
1096
1104
  GlassCard.displayName = "GlassCard";
1105
+ var GOOGLE_FONTS_MAP = {
1106
+ '"Inter", sans-serif': "Inter:wght@300;400;500;600;700",
1107
+ '"Roboto", sans-serif': "Roboto:wght@300;400;500;700",
1108
+ '"Open Sans", sans-serif': "Open+Sans:wght@300;400;500;600;700",
1109
+ '"Poppins", sans-serif': "Poppins:wght@300;400;500;600;700",
1110
+ '"Montserrat", sans-serif': "Montserrat:wght@300;400;500;600;700"
1111
+ };
1097
1112
  var WidgetShell = forwardRef(
1098
1113
  ({ children, className }, ref) => {
1099
1114
  const { styles: styles2, variant } = useWidgetStyleContext();
1115
+ useEffect(() => {
1116
+ const fontParam = GOOGLE_FONTS_MAP[styles2.typography.fontFamily];
1117
+ if (!fontParam) return;
1118
+ const linkId = `crow-google-font-${fontParam.split(":")[0]}`;
1119
+ if (document.getElementById(linkId)) return;
1120
+ const link = document.createElement("link");
1121
+ link.id = linkId;
1122
+ link.rel = "stylesheet";
1123
+ link.href = `https://fonts.googleapis.com/css2?family=${fontParam}&display=swap`;
1124
+ document.head.appendChild(link);
1125
+ }, [styles2.typography.fontFamily]);
1100
1126
  const baseStyle = {
1101
1127
  borderRadius: styles2.dimensions.borderRadius,
1102
1128
  padding: styles2.dimensions.padding,
@@ -1105,18 +1131,21 @@ var WidgetShell = forwardRef(
1105
1131
  color: styles2.colors.text,
1106
1132
  boxShadow: styles2.shadows.widget,
1107
1133
  fontFamily: styles2.typography.fontFamily,
1108
- fontSize: styles2.typography.fontSize
1134
+ fontSize: styles2.typography.fontSize,
1135
+ fontWeight: styles2.typography.fontWeight,
1136
+ lineHeight: styles2.typography.lineHeight,
1137
+ letterSpacing: styles2.typography.letterSpacing
1109
1138
  };
1110
1139
  if (variant === "embedded") {
1111
1140
  return /* @__PURE__ */ jsx(
1112
1141
  GlassCard,
1113
1142
  {
1114
1143
  ref,
1115
- className: `crow-flex crow-flex-col crow-shadow-2xl crow-gap-3 crow-w-full crow-h-full ${className ?? ""}`,
1144
+ className: `crow-flex crow-flex-col crow-shadow-2xl crow-gap-3 ${className ?? ""}`,
1116
1145
  style: {
1117
1146
  ...baseStyle,
1118
- maxWidth: styles2.dimensions.width,
1119
- maxHeight: styles2.dimensions.previewHeight
1147
+ width: `min(${styles2.dimensions.width}px, calc(100vw - 32px))`,
1148
+ height: `min(${styles2.dimensions.maxHeight}px, calc(100vh - 120px))`
1120
1149
  },
1121
1150
  children
1122
1151
  }
@@ -1499,7 +1528,7 @@ function MessageBubble({
1499
1528
  border: `1px solid ${styles2.colors.userBorder}`
1500
1529
  },
1501
1530
  children: [
1502
- /* @__PURE__ */ jsx("div", { className: "crow-text-sm crow-whitespace-pre-wrap", children: message.isBot ? /* @__PURE__ */ jsx(
1531
+ /* @__PURE__ */ jsx("div", { className: "crow-whitespace-pre-wrap", children: message.isBot ? /* @__PURE__ */ jsx(
1503
1532
  StreamingText,
1504
1533
  {
1505
1534
  content: message.content,
@@ -2230,7 +2259,7 @@ function CrowWidget({
2230
2259
  onExit: handleExitWorkflow
2231
2260
  }
2232
2261
  ) }),
2233
- /* @__PURE__ */ jsx(AnimatePresence, { children: (chat.messages.length > 0 || conversations.isLoadingHistory) && /* @__PURE__ */ jsx(MessagesContainer, { ref: messagesContainerRef, children: /* @__PURE__ */ jsx(
2262
+ /* @__PURE__ */ jsx(AnimatePresence, { children: (chat.messages.length > 0 || conversations.isLoadingHistory) && /* @__PURE__ */ jsx(MessagesContainer, { ref: messagesContainerRef, maxHeight: styles2.dimensions.messagesMaxHeight, children: /* @__PURE__ */ jsx(
2234
2263
  MessageList,
2235
2264
  {
2236
2265
  messages: chat.messages,
@@ -2280,7 +2309,7 @@ function CrowWidget({
2280
2309
  onExit: handleExitWorkflow
2281
2310
  }
2282
2311
  ) }),
2283
- /* @__PURE__ */ jsx(AnimatePresence, { children: (chat.messages.length > 0 || conversations.isLoadingHistory) && /* @__PURE__ */ jsx(MessagesContainer, { ref: messagesContainerRef, children: /* @__PURE__ */ jsx(
2312
+ /* @__PURE__ */ jsx(AnimatePresence, { children: (chat.messages.length > 0 || conversations.isLoadingHistory) && /* @__PURE__ */ jsx(MessagesContainer, { ref: messagesContainerRef, maxHeight: styles2.dimensions.messagesMaxHeight, children: /* @__PURE__ */ jsx(
2284
2313
  MessageList,
2285
2314
  {
2286
2315
  messages: chat.messages,
@@ -2420,6 +2449,9 @@ function CrowCopilot({
2420
2449
  width: widthStyle,
2421
2450
  fontFamily: styles2.typography.fontFamily,
2422
2451
  fontSize: styles2.typography.fontSize,
2452
+ fontWeight: styles2.typography.fontWeight,
2453
+ lineHeight: styles2.typography.lineHeight,
2454
+ letterSpacing: styles2.typography.letterSpacing,
2423
2455
  background: styles2.colors.background,
2424
2456
  borderColor: styles2.colors.border
2425
2457
  },