one-design-next 0.0.97 → 0.0.98
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/_genui-types.d.ts +3 -1
- package/dist/_genui-types.js +2 -0
- package/dist/chat-group/index.d.ts +48 -0
- package/dist/chat-group/index.js +250 -0
- package/dist/chat-group/presence-list.d.ts +29 -0
- package/dist/chat-group/presence-list.js +194 -0
- package/dist/chat-group/style/index.css +387 -0
- package/dist/chat-group/style/index.d.ts +2 -0
- package/dist/chat-group/style/index.js +2 -0
- package/dist/chat-item/index.d.ts +17 -2
- package/dist/chat-item/index.js +78 -10
- package/dist/chat-item/style/index.css +42 -27
- package/dist/chat-list/index.d.ts +61 -2
- package/dist/chat-list/index.js +604 -71
- package/dist/chat-list/style/index.css +266 -25
- package/dist/dropdown/index.d.ts +3 -2
- package/dist/dropdown/index.js +267 -236
- package/dist/dropdown/style/index.css +84 -6
- package/dist/hover-fill/index.d.ts +2 -2
- package/dist/hover-fill/index.js +179 -27
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/package.json +1 -1
|
@@ -5,29 +5,51 @@
|
|
|
5
5
|
* 左侧 12px 是正文 padding,不是 … 的 inset。
|
|
6
6
|
* hover 腾位:6 + 24 + 6 = 36。
|
|
7
7
|
*/
|
|
8
|
+
[data-odn-chat-item] {
|
|
9
|
+
display: block;
|
|
10
|
+
width: 100%;
|
|
11
|
+
min-width: 0;
|
|
12
|
+
}
|
|
8
13
|
[data-odn-chat-item]:hover [data-odn-chat-item-menu-trigger], [data-odn-chat-item]:has(:focus-visible) [data-odn-chat-item-menu-trigger] {
|
|
9
14
|
opacity: 1;
|
|
10
15
|
pointer-events: auto;
|
|
11
16
|
}
|
|
12
|
-
[data-odn-chat-item]
|
|
17
|
+
[data-odn-chat-item] {
|
|
18
|
+
/* 无时间才加 36;有时间则占位已在,避免标题变宽、离开时时间从行外闪回 */
|
|
19
|
+
}
|
|
20
|
+
[data-odn-chat-item]:hover [data-odn-chat-item-btn]:not(:has([data-odn-chat-item-time])), [data-odn-chat-item]:has(:focus-visible) [data-odn-chat-item-btn]:not(:has([data-odn-chat-item-time])), [data-odn-chat-item]:has([data-odn-chat-item-menu-trigger-open]) [data-odn-chat-item-btn] {
|
|
13
21
|
padding-right: 36px;
|
|
14
22
|
}
|
|
15
23
|
[data-odn-chat-item] {
|
|
16
|
-
/*
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
/* hover:只隐身,宽度留下。收宽度会让移出时时间从行外闪回 */
|
|
25
|
+
}
|
|
26
|
+
[data-odn-chat-item]:hover [data-odn-chat-item-time], [data-odn-chat-item]:has(:focus-visible) [data-odn-chat-item-time] {
|
|
27
|
+
opacity: 0;
|
|
28
|
+
pointer-events: none;
|
|
29
|
+
}
|
|
30
|
+
[data-odn-chat-item] {
|
|
31
|
+
/* hover + 状态 + 时间:同一颗状态 relative 右移,占位不收,移出不飞 */
|
|
32
|
+
}
|
|
33
|
+
[data-odn-chat-item]:hover:has([data-odn-chat-item-time]):not([data-odn-chat-item-time-yield]) [data-odn-chat-item-status], [data-odn-chat-item]:has(:focus-visible):has([data-odn-chat-item-time]):not([data-odn-chat-item-time-yield]) [data-odn-chat-item-status] {
|
|
34
|
+
position: relative;
|
|
35
|
+
z-index: 1;
|
|
36
|
+
left: max(0px, 6px + var(--odn-chat-item-time-w, 0px) - 24px);
|
|
20
37
|
}
|
|
21
|
-
[data-odn-chat-item]
|
|
38
|
+
[data-odn-chat-item] {
|
|
39
|
+
/* 选中 / 菜单开:时间退出布局,右侧 36 给 …。
|
|
40
|
+
* 标记打在行根上,不依赖 :has(Dropdown 触发器)——触发器属性不一定能被 :has 看到。 */
|
|
41
|
+
}
|
|
42
|
+
[data-odn-chat-item][data-odn-chat-item-time-yield] [data-odn-chat-item-time] {
|
|
22
43
|
opacity: 0;
|
|
23
44
|
width: 0;
|
|
24
45
|
min-width: 0;
|
|
25
46
|
max-width: 0;
|
|
47
|
+
flex: 0 0 0;
|
|
26
48
|
margin: 0;
|
|
27
49
|
overflow: hidden;
|
|
28
50
|
pointer-events: none;
|
|
29
51
|
}
|
|
30
|
-
[data-odn-chat-item]
|
|
52
|
+
[data-odn-chat-item][data-odn-chat-item-time-yield] [data-odn-chat-item-trailing]:not(:has([data-odn-chat-item-status])) {
|
|
31
53
|
padding-left: 0;
|
|
32
54
|
}
|
|
33
55
|
|
|
@@ -35,6 +57,12 @@
|
|
|
35
57
|
border-radius: 6px;
|
|
36
58
|
}
|
|
37
59
|
|
|
60
|
+
/* 选中底与 hover / 按下同一层 */
|
|
61
|
+
[data-odn-chat-item]:has([data-odn-chat-item-active]) > [data-odn-hover-fill-bg] {
|
|
62
|
+
background: var(--odn-color-black-4);
|
|
63
|
+
transform: scale(1);
|
|
64
|
+
}
|
|
65
|
+
|
|
38
66
|
[data-odn-chat-item-inner] {
|
|
39
67
|
position: relative;
|
|
40
68
|
display: block;
|
|
@@ -58,7 +86,7 @@
|
|
|
58
86
|
padding: 0;
|
|
59
87
|
border: none;
|
|
60
88
|
background: transparent;
|
|
61
|
-
color: var(--odn-color-black-
|
|
89
|
+
color: var(--odn-color-black-10);
|
|
62
90
|
font: inherit;
|
|
63
91
|
font-size: 14px;
|
|
64
92
|
line-height: inherit;
|
|
@@ -83,34 +111,20 @@
|
|
|
83
111
|
transition: color 0.15s, background 0.15s;
|
|
84
112
|
color: var(--odn-color-black-10);
|
|
85
113
|
font: inherit;
|
|
86
|
-
/* active 时在半透明背景下垫一层不透明底,遮挡 HoverFill 的 hover 层,避免叠色。 */
|
|
87
|
-
}
|
|
88
|
-
[data-odn-chat-item-btn]::before {
|
|
89
|
-
content: "";
|
|
90
|
-
position: absolute;
|
|
91
|
-
inset: 0;
|
|
92
|
-
border-radius: inherit;
|
|
93
|
-
background: var(--odn-color-bg-elevated);
|
|
94
|
-
z-index: -1;
|
|
95
|
-
opacity: 0;
|
|
96
|
-
pointer-events: none;
|
|
97
|
-
transition: opacity 0.15s;
|
|
98
114
|
}
|
|
99
115
|
[data-odn-chat-item-btn]:focus-visible {
|
|
100
116
|
outline: none;
|
|
101
|
-
background:
|
|
102
|
-
color: var(--odn-color-black-
|
|
117
|
+
background: transparent;
|
|
118
|
+
color: var(--odn-color-black-10);
|
|
103
119
|
}
|
|
104
120
|
[data-odn-chat-item-btn][data-odn-chat-item-active] {
|
|
105
121
|
padding-right: 36px;
|
|
106
|
-
background:
|
|
122
|
+
background: transparent;
|
|
107
123
|
color: var(--odn-color-black-12);
|
|
108
|
-
|
|
109
|
-
[data-odn-chat-item-btn][data-odn-chat-item-active]::before {
|
|
110
|
-
opacity: 1;
|
|
124
|
+
font-weight: 500;
|
|
111
125
|
}
|
|
112
126
|
[data-odn-chat-item-btn][data-odn-chat-item-active]:focus-visible {
|
|
113
|
-
background:
|
|
127
|
+
background: transparent;
|
|
114
128
|
}
|
|
115
129
|
|
|
116
130
|
[data-odn-chat-item-label] {
|
|
@@ -152,6 +166,7 @@
|
|
|
152
166
|
|
|
153
167
|
/* 状态 / 时间:右对齐;类型 icon 在标题旁,不在此区 */
|
|
154
168
|
[data-odn-chat-item-trailing] {
|
|
169
|
+
position: relative;
|
|
155
170
|
flex-shrink: 0;
|
|
156
171
|
display: inline-flex;
|
|
157
172
|
align-items: center;
|
|
@@ -1,19 +1,38 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type ChatItemProps } from '../chat-item';
|
|
3
3
|
import './style';
|
|
4
|
+
/** 系统「未分组」默认 id;不在「分组」模块内渲染。 */
|
|
5
|
+
export declare const CHAT_LIST_UNGROUPED_ID = "ungrouped";
|
|
4
6
|
/** 按会话时间筛选(面板不含时间组;`filterTime` 仅受控 API)。 */
|
|
5
7
|
export type ChatListFilterTime = 'all' | 'today' | '7d' | '30d';
|
|
6
8
|
/** 按会话类型筛选:全部 / AI 任务 / 人工客服。 */
|
|
7
9
|
export type ChatListFilterType = 'all' | 'ai' | 'human';
|
|
8
10
|
/** 按会话状态筛选:全部 / 生成中 / 待回复 / 未读 / 任务报错。 */
|
|
9
11
|
export type ChatListFilterStatus = 'all' | 'generating' | 'waiting' | 'unread' | 'error';
|
|
10
|
-
export
|
|
12
|
+
export interface ChatListGroup {
|
|
13
|
+
id: string;
|
|
14
|
+
title: string;
|
|
15
|
+
/** 是否允许重命名。默认 `true`。系统「未分组」建议 `false`。 */
|
|
16
|
+
renamable?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* 置顶分组:仍在「分组」模块内,排到该模块最前;仍带文件夹 icon。
|
|
19
|
+
*/
|
|
20
|
+
pinned?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export type ChatListItem = Pick<ChatItemProps, 'id' | 'title' | 'active' | 'type' | 'status' | 'pinned' | 'time' | 'groupId'>;
|
|
11
23
|
export interface ChatListProps {
|
|
12
24
|
items: ChatListItem[];
|
|
13
25
|
/** 列表标题。默认「对话」。 */
|
|
14
26
|
title?: ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* 自定义分组。传入后按「置顶区 → 分组模块 → 未分组」编排。
|
|
29
|
+
* 标题栏搜索默认关闭,需 `showSearch`。
|
|
30
|
+
* 不传则保持「置顶 / 最近」分区。
|
|
31
|
+
*/
|
|
32
|
+
groups?: ChatListGroup[];
|
|
15
33
|
/**
|
|
16
34
|
* 置顶分区标题。视觉同组头,无交互。传 `null` 隐藏。默认「置顶」。
|
|
35
|
+
* 传入 `groups` 时置顶区默认不显示标题。
|
|
17
36
|
*/
|
|
18
37
|
pinnedSectionTitle?: ReactNode | null;
|
|
19
38
|
/**
|
|
@@ -21,6 +40,12 @@ export interface ChatListProps {
|
|
|
21
40
|
* 传 `null` 始终隐藏。默认「最近」。
|
|
22
41
|
*/
|
|
23
42
|
recentSectionTitle?: ReactNode | null;
|
|
43
|
+
/** 「分组」模块行文案。默认「分组」。 */
|
|
44
|
+
groupsSectionTitle?: ReactNode;
|
|
45
|
+
/** 「未分组」标题。若 `groups` 中含未分组项则优先用其 title。默认「未分组」。 */
|
|
46
|
+
ungroupedTitle?: string;
|
|
47
|
+
/** 未分组系统 id。默认 `ungrouped`。 */
|
|
48
|
+
ungroupedGroupId?: string;
|
|
24
49
|
/**
|
|
25
50
|
* 受控:时间筛选。筛选面板不含时间组,仅 API 可用。
|
|
26
51
|
*/
|
|
@@ -42,10 +67,23 @@ export interface ChatListProps {
|
|
|
42
67
|
/** 非受控:初始状态筛选。默认 `'all'`。 */
|
|
43
68
|
defaultFilterStatus?: ChatListFilterStatus;
|
|
44
69
|
onFilterStatusChange?: (value: ChatListFilterStatus) => void;
|
|
70
|
+
/** 受控:搜索关键字(仅 `groups` 传入且 `showSearch` 时生效) */
|
|
71
|
+
search?: string;
|
|
72
|
+
/** 非受控:初始搜索关键字 */
|
|
73
|
+
defaultSearch?: string;
|
|
74
|
+
onSearchChange?: (value: string) => void;
|
|
75
|
+
/**
|
|
76
|
+
* 是否在标题栏展示搜索。仅 `groups` 传入时有效。默认隐藏。
|
|
77
|
+
*/
|
|
78
|
+
showSearch?: boolean;
|
|
45
79
|
/** 受控:筛选选择器是否展开 */
|
|
46
80
|
filterOpen?: boolean;
|
|
47
81
|
defaultFilterOpen?: boolean;
|
|
48
82
|
onFilterOpenChange?: (open: boolean) => void;
|
|
83
|
+
/**
|
|
84
|
+
* 是否渲染空的自定义分组 / 空的未分组。默认 `true`。
|
|
85
|
+
*/
|
|
86
|
+
showEmptyGroups?: boolean;
|
|
49
87
|
/** 空列表时的占位 */
|
|
50
88
|
empty?: ReactNode;
|
|
51
89
|
actionMenuZIndex?: number | string;
|
|
@@ -55,12 +93,33 @@ export interface ChatListProps {
|
|
|
55
93
|
onItemClick?: ChatItemProps['onClick'];
|
|
56
94
|
onRename?: ChatItemProps['onRename'];
|
|
57
95
|
onPin?: ChatItemProps['onPin'];
|
|
96
|
+
onMoveToGroup?: ChatItemProps['onMoveToGroup'];
|
|
58
97
|
onDelete?: ChatItemProps['onDelete'];
|
|
98
|
+
/**
|
|
99
|
+
* 新增分组。组件会生成 `{ id, title: '新分组' }` 并回调,随后进入重命名。
|
|
100
|
+
*/
|
|
101
|
+
onAddGroup?: (group: ChatListGroup) => void;
|
|
102
|
+
/** 重命名分组 */
|
|
103
|
+
onRenameGroup?: (id: string, title: string) => void;
|
|
104
|
+
/** 置顶 / 取消置顶分组(组块在「分组」模块内排序) */
|
|
105
|
+
onPinGroup?: (id: string, pinned: boolean) => void;
|
|
106
|
+
/**
|
|
107
|
+
* 删除分组。确认后回调;业务侧应将组内会话移入未分组并移除该组。
|
|
108
|
+
*/
|
|
109
|
+
onDeleteGroup?: (id: string) => void;
|
|
110
|
+
/** 在指定分组(或未分组)内新建对话 */
|
|
111
|
+
onCreateConversation?: (groupId: string) => void;
|
|
59
112
|
/** 自定义行渲染。默认渲染 ChatItem。 */
|
|
60
113
|
renderItem?: (item: ChatListItem, node: ReactNode) => ReactNode;
|
|
114
|
+
/** 自定义组头。默认使用 ChatGroup 标题。 */
|
|
115
|
+
renderGroupHeader?: (group: ChatListGroup, defaultTitle: ReactNode) => ReactNode;
|
|
116
|
+
collapsedGroupIds?: string[];
|
|
117
|
+
defaultCollapsedGroupIds?: string[];
|
|
118
|
+
onCollapsedGroupIdsChange?: (ids: string[]) => void;
|
|
61
119
|
/**
|
|
62
120
|
* 将「最近」列表包进自定义滚动容器。
|
|
63
121
|
* 标题栏与置顶区始终留在外侧,不进入该容器。
|
|
122
|
+
* 传入 `groups` 时忽略。
|
|
64
123
|
*/
|
|
65
124
|
renderRestScroll?: (content: ReactNode) => ReactNode;
|
|
66
125
|
}
|
|
@@ -70,7 +129,7 @@ export declare function matchChatListFilterTime(time: ChatListItem['time'], filt
|
|
|
70
129
|
export declare function matchChatListFilterType(type: ChatListItem['type'], filter: ChatListFilterType): boolean;
|
|
71
130
|
/** 按状态筛选项判断会话是否命中。无 `status` 时仅在「全部」下保留。 */
|
|
72
131
|
export declare function matchChatListFilterStatus(status: ChatListItem['status'], filter: ChatListFilterStatus): boolean;
|
|
73
|
-
export declare function ChatList({ items, title, pinnedSectionTitle, recentSectionTitle, filterTime: filterTimeProp, defaultFilterTime, filterType: filterTypeProp, defaultFilterType, onFilterTypeChange, filterStatus: filterStatusProp, defaultFilterStatus, onFilterStatusChange, filterOpen: filterOpenProp, defaultFilterOpen, onFilterOpenChange, empty, actionMenuZIndex, filterMenuZIndex, className, onItemClick, onRename, onPin, onDelete, renderItem, renderRestScroll, }: ChatListProps): import("react").JSX.Element;
|
|
132
|
+
export declare function ChatList({ items, title, groups, pinnedSectionTitle, recentSectionTitle, groupsSectionTitle, ungroupedTitle, ungroupedGroupId, filterTime: filterTimeProp, defaultFilterTime, filterType: filterTypeProp, defaultFilterType, onFilterTypeChange, filterStatus: filterStatusProp, defaultFilterStatus, onFilterStatusChange, search: searchProp, defaultSearch, onSearchChange, showSearch, filterOpen: filterOpenProp, defaultFilterOpen, onFilterOpenChange, showEmptyGroups, empty, actionMenuZIndex, filterMenuZIndex, className, onItemClick, onRename, onPin, onMoveToGroup, onDelete, onAddGroup, onRenameGroup, onPinGroup, onDeleteGroup, onCreateConversation, renderItem, renderGroupHeader, collapsedGroupIds: collapsedProp, defaultCollapsedGroupIds, onCollapsedGroupIdsChange, renderRestScroll, }: ChatListProps): import("react").JSX.Element;
|
|
74
133
|
export declare namespace ChatList {
|
|
75
134
|
var displayName: string;
|
|
76
135
|
}
|