@baishuyun/ai-design 2.0.52 → 2.0.54

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @baishuyun/ai-design
2
2
 
3
+ ## 2.0.54
4
+
5
+ ### Patch Changes
6
+
7
+ - bugfix
8
+ - Updated dependencies
9
+ - @baishuyun/ai-feat-utils@2.0.49
10
+ - @baishuyun/types@3.0.45
11
+
12
+ ## 2.0.53
13
+
14
+ ### Patch Changes
15
+
16
+ - fix mobile style
17
+ - Updated dependencies
18
+ - @baishuyun/ai-feat-utils@2.0.48
19
+ - @baishuyun/types@3.0.44
20
+
3
21
  ## 2.0.52
4
22
 
5
23
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baishuyun/ai-design",
3
- "version": "2.0.52",
3
+ "version": "2.0.54",
4
4
  "description": "AI 功能 UI 组件库 - 所有 AI 功能的 UI 表现唯一真相来源",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -60,8 +60,8 @@
60
60
  "tw-animate-css": "^1.4.0",
61
61
  "vaul": "^1.1.2",
62
62
  "zod": "^4.1.13",
63
- "@baishuyun/ai-feat-utils": "2.0.47",
64
- "@baishuyun/types": "3.0.43"
63
+ "@baishuyun/ai-feat-utils": "2.0.49",
64
+ "@baishuyun/types": "3.0.45"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "react": "^19.0.0",
@@ -84,7 +84,7 @@
84
84
  "vite": "^5.1.4",
85
85
  "vite-plugin-dts": "^4.5.4",
86
86
  "@baishuyun/tailwind-config": "3.0.9",
87
- "@baishuyun/types": "3.0.43",
87
+ "@baishuyun/types": "3.0.45",
88
88
  "@baishuyun/typescript-config": "2.0.9"
89
89
  },
90
90
  "keywords": [],
@@ -93,6 +93,7 @@
93
93
  "scripts": {
94
94
  "build": "vite build && tailwindcss -i src/style.css -o dist/tailwind.css && node scripts/post-build.cjs",
95
95
  "dev": "vite build --watch",
96
+ "dev:build": "vite build --emptyOutDir false",
96
97
  "storybook": "storybook dev -p 6007",
97
98
  "build-storybook": "storybook build"
98
99
  }
@@ -1,3 +1,5 @@
1
+ import { useId } from 'react';
2
+
1
3
  // import { FontIcon } from './font-icon';
2
4
 
3
5
  export const DockIcon = () => (
@@ -345,6 +347,33 @@ export const MagicIcon = () => (
345
347
  </svg>
346
348
  );
347
349
 
350
+ export const LightMagicIcon = () => {
351
+ const gradientId = useId();
352
+
353
+ return (
354
+ <svg
355
+ xmlns="http://www.w3.org/2000/svg"
356
+ width="20"
357
+ height="20"
358
+ viewBox="0 0 20 20"
359
+ fill={`url(#${gradientId})`}
360
+ aria-hidden="true"
361
+ >
362
+ <path d="M3.84977 8.21777L2.78422 8.53223L1.71875 8.21777L2.03313 9.29512L1.71875 10.3725L2.7843 10.0546L3.84977 10.3725L3.53875 9.29512L3.84977 8.21777Z" />
363
+ <path d="M10.7931 4.81571L10.3248 4.41969L9.71924 4.3418L10.1109 3.86837L10.188 3.25602L10.6562 3.65212L11.2618 3.72993L10.8701 4.20337L10.7931 4.81571Z" />
364
+ <path d="M7.54602 5.06195L6.54219 4.21313L5.24414 4.04617L6.08375 3.03125L6.24891 1.71875L7.25266 2.56766L8.55063 2.73461L7.71117 3.74945L7.54602 5.06195Z" />
365
+ <path d="M15.6525 14.4317C15.5819 14.3576 15.4972 14.2983 15.4035 14.2573C15.3097 14.2162 15.2087 14.1942 15.1064 14.1926C15.0041 14.191 14.9024 14.2097 14.8074 14.2477C14.7124 14.2857 14.6259 14.3423 14.5529 14.4141C14.2445 14.7162 14.2367 15.2139 14.5355 15.5258L16.946 18.0416C17.0166 18.1157 17.1012 18.175 17.195 18.2161C17.2887 18.2571 17.3897 18.2791 17.4921 18.2807C17.5944 18.2824 17.696 18.2637 17.791 18.2256C17.8861 18.1876 17.9726 18.1311 18.0455 18.0593C18.354 17.7572 18.3618 17.2594 18.063 16.9476L15.6525 14.4317Z" />
366
+ <path d="M12.6321 4.68029C13.3036 4.3106 14.1329 4.73779 14.232 5.50435L14.5525 7.98349C14.6017 8.36714 14.7806 8.72257 15.0596 8.99044L16.8545 10.7087C17.4097 11.2403 17.2642 12.1698 16.5737 12.5019L14.3408 13.5761C13.9937 13.7439 13.7147 14.0262 13.5511 14.3753L12.4883 16.6329C12.1598 17.3308 11.2408 17.478 10.7151 16.9168L9.01464 15.1018C8.75218 14.821 8.40056 14.6398 8.01956 14.589L5.56769 14.2649C4.80956 14.1647 4.38706 13.3262 4.75261 12.6472L5.93456 10.4518C6.11827 10.1104 6.18011 9.71661 6.10988 9.33537L5.6566 6.8781C5.51636 6.11794 6.17457 5.45248 6.92636 5.59427L9.35636 6.05248C9.73363 6.12349 10.1238 6.06091 10.4607 5.87521L12.6321 4.68029Z" />
367
+ <defs>
368
+ <linearGradient id={gradientId} x1="0" y1="0" x2="0" y2="1">
369
+ <stop stopColor="white" />
370
+ <stop offset="1" stopColor="#A6FFFF" />
371
+ </linearGradient>
372
+ </defs>
373
+ </svg>
374
+ );
375
+ };
376
+
348
377
  export const ChevronIcon = ({ isOpen }: { isOpen?: boolean }) => (
349
378
  <svg
350
379
  xmlns="http://www.w3.org/2000/svg"
@@ -954,11 +983,11 @@ export const SearchIcon = ({ className }: { className?: string }) => (
954
983
  </svg>
955
984
  );
956
985
 
957
- export const EditIcon = () => (
986
+ export const EditIcon = ({ size = 16}: { size?: number }) => (
958
987
  <svg
959
988
  xmlns="http://www.w3.org/2000/svg"
960
- width="16"
961
- height="16"
989
+ width={size}
990
+ height={size}
962
991
  viewBox="0 0 16 16"
963
992
  fill="currentColor"
964
993
  >
@@ -1340,11 +1369,11 @@ export const FormulasIcon = () => (
1340
1369
  </svg>
1341
1370
  );
1342
1371
 
1343
- export const ScrollArrowDownIcon = () => (
1372
+ export const ScrollArrowDownIcon = ({ size = 24 }: { size?: number }) => (
1344
1373
  <svg
1345
1374
  xmlns="http://www.w3.org/2000/svg"
1346
- width="24"
1347
- height="24"
1375
+ width={size}
1376
+ height={size}
1348
1377
  viewBox="0 0 24 24"
1349
1378
  fill="currentColor"
1350
1379
  >
@@ -31,6 +31,7 @@ export const CollapsibleTxtMsg = ({
31
31
  }: CollapsibleTxtMsgProps) => {
32
32
  const [isOpen, setIsOpen] = useState(defaultOpen);
33
33
  const sizeCls = isMobile ? 'text-[16px]' : 'text-[14px]';
34
+ const iconSizeCls = 'w-[16px] h-[16px]';
34
35
 
35
36
  const cls = classNames({
36
37
  'bg-[#fafafa] border border-[#e0e0e0] border-solid p-2.5': !ghost
@@ -53,7 +54,7 @@ export const CollapsibleTxtMsg = ({
53
54
  }}
54
55
  >
55
56
  <div className="flex gap-2.5 items-center">
56
- <div className="w-4 h-4 shrink-0 flex items-center">{icon || <AnalysisIcon />}</div>
57
+ <div className={classNames("shrink-0 flex items-center", iconSizeCls)}>{icon || <AnalysisIcon />}</div>
57
58
  <p className={`text-[#666] ${sizeCls} leading-normal`}>{t}</p>
58
59
  </div>
59
60
  <button
@@ -6,7 +6,7 @@ export const FakeBotMessage = ({
6
6
  children,
7
7
  className,
8
8
  avatarJsx,
9
- isMobile
9
+ isMobile,
10
10
  }: {
11
11
  children: ReactNode;
12
12
  offset?: boolean;
@@ -22,6 +22,7 @@ export const FakeBotMessage = ({
22
22
  isMobile={isMobile}
23
23
  className={cn(
24
24
  'wrap-break-words rounded-2 bg-transparent px-0 py-0 text-left w-full',
25
+ isMobile && 'gap-[10px]',
25
26
  className
26
27
  )}
27
28
  data-testid="message-content"
@@ -32,19 +33,26 @@ export const FakeBotMessage = ({
32
33
  );
33
34
  }
34
35
 
35
-
36
36
  return (
37
37
  <div
38
- className={cn('group/message w-full')}
38
+ className={cn('group/message w-full', className)}
39
39
  data-role="assistant"
40
40
  data-testid={`message-assistant`}
41
41
  >
42
- <div className="flex w-full flex-col items-start justify-start gap-2.5">
42
+ <div
43
+ className={cn(
44
+ 'flex w-full flex-col items-start justify-start',
45
+ isMobile ? 'gap-[10px]' : 'gap-2.5'
46
+ )}
47
+ >
43
48
  {avatarJsx}
44
49
  <div className="flex flex-col min-w-0 grow gap-2.5 w-full">
45
50
  <MessageContent
46
51
  isMobile={isMobile}
47
- className="w-full wrap-break-words rounded-2 bg-transparent px-0 py-0 text-left"
52
+ className={cn(
53
+ 'w-full wrap-break-words rounded-2 bg-transparent px-0 py-0 text-left',
54
+ isMobile && 'gap-[10px]'
55
+ )}
48
56
  data-testid="message-content"
49
57
  >
50
58
  {children}
@@ -26,8 +26,9 @@ export const FieldCheckerListMsg = memo(
26
26
  children?: ReactNode;
27
27
  streaming: boolean;
28
28
  confirmed?: boolean;
29
+ isMobile?: boolean;
29
30
  }
30
- >(({ fields, children, streaming, confirmed }, ref) => {
31
+ >(({ fields, children, streaming, confirmed, isMobile }, ref) => {
31
32
  // Track individual field checked states (all default to true)
32
33
  const [checkedMap, setCheckedMap] = useState<Record<string, boolean>>(() => {
33
34
  const map: Record<string, boolean> = {};
@@ -72,7 +73,7 @@ export const FieldCheckerListMsg = memo(
72
73
  );
73
74
 
74
75
  return (
75
- <CollapsibleTxtMsg title="字段生成" icon={<LetterAIcon />} defaultOpen>
76
+ <CollapsibleTxtMsg title="字段生成" icon={<LetterAIcon />} defaultOpen isMobile={isMobile}>
76
77
  {
77
78
  <div
78
79
  className={cn(
@@ -66,6 +66,7 @@ export interface FormInfoEditorProps {
66
66
  onMount?: () => void;
67
67
  readonly?: boolean;
68
68
  iconRenderer?: (icon: FormIconOption & { size: number}) => React.ReactNode; // Optional custom renderer for icons
69
+ mobile?: boolean;
69
70
  }
70
71
 
71
72
  /**
@@ -85,6 +86,7 @@ export const FormInfoEditor = memo(
85
86
  expanded: controlledExpanded,
86
87
  onExpandedChange,
87
88
  iconRenderer,
89
+ mobile,
88
90
  className,
89
91
  }: FormInfoEditorProps) => {
90
92
  const [internalExpanded, setInternalExpanded] = useState(false);
@@ -103,6 +105,16 @@ export const FormInfoEditor = memo(
103
105
  onMount?.();
104
106
  }, []);
105
107
 
108
+ const fontCls = cn({
109
+ 'text-[16px]': mobile,
110
+ 'text-[14px]': !mobile,
111
+ });
112
+
113
+ const sizeCls = cn({
114
+ 'w-[16px] h-[16px]': !mobile,
115
+ 'w-[20px] h-[20px]': !mobile
116
+ })
117
+
106
118
  // Default Status (Collapsed)
107
119
  if (!expanded || readonly) {
108
120
  return (
@@ -121,7 +133,7 @@ export const FormInfoEditor = memo(
121
133
  {/* Left side: Form icon and name */}
122
134
  <div className="flex items-center gap-[10px] min-w-0 flex-1 mr-[10px]">
123
135
  <FormIcon size={36} code={iconOpt?.code} render={iconRenderer} value={iconOpt?.value} />
124
- <p className="text-[14px] text-black leading-normal truncate">{nameVal}</p>
136
+ <p className={cn("text-black leading-normal truncate", fontCls)}>{nameVal}</p>
125
137
  </div>
126
138
 
127
139
  <button
@@ -130,19 +142,21 @@ export const FormInfoEditor = memo(
130
142
  setExpanded(true);
131
143
  }}
132
144
  className={cn(
133
- 'w-[16px] h-[16px] flex items-center justify-center cursor-pointer hover:text-[#0265ff]',
145
+ 'flex items-center justify-center cursor-pointer hover:text-[#0265ff]',
134
146
  transCls,
147
+ sizeCls,
135
148
  {
136
149
  'pointer-events-none opacity-0': readonly,
137
150
  }
138
151
  )}
139
152
  >
140
- <EditIcon />
153
+ <EditIcon size={mobile ? 20 : 16} />
141
154
  </button>
142
155
  </div>
143
156
  );
144
157
  }
145
158
 
159
+
146
160
  // Expanded Status (Edit mode)
147
161
  return (
148
162
  <div
@@ -155,7 +169,7 @@ export const FormInfoEditor = memo(
155
169
  >
156
170
  {/* Name field */}
157
171
  <div className="flex flex-col gap-[10px] w-full">
158
- <p className="text-[14px] text-[#030303] font-bold leading-normal">名称</p>
172
+ <p className={cn("text-[#030303] font-bold leading-normal", fontCls)}>名称</p>
159
173
  <input
160
174
  type="text"
161
175
  value={nameVal}
@@ -167,9 +181,10 @@ export const FormInfoEditor = memo(
167
181
  }}
168
182
  className={cn(
169
183
  'bg-white border border-[#e0e0e0] rounded-[4px] h-[34px] px-[10px] py-[7px] w-full',
170
- 'text-[14px] text-[#030303] leading-normal outline-none',
184
+ 'text-[#030303] leading-normal outline-none',
171
185
  'focus:border-[#0265ff]',
172
186
  'hover:border-[#0265ff]',
187
+ fontCls,
173
188
  transCls
174
189
  )}
175
190
  />
@@ -177,7 +192,7 @@ export const FormInfoEditor = memo(
177
192
 
178
193
  {/* Icon field */}
179
194
  <div className="flex flex-col gap-[10px] w-full">
180
- <p className="text-[14px] text-[#030303] font-bold leading-normal">图标</p>
195
+ <p className={cn("text-[#030303] font-bold leading-normal", fontCls)}>图标</p>
181
196
  <div className="relative" style={{ zIndex: 10 }}>
182
197
  <button
183
198
  onClick={() => setIsDropdownOpen(!isDropdownOpen)}
@@ -5,9 +5,10 @@ import { ScrollArrowDownIcon } from './bs-icons';
5
5
  export interface ScrollToBottomProps {
6
6
  onClick?: () => void;
7
7
  className?: string;
8
+ isMobile?: boolean;
8
9
  }
9
10
 
10
- export const ScrollToBottomBtn = ({ onClick, className }: ScrollToBottomProps) => {
11
+ export const ScrollToBottomBtn = ({ onClick, className, isMobile }: ScrollToBottomProps) => {
11
12
  return (
12
13
  <button
13
14
  type="button"
@@ -22,7 +23,7 @@ export const ScrollToBottomBtn = ({ onClick, className }: ScrollToBottomProps) =
22
23
  className
23
24
  )}
24
25
  >
25
- <ScrollArrowDownIcon />
26
+ <ScrollArrowDownIcon size={isMobile ? 20 : 24 } />
26
27
  </button>
27
28
  );
28
29
  };
@@ -11,11 +11,12 @@ export interface UserTextMsgBubbleProps {
11
11
  export const UserTextMsgBubble = ({ text, children, isMobile }: UserTextMsgBubbleProps) => {
12
12
  const content = (text || children) as string;
13
13
  const sizeCls = isMobile ? 'text-[16px]' : 'text-[14px]';
14
+ const paddingCls = isMobile ? "px-[10px] py-[9px]" : "px-2.5 py-[8px]";
14
15
 
15
16
  if (typeof content !== 'string') {
16
17
  return (
17
18
  <div
18
- className={`px-2.5 py-[8px] text-[#0265FF] ${sizeCls} w-fit`}
19
+ className={`${paddingCls} text-[#0265FF] ${sizeCls} w-fit`}
19
20
  style={{
20
21
  borderRadius: `10px 0 10px 10px`,
21
22
  wordWrap: 'break-word',
@@ -31,7 +32,7 @@ export const UserTextMsgBubble = ({ text, children, isMobile }: UserTextMsgBubbl
31
32
  const summary = `${content?.slice(0, 10)}...`;
32
33
  return (
33
34
  <div
34
- className={`px-2.5 py-[8px] text-[#0265FF] ${sizeCls} w-fit`}
35
+ className={`${paddingCls} text-[#0265FF] ${sizeCls} w-fit`}
35
36
  style={{
36
37
  borderRadius: `10px 0 10px 10px`,
37
38
  wordWrap: 'break-word',
@@ -11,7 +11,7 @@ export const WarningMessage = ({
11
11
  className,
12
12
  }: WarningMessageProps) => {
13
13
  return (
14
- <div className={cn('flex flex-col items-center gap-[10px]', className)}>
14
+ <div className={cn('flex flex-col items-center gap-[10px] m-t-[40px]', className)}>
15
15
  <div className="relative" style={{ width: 120, height: 77 }}>
16
16
  <div
17
17
  className="bg-no-repeat"
package/style.css CHANGED
@@ -849,9 +849,6 @@
849
849
  .w-5 {
850
850
  width: calc(3.5px * 5);
851
851
  }
852
- .w-9 {
853
- width: calc(3.5px * 9);
854
- }
855
852
  .w-10 {
856
853
  width: calc(3.5px * 10);
857
854
  }
@@ -1844,6 +1841,9 @@
1844
1841
  .py-\[8px\] {
1845
1842
  padding-block: 8px;
1846
1843
  }
1844
+ .py-\[9px\] {
1845
+ padding-block: 9px;
1846
+ }
1847
1847
  .py-\[10px\] {
1848
1848
  padding-block: 10px;
1849
1849
  }