@agentscope-ai/design 1.0.15 → 1.0.16

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.
Files changed (59) hide show
  1. package/llms/all.llms.txt +4954 -0
  2. package/llms/components/commonComponents/Alert/index.zh-CN.llms.txt +32 -0
  3. package/llms/components/commonComponents/AlertDialog/index.zh-CN.llms.txt +171 -0
  4. package/llms/components/commonComponents/Anchor/index.zh-CN.llms.txt +51 -0
  5. package/llms/components/commonComponents/Avatar/index.zh-CN.llms.txt +37 -0
  6. package/llms/components/commonComponents/Breadcrumb/index.zh-CN.llms.txt +117 -0
  7. package/llms/components/commonComponents/Button/index.zh-CN.llms.txt +54 -0
  8. package/llms/components/commonComponents/Card/index.zh-CN.llms.txt +61 -0
  9. package/llms/components/commonComponents/Checkbox/index.zh-CN.llms.txt +69 -0
  10. package/llms/components/commonComponents/CodeBlock/index.zh-CN.llms.txt +13 -0
  11. package/llms/components/commonComponents/Collapse/index.zh-CN.llms.txt +56 -0
  12. package/llms/components/commonComponents/CollapsePanel/index.zh-CN.llms.txt +69 -0
  13. package/llms/components/commonComponents/DatePicker/index.zh-CN.llms.txt +221 -0
  14. package/llms/components/commonComponents/Descriptions/index.zh-CN.llms.txt +37 -0
  15. package/llms/components/commonComponents/Drawer/index.zh-CN.llms.txt +62 -0
  16. package/llms/components/commonComponents/Dropdown/index.zh-CN.llms.txt +149 -0
  17. package/llms/components/commonComponents/Empty/index.zh-CN.llms.txt +40 -0
  18. package/llms/components/commonComponents/FloatButton/index.zh-CN.llms.txt +51 -0
  19. package/llms/components/commonComponents/Form/index.zh-CN.llms.txt +558 -0
  20. package/llms/components/commonComponents/IconButton/index.zh-CN.llms.txt +45 -0
  21. package/llms/components/commonComponents/Image/index.zh-CN.llms.txt +165 -0
  22. package/llms/components/commonComponents/Input/index.zh-CN.llms.txt +133 -0
  23. package/llms/components/commonComponents/InputNumber/index.zh-CN.llms.txt +51 -0
  24. package/llms/components/commonComponents/Message/index.zh-CN.llms.txt +98 -0
  25. package/llms/components/commonComponents/Modal/index.zh-CN.llms.txt +168 -0
  26. package/llms/components/commonComponents/Notification/index.zh-CN.llms.txt +94 -0
  27. package/llms/components/commonComponents/Pagination/index.zh-CN.llms.txt +45 -0
  28. package/llms/components/commonComponents/Popconfirm/index.zh-CN.llms.txt +55 -0
  29. package/llms/components/commonComponents/Popover/index.zh-CN.llms.txt +43 -0
  30. package/llms/components/commonComponents/Progress/index.zh-CN.llms.txt +50 -0
  31. package/llms/components/commonComponents/PromptsEditor/index.zh-CN.llms.txt +15 -0
  32. package/llms/components/commonComponents/Radio/index.zh-CN.llms.txt +66 -0
  33. package/llms/components/commonComponents/RadioButton/index.zh-CN.llms.txt +73 -0
  34. package/llms/components/commonComponents/Result/index.zh-CN.llms.txt +10 -0
  35. package/llms/components/commonComponents/Select/index.zh-CN.llms.txt +96 -0
  36. package/llms/components/commonComponents/Skeleton/index.zh-CN.llms.txt +59 -0
  37. package/llms/components/commonComponents/Slider/index.zh-CN.llms.txt +62 -0
  38. package/llms/components/commonComponents/Spinner/index.zh-CN.llms.txt +15 -0
  39. package/llms/components/commonComponents/Statistic/index.zh-CN.llms.txt +58 -0
  40. package/llms/components/commonComponents/Steps/index.zh-CN.llms.txt +57 -0
  41. package/llms/components/commonComponents/Switch/index.zh-CN.llms.txt +39 -0
  42. package/llms/components/commonComponents/Table/index.zh-CN.llms.txt +254 -0
  43. package/llms/components/commonComponents/Tabs/index.zh-CN.llms.txt +68 -0
  44. package/llms/components/commonComponents/Tag/index.zh-CN.llms.txt +33 -0
  45. package/llms/components/commonComponents/TimePicker/index.zh-CN.llms.txt +111 -0
  46. package/llms/components/commonComponents/Tooltip/index.zh-CN.llms.txt +44 -0
  47. package/llms/components/commonComponents/Upload/index.zh-CN.llms.txt +95 -0
  48. package/llms/components/commonComponents/Video/index.zh-CN.llms.txt +7 -0
  49. package/llms/docs/guide/fromAntd.zh-CN.llms.txt +156 -0
  50. package/llms/docs/guide/fromScratch.zh-CN.llms.txt +83 -0
  51. package/llms/docs/guide/iconfont.zh-CN.llms.txt +69 -0
  52. package/llms/docs/guide/overview.zh-CN.llms.txt +51 -0
  53. package/llms/docs/guide/sparkIcons.zh-CN.llms.txt +25 -0
  54. package/llms/docs/guide/theme.zh-CN.llms.txt +61 -0
  55. package/llms/docs/guide/tokens&variables.zh-CN.llms.txt +425 -0
  56. package/llms/docs/guide/vibe-coding.zh-CN.llms.txt +29 -0
  57. package/llms/index.llms.txt +49 -0
  58. package/package.json +4 -2
  59. package/scripts/mcp-docs-server.js +14079 -0
@@ -0,0 +1,111 @@
1
+
2
+
3
+ <DemoTitle title="TimePicker" desc="输入或选择时间的控件。">
4
+ #### API
5
+
6
+ <AntdApiRef url="https://ant.design/components/time-picker-cn/#api"></AntdApiRef>
7
+
8
+
9
+ ## antd API
10
+
11
+
12
+
13
+ 通用属性参考:[通用属性](/docs/react/common-props)
14
+
15
+
16
+ ```jsx
17
+ import dayjs from 'dayjs';
18
+ import customParseFormat from 'dayjs/plugin/customParseFormat'
19
+
20
+ dayjs.extend(customParseFormat)
21
+ <TimePicker defaultValue={dayjs('13:30:56', 'HH:mm:ss')} />;
22
+ ```
23
+
24
+
25
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
26
+ |--------|--------|--------|--------|--------|
27
+ | allowClear | 自定义清除按钮 | boolean \| { clearIcon?: ReactNode } | true | 5.8.0: 支持对象类型 |
28
+ | autoFocus | 自动获取焦点 | boolean | false | |
29
+ | cellRender | 自定义单元格的内容 | (current: number, info: { originNode: React.ReactNode, today: dayjs, range?: 'start' \| 'end', subType: 'hour' \| 'minute' \| 'second' \| 'meridiem' }) => React.ReactNode | - | 5.4.0 |
30
+ | changeOnScroll | 在滚动时改变选择值 | boolean | false | 5.14.0 |
31
+ | className | 选择器类名 | string | - | |
32
+ | defaultValue | 默认时间 | | - | |
33
+ | disabled | 禁用全部操作 | boolean | false | |
34
+ | disabledTime | 不可选择的时间 | | - | 4.19.0 |
35
+ | format | 展示的时间格式 | string | HH:mm:ss | |
36
+ | getPopupContainer | 定义浮层的容器,默认为 body 上新建 div | function(trigger) | - | |
37
+ | hideDisabledOptions | 隐藏禁止选择的选项 | boolean | false | |
38
+ | hourStep | 小时选项间隔 | number | 1 | |
39
+ | inputReadOnly | 设置输入框为只读(避免在移动设备上打开虚拟键盘) | boolean | false | |
40
+ | minuteStep | 分钟选项间隔 | number | 1 | |
41
+ | needConfirm | 是否需要确认按钮,为 | boolean | - | 5.14.0 |
42
+ | open | 面板是否打开 | boolean | false | |
43
+ | placeholder | 没有值的时候显示的内容 | string \| [string, string] | 请选择时间 | |
44
+ | placement | 选择框弹出的位置 | bottomLeft | bottomLeft | |
45
+ | popupClassName | 弹出层类名 | string | - | |
46
+ | popupStyle | 弹出层样式对象 | object | - | |
47
+ | prefix | 自定义前缀 | ReactNode | - | 5.22.0 |
48
+ | renderExtraFooter | 选择框底部显示自定义的内容 | () => ReactNode | - | |
49
+ | secondStep | 秒选项间隔 | number | 1 | |
50
+ | showNow | 面板是否显示“此刻”按钮 | boolean | - | 4.4.0 |
51
+ | size | 输入框大小, | large | - | |
52
+ | status | 设置校验状态 | 'error' \| 'warning' | - | 4.19.0 |
53
+ | suffixIcon | 自定义的选择框后缀图标 | ReactNode | - | |
54
+ | use12Hours | 使用 12 小时制,为 true 时 | boolean | false | |
55
+ | value | 当前时间 | | - | |
56
+ | variant | 形态变体 | outlined | outlined | 5.13.0 \| |
57
+ | onCalendarChange | 待选日期发生变化的回调。 | function(dates: [dayjs, dayjs], dateStrings: [string, string], info: { range: | - | |
58
+ | onChange | 时间发生变化的回调 | function(time: dayjs, timeString: string): void | - | |
59
+ | onOpenChange | 面板打开/关闭时的回调 | (open: boolean) => void | - | |
60
+
61
+
62
+ #### DisabledTime
63
+
64
+
65
+ ```typescript
66
+ type DisabledTime = (now: Dayjs) => {
67
+ disabledHours?: () => number[];
68
+ disabledMinutes?: (selectedHour: number) => number[];
69
+ disabledSeconds?: (selectedHour: number, selectedMinute: number) => number[];
70
+ disabledMilliseconds?: (
71
+ selectedHour: number,
72
+ selectedMinute: number,
73
+ selectedSecond: number,
74
+ ) => number[];
75
+ };
76
+ ```
77
+
78
+
79
+ 注意:`disabledMilliseconds` 为 `5.14.0` 新增。
80
+
81
+ ## 方法
82
+
83
+ | 名称 | 描述 | 版本 |
84
+ |--------|--------|--------|
85
+ | blur() | 移除焦点 | |
86
+ | focus() | 获取焦点 | |
87
+
88
+
89
+ ## RangePicker
90
+
91
+ 属性与 DatePicker 的 [RangePicker](/components/date-picker-cn#rangepicker) 相同。还包含以下属性:
92
+
93
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
94
+ |--------|--------|--------|--------|--------|
95
+ | disabledTime | 不可选择的时间 | | - | 4.19.0 |
96
+ | order | 始末时间是否自动排序 | boolean | true | 4.1.0 |
97
+
98
+
99
+ ### RangeDisabledTime
100
+
101
+
102
+ ```typescript
103
+ type RangeDisabledTime = (
104
+ now: Dayjs,
105
+ type = 'start' | 'end',
106
+ ) => {
107
+ disabledHours?: () => number[];
108
+ disabledMinutes?: (selectedHour: number) => number[];
109
+ disabledSeconds?: (selectedHour: number, selectedMinute: number) => number[];
110
+ };
111
+ ```
@@ -0,0 +1,44 @@
1
+
2
+
3
+ <DemoTitle title="Tooltip" desc="简单的文本提示气泡框">
4
+ #### API
5
+
6
+ | 属性名 | 描述 | 类型 | 默认值 |
7
+ |--------|--------|--------|--------|
8
+ | mode | 颜色模式 | 'dark' \| 'light' | 'light' |
9
+
10
+
11
+ <AntdApiRef url="https://ant.design/components/tooltip-cn/#api"></AntdApiRef>
12
+
13
+
14
+ ## antd API
15
+
16
+ 通用属性参考:[通用属性](/docs/react/common-props)
17
+
18
+ | 参数 | 说明 | 类型 | 默认值 |
19
+ |--------|--------|--------|--------|
20
+ | title | 提示文字 | ReactNode \| () => ReactNode | - |
21
+
22
+
23
+ ### 共同的 API
24
+
25
+ 以下 API 为 Tooltip、Popconfirm、Popover 共享的 API。
26
+
27
+ <!-- prettier-ignore -->
28
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
29
+ |--------|--------|--------|--------|--------|
30
+ | align | 该值将合并到 placement 的配置中,设置参考 | object | - | |
31
+ | arrow | 修改箭头的显示状态以及修改箭头是否指向目标元素中心 | boolean \| { pointAtCenter: boolean } | true | 5.2.0 |
32
+ | autoAdjustOverflow | 气泡被遮挡时自动调整位置 | boolean | true | |
33
+ | color | 背景颜色 | string | - | 4.3.0 |
34
+ | defaultOpen | 默认是否显隐 | boolean | false | 4.23.0 |
35
+ | destroyOnHidden | 关闭后是否销毁 dom | boolean | false | 5.25.0 |
36
+ | fresh | 默认情况下,Tooltip 在关闭时会缓存内容。设置该属性后会始终保持更新 | boolean | false | 5.10.0 |
37
+ | getPopupContainer | 浮层渲染父节点,默认渲染到 body 上 | (triggerNode: HTMLElement) => HTMLElement | () => document.body | |
38
+ | mouseEnterDelay | 鼠标移入后延时多少才显示 Tooltip,单位:秒 | number | 0.1 | |
39
+ | mouseLeaveDelay | 鼠标移出后延时多少才隐藏 Tooltip,单位:秒 | number | 0.1 | |
40
+ | placement | 气泡框位置,可选 | string | top | |
41
+ | trigger | 触发行为,可选 | string \| string[] | hover | |
42
+ | open | 用于手动控制浮层显隐,小于 4.23.0 使用 | boolean | false | 4.23.0 |
43
+ | zIndex | 设置 Tooltip 的 | number | - | |
44
+ | onOpenChange | 显示隐藏的回调 | (open: boolean) => void | - | 4.23.0 |
@@ -0,0 +1,95 @@
1
+
2
+
3
+ <DemoTitle title="Upload" desc="文件选择上传和拖拽上传控件。">
4
+ #### API
5
+
6
+ <AntdApiRef url="https://ant.design/components/upload-cn/#api"></AntdApiRef>
7
+
8
+
9
+ ## antd API
10
+
11
+ 通用属性参考:[通用属性](/docs/react/common-props)
12
+
13
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
14
+ |--------|--------|--------|--------|--------|
15
+ | accept | 接受上传的文件类型,详见 | string | - | |
16
+ | action | 上传的地址 | string \| (file) => Promise | - | |
17
+ | beforeUpload | 上传文件之前的钩子,参数为上传的文件,若返回 | (file, fileList) => boolean \| Promise \| | - | |
18
+ | customRequest | 通过覆盖默认的上传行为,可以自定义自己的上传实现 | function | - | |
19
+ | data | 上传所需额外参数或返回上传额外参数的方法 | object\|(file) => object \| Promise | - | |
20
+ | defaultFileList | 默认已经上传的文件列表 | object[] | - | |
21
+ | directory | 支持上传文件夹( | boolean | false | |
22
+ | disabled | 是否禁用 | boolean | false | 对于自定义 Upload children 时请将 disabled 属性同时传给 child node 确保 disabled 渲染效果保持一致 |
23
+ | fileList | 已经上传的文件列表(受控),使用此参数时,如果遇到 | | - | |
24
+ | headers | 设置上传的请求头部,IE10 以上有效 | object | - | |
25
+ | iconRender | 自定义显示 icon | (file: UploadFile, listType?: UploadListType) => ReactNode | - | |
26
+ | isImageUrl | 自定义缩略图是否使用 标签进行显示 | (file: UploadFile) => boolean | | |
27
+ | itemRender | 自定义上传列表项 | (originNode: ReactElement, file: UploadFile, fileList: object[], actions: { download: function, preview: function, remove: function }) => React.ReactNode | - | 4.16.0 |
28
+ | listType | 上传列表的内建样式,支持四种基本样式 | string | text | picture-circle |
29
+ | maxCount | 限制上传数量。当为 1 时,始终用最新上传的文件代替当前文件 | number | - | 4.10.0 |
30
+ | method | 上传请求的 http method | string | post | |
31
+ | multiple | 是否支持多选文件, | boolean | false | |
32
+ | name | 发到后台的文件参数名 | string | file | |
33
+ | openFileDialogOnClick | 点击打开文件对话框 | boolean | true | |
34
+ | pastable | 是否支持粘贴文件 | boolean | false | 5.25.0 |
35
+ | previewFile | 自定义文件预览逻辑 | (file: File \| Blob) => Promise | - | |
36
+ | progress | 自定义进度条样式 | | { strokeWidth: 2, showInfo: false } | 4.3.0 |
37
+ | showUploadList | 是否展示文件列表, 可设为一个对象,用于单独设定 | boolean \| { extra?: ReactNode \| (file: UploadFile) => ReactNode, showPreviewIcon?: boolean \| (file: UploadFile) => boolean, showDownloadIcon?: boolean \| (file: UploadFile) => boolean, showRemoveIcon?: boolean \| (file: UploadFile) => boolean, previewIcon?: ReactNode \| (file: UploadFile) => ReactNode, removeIcon?: ReactNode \| (file: UploadFile) => ReactNode, downloadIcon?: ReactNode \| (file: UploadFile) => ReactNode } | true | extra |
38
+ | withCredentials | 上传请求时是否携带 cookie | boolean | false | |
39
+ | onChange | 上传文件改变时的回调,上传每个阶段都会触发该事件。详见 | function | - | |
40
+ | onDrop | 当文件被拖入上传区域时执行的回调功能 | (event: React.DragEvent) => void | - | 4.16.0 |
41
+ | onDownload | 点击下载文件时的回调,如果没有指定,则默认跳转到文件 url 对应的标签页 | function(file): void | (跳转新标签页) | |
42
+ | onPreview | 点击文件链接或预览图标时的回调 | function(file) | - | |
43
+ | onRemove   | 点击移除文件时的回调,返回值为 false 时不移除。支持返回一个 Promise 对象,Promise 对象 resolve(false) 或 reject 时不移除               | function(file): boolean \| Promise | -   | |
44
+
45
+
46
+ ### UploadFile
47
+
48
+ 继承自 File,附带额外属性用于渲染。
49
+
50
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
51
+ |--------|--------|--------|--------|--------|
52
+ | crossOrigin | CORS 属性设置 | 'anonymous' | - | 4.20.0 |
53
+ | name | 文件名 | string | - | - |
54
+ | percent | 上传进度 | number | - | - |
55
+ | status | 上传状态,不同状态展示颜色也会有所不同 | error | - | - |
56
+ | thumbUrl | 缩略图地址 | string | - | - |
57
+ | uid | 唯一标识符,不设置时会自动生成 | string | - | - |
58
+ | url | 下载地址 | string | - | - |
59
+
60
+
61
+ ### onChange
62
+
63
+ 💡 上传中、完成、失败都会调用这个函数。
64
+
65
+ 文件状态改变的回调,返回为:
66
+
67
+
68
+ ```jsx
69
+ {
70
+ file: { /* ... */ },
71
+ fileList: [ /* ... */ ],
72
+ event: { /* ... */ },
73
+ }
74
+ ```
75
+
76
+
77
+
78
+ 1. `file` 当前操作的文件对象。
79
+
80
+
81
+ ```jsx
82
+ {
83
+ uid: 'uid', // 文件唯一标识,建议设置为负数,防止和内部产生的 id 冲突
84
+ name: 'xx.png', // 文件名
85
+ status: 'done' | 'uploading' | 'error' | 'removed' , // beforeUpload 拦截的文件没有 status 状态属性
86
+ response: '{"status": "success"}', // 服务端响应内容
87
+ linkProps: '{"download": "image"}', // 下载链接额外的 HTML 属性
88
+ }
89
+ ```
90
+
91
+
92
+
93
+ 2. `fileList` 当前的文件列表。
94
+
95
+ 3. `event` 上传中的服务端响应内容,包含了上传进度等信息,高级浏览器支持。
@@ -0,0 +1,7 @@
1
+
2
+
3
+ <DemoTitle title="Video" desc="视频展示">
4
+ #### API
5
+
6
+ <AntdApiRef url="https://ant.design/components/upload-cn/#api"></AntdApiRef>
7
+
@@ -0,0 +1,156 @@
1
+
2
+
3
+ # 从 Antd 迁移
4
+
5
+ ## 📦 安装
6
+
7
+
8
+ ```bash
9
+ $ npm install @agentscope-ai/icons @agentscope-ai/design --save
10
+ ```
11
+
12
+
13
+ ## 🔨 使用
14
+
15
+ 从 @agentscope-ai/design 导出的所有同名组件在 API 方面都与 antd 的对应组件兼容,这意味着您无需学习如何使用它们。如果您想充分利用 Alibaba Cloud Spark Design 的新功能,可以尝试使用这些组件而不是 antd 的组件。
16
+
17
+
18
+ ```tsx
19
+ import {
20
+ Button,
21
+ Image,
22
+ ConfigProvider,
23
+ purpleDarkTheme,
24
+ purpleTheme,
25
+ } from '@agentscope-ai/design';
26
+ import { SparkSunLine, SparkMoonLine } from '@agentscope-ai/icons';
27
+ import { Flex } from 'antd';
28
+ import zhCN from 'antd/locale/zh_CN';
29
+ import { useState } from 'react';
30
+
31
+ const App = () => {
32
+ const [colorMode, setColorMode] = useState('light');
33
+ const theme = colorMode === 'light' ? purpleTheme : purpleDarkTheme;
34
+
35
+ const prefix = 'sps';
36
+ return (
37
+ <ConfigProvider
38
+ {...theme} // 您可以从 purpleTheme、purpleDarkTheme、carbonTheme 和 carbonDarkTheme 中选择
39
+ prefix={prefix} // Ant Design 和 @agentscope-ai/design 的前缀
40
+ prefixCls={prefix}
41
+ iconfont="//at.alicdn.com/t/a/font_4807885_ugexdeaoq7.js" // 可选参数,您可以从 https://www.iconfont.cn/ 获取
42
+ locale={zhCN} // 来自 Ant Design 的语言包
43
+ style={{
44
+ width: '100%',
45
+ height: '100%',
46
+ }}
47
+ >
48
+ <div
49
+ style={{
50
+ width: '100%',
51
+ height: '100%',
52
+ backgroundColor: `var(--${prefix}-color-bg-base)`,
53
+ }}
54
+ >
55
+ <Flex vertical gap={16} align="center" style={{ padding: '12px 0' }}>
56
+ <Image
57
+ width={120}
58
+ src="https://img.alicdn.com/imgextra/i1/O1CN01Py27NU1re2pgohzqU_!!6000000005655-0-tps-480-480.jpg"
59
+ />
60
+ <div
61
+ style={{
62
+ color: `var(--${prefix}-ant-color-text-base)`,
63
+ fontSize: '24px',
64
+ textAlign: 'center',
65
+ }}
66
+ >
67
+ Hello Spark Design!
68
+ </div>
69
+ <Button
70
+ type="primary"
71
+ onClick={() => {
72
+ setColorMode(colorMode === 'light' ? 'dark' : 'light');
73
+ }}
74
+ icon={colorMode === 'light' ? <SparkMoonLine /> : <SparkSunLine />}
75
+ >
76
+ {colorMode === 'light' ? '暗色' : '亮色'} 模式
77
+ </Button>
78
+ </Flex>
79
+ </div>
80
+ </ConfigProvider>
81
+ );
82
+ };
83
+
84
+ export default App;
85
+ ```
86
+
87
+
88
+ 如果您想继续使用 antd 的组件,那也没问题。您只需要将 antd 的 ConfigProvider 替换为 @agentscope-ai/design 的即可。
89
+
90
+
91
+ ```tsx
92
+ import {
93
+ ConfigProvider,
94
+ purpleDarkTheme,
95
+ purpleTheme,
96
+ } from '@agentscope-ai/design';
97
+ import { Button, Image, Flex } from 'antd';
98
+ import { SparkSunLine, SparkMoonLine } from '@agentscope-ai/icons';
99
+ import zhCN from 'antd/locale/zh_CN';
100
+ import { useState } from 'react';
101
+
102
+ const App = () => {
103
+ const [colorMode, setColorMode] = useState('light');
104
+ const theme = colorMode === 'light' ? purpleTheme : purpleDarkTheme;
105
+
106
+ const prefix = 'sps';
107
+ return (
108
+ <ConfigProvider
109
+ {...theme} // 您可以从 purpleTheme、purpleDarkTheme、carbonTheme 和 carbonDarkTheme 中选择
110
+ prefix={prefix} // Ant Design 和 @agentscope-ai/design 的前缀
111
+ prefixCls={prefix}
112
+ iconfont="//at.alicdn.com/t/a/font_4807885_ugexdeaoq7.js" // 可选参数,您可以从 https://www.iconfont.cn/ 获取
113
+ locale={zhCN} // 来自 Ant Design 的语言包
114
+ style={{
115
+ width: '100%',
116
+ height: '100%',
117
+ }}
118
+ >
119
+ <div
120
+ style={{
121
+ width: '100%',
122
+ height: '100%',
123
+ backgroundColor: `var(--${prefix}-color-bg-base)`,
124
+ }}
125
+ >
126
+ <Flex vertical gap={16} align="center" style={{ padding: '12px 0' }}>
127
+ <Image
128
+ width={120}
129
+ src="https://img.alicdn.com/imgextra/i1/O1CN01Py27NU1re2pgohzqU_!!6000000005655-0-tps-480-480.jpg"
130
+ />
131
+ <div
132
+ style={{
133
+ color: `var(--${prefix}-ant-color-text-base)`,
134
+ fontSize: '24px',
135
+ textAlign: 'center',
136
+ }}
137
+ >
138
+ Hello Spark Design!
139
+ </div>
140
+ <Button
141
+ type="primary"
142
+ onClick={() => {
143
+ setColorMode(colorMode === 'light' ? 'dark' : 'light');
144
+ }}
145
+ icon={colorMode === 'light' ? <SparkMoonLine /> : <SparkSunLine />}
146
+ >
147
+ {colorMode === 'light' ? '暗色' : '亮色'} 模式
148
+ </Button>
149
+ </Flex>
150
+ </div>
151
+ </ConfigProvider>
152
+ );
153
+ };
154
+
155
+ export default App;
156
+ ```
@@ -0,0 +1,83 @@
1
+
2
+
3
+ # 从零开始使用
4
+
5
+ ## 📦 安装
6
+
7
+
8
+ ```bash
9
+ $ npm install antd @agentscope-ai/icons @agentscope-ai/design --save
10
+ ```
11
+
12
+
13
+ ## 🔨 使用
14
+
15
+
16
+ ```tsx
17
+ import {
18
+ Button,
19
+ Image,
20
+ ConfigProvider,
21
+ purpleDarkTheme,
22
+ purpleTheme,
23
+ } from '@agentscope-ai/design';
24
+ import { SparkSunLine, SparkMoonLine } from '@agentscope-ai/icons';
25
+ import { Flex } from 'antd';
26
+ import zhCN from 'antd/locale/zh_CN';
27
+ import { useState } from 'react';
28
+
29
+ const App = () => {
30
+ const [colorMode, setColorMode] = useState('light');
31
+ const theme = colorMode === 'light' ? purpleTheme : purpleDarkTheme;
32
+
33
+ const prefix = 'sps';
34
+ return (
35
+ <ConfigProvider
36
+ {...theme} // 您可以从 purpleTheme、purpleDarkTheme、carbonTheme 和 carbonDarkTheme 中选择
37
+ prefix={prefix} // Ant Design 和 @agentscope-ai/design 的前缀
38
+ prefixCls={prefix}
39
+ iconfont="//at.alicdn.com/t/a/font_4807885_ugexdeaoq7.js" // 可选参数,您可以从 https://www.iconfont.cn/ 获取
40
+ locale={zhCN} // 来自 Ant Design 的语言包
41
+ style={{
42
+ width: '100%',
43
+ height: '100%',
44
+ }}
45
+ >
46
+ <div
47
+ style={{
48
+ width: '100%',
49
+ height: '100%',
50
+ backgroundColor: `var(--${prefix}-color-bg-base)`,
51
+ }}
52
+ >
53
+ <Flex vertical gap={16} align="center" style={{ padding: '12px 0' }}>
54
+ <Image
55
+ width={120}
56
+ src="https://img.alicdn.com/imgextra/i1/O1CN01Py27NU1re2pgohzqU_!!6000000005655-0-tps-480-480.jpg"
57
+ />
58
+ <div
59
+ style={{
60
+ color: `var(--${prefix}-ant-color-text-base)`,
61
+ fontSize: '24px',
62
+ textAlign: 'center',
63
+ }}
64
+ >
65
+ Hello Spark Design!
66
+ </div>
67
+ <Button
68
+ type="primary"
69
+ onClick={() => {
70
+ setColorMode(colorMode === 'light' ? 'dark' : 'light');
71
+ }}
72
+ icon={colorMode === 'light' ? <SparkMoonLine /> : <SparkSunLine />}
73
+ >
74
+ {colorMode === 'light' ? '暗色' : '亮色'} 模式
75
+ </Button>
76
+ </Flex>
77
+ </div>
78
+ </ConfigProvider>
79
+ );
80
+ };
81
+
82
+ export default App;
83
+ ```
@@ -0,0 +1,69 @@
1
+
2
+
3
+ # 使用
4
+
5
+ 如果您有自己的 iconfont 项目,可以将您的图标集成到 Spark Design 中,并通过简单的符号名称访问您的图标。
6
+
7
+
8
+ ```tsx
9
+ import {
10
+ ConfigProvider,
11
+ purpleTheme,
12
+ Button,
13
+ IconFont,
14
+ IconButton,
15
+ } from '@agentscope-ai/design';
16
+ import { Flex } from 'antd';
17
+ import zhCN from 'antd/locale/zh_CN';
18
+ import { useState } from 'react';
19
+
20
+ const App = () => {
21
+ const prefix = 'sps';
22
+ const iconSymbol = 'spark-effciency-line';
23
+ const iconfont = '//at.alicdn.com/t/a/font_4807885_ugexdeaoq7.js'; // 您可以从 https://www.iconfont.cn/ 获取
24
+ return (
25
+ <ConfigProvider
26
+ {...purpleTheme}
27
+ prefix={prefix}
28
+ prefixCls={prefix}
29
+ iconfont={iconfont}
30
+ locale={zhCN}
31
+ style={{
32
+ width: '100%',
33
+ height: '100%',
34
+ }}
35
+ >
36
+ <Flex
37
+ style={{
38
+ width: '100%',
39
+ height: '100%',
40
+ backgroundColor: `var(--${prefix}-color-bg-base)`,
41
+ }}
42
+ justify="center"
43
+ align="center"
44
+ >
45
+ <Flex vertical gap={16} style={{ width: '300px', padding: '12px 0' }}>
46
+ <Flex gap={8}>
47
+ <div style={{ width: '100px', lineHeight: '32px' }}>IconFont:</div>
48
+ <IconFont type={iconSymbol} />
49
+ </Flex>
50
+ <Flex gap={8}>
51
+ <div style={{ width: '100px', lineHeight: '32px' }}>Button:</div>
52
+ <Button type="primary" iconType={iconSymbol}>
53
+ 添加用户
54
+ </Button>
55
+ </Flex>
56
+ <Flex gap={8}>
57
+ <div style={{ width: '100px', lineHeight: '32px' }}>
58
+ IconButton:
59
+ </div>
60
+ <IconButton iconType={iconSymbol}></IconButton>
61
+ </Flex>
62
+ </Flex>
63
+ </Flex>
64
+ </ConfigProvider>
65
+ );
66
+ };
67
+
68
+ export default App;
69
+ ```
@@ -0,0 +1,51 @@
1
+
2
+
3
+ <div align="center"><a name="readme-top"></a>
4
+ <img height="120" src="https://img.alicdn.com/imgextra/i1/O1CN01ipemFb1EzmZI9LiTe_!!6000000000423-55-tps-28-28.svg" style="border: none">
5
+ <h1>Alibaba Cloud Spark Design</h1>
6
+ </div>
7
+
8
+ # 概述
9
+
10
+ Alibaba Cloud Spark Design 是一个基于 Ant Design 的 React UI 组件库,包含丰富的基础组件和场景组件,专为构建优秀的 LLM 产品而设计。
11
+ <br />
12
+ <br />
13
+
14
+ ## ✨ 特性
15
+
16
+
17
+ - <img height="15" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg"> 基于 Ant Design,兼容 Ant Design 生态系统。您可以无需修改代码即可切换到 Spark Design。
18
+ - 🛡 使用 TypeScript 编写,具有可预测的静态类型。
19
+ - 🧠 为 LLM 产品设计的各种场景组件。
20
+ - 💡 与@agentscope-ai/chat 和 @agentscope-ai/flow 配合使用,构建企业级 LLM 应用。
21
+ - 🎨 多种预设主题。
22
+ - ☀️ 轻松切换明暗模式。
23
+
24
+ ## 📦 安装
25
+
26
+
27
+ ```bash
28
+ npm install antd @agentscope-ai/icons @agentscope-ai/design --save
29
+ ```
30
+
31
+
32
+ ## Tree Shaking 支持
33
+
34
+ @agentscope-ai/design 默认基于 ES 模块支持 tree shaking
35
+
36
+ ## TypeScript
37
+
38
+ @agentscope-ai/chat 使用 TypeScript 编写并提供完整的定义文件。
39
+
40
+ ## 内置主题
41
+
42
+ 我们提供四种内置主题:
43
+
44
+ <div><span style="display: inline-block; width: 12px; height: 12px; background-color: #615CED;"></span> purpleTheme</div>
45
+ <div><span style="display: inline-block; width: 12px; height: 12px; background-color: #5551CC;"></span> purpleDarkTheme(暗色模式)</div>
46
+ <div><span style="display: inline-block; width: 12px; height: 12px; background-color: rgba(26, 26, 29, 1);"></span> carbonTheme</div>
47
+ <div><span style="display: inline-block; width: 12px; height: 12px; background-color: #676767;"></span> carbonDarkTheme(暗色模式)</div>
48
+
49
+ ## 🏗️ 开源
50
+
51
+ [@agentscope-ai/design](https://www.npmjs.com/package/@agentscope-ai/design) 和 [@agentscope-ai/chat](https://www.npmjs.com/package/@agentscope-ai/chat) 正在积极推进开源,预计将在 2025 年底完成。目前,您可以通过 npm 访问我们的项目。
@@ -0,0 +1,25 @@
1
+
2
+
3
+ # 使用
4
+
5
+
6
+
7
+ ```tsx
8
+ import { SparkLoadingLine } from '@agentscope-ai/icons';
9
+
10
+ export default () => {
11
+ return (
12
+ <SparkLoadingLine
13
+ className="your-class-name"
14
+ style={{ color: 'var(--sps-color-primary)' }}
15
+ spin
16
+ size={48}
17
+ />
18
+ );
19
+ };
20
+
21
+ ```
22
+
23
+ 基本用法
24
+
25
+ 访问 [Icon Library](https://sparkdesign.agentscope.io/#/resources/icons) 查看全部 Icon