@epam/ai-dial-conversation-panel 0.0.0-dev.0
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/components/ConversationGroup/ConversationGroup.d.ts +29 -0
- package/components/ConversationGroup/ConversationGroup.d.ts.map +1 -0
- package/components/ConversationGroup/ConversationRow.d.ts +50 -0
- package/components/ConversationGroup/ConversationRow.d.ts.map +1 -0
- package/components/ConversationGroupHeader/ConversationGroupHeader.d.ts +29 -0
- package/components/ConversationGroupHeader/ConversationGroupHeader.d.ts.map +1 -0
- package/components/ConversationPanel/ConversationPanel.d.ts +5 -0
- package/components/ConversationPanel/ConversationPanel.d.ts.map +1 -0
- package/components/ConversationPanel/utils.d.ts +7 -0
- package/components/ConversationPanel/utils.d.ts.map +1 -0
- package/components/FilterTabs/FilterTabs.d.ts +17 -0
- package/components/FilterTabs/FilterTabs.d.ts.map +1 -0
- package/components/NewChatButton/NewChatButton.d.ts +13 -0
- package/components/NewChatButton/NewChatButton.d.ts.map +1 -0
- package/components/RowRenderer/RowRenderer.d.ts +5 -0
- package/components/RowRenderer/RowRenderer.d.ts.map +1 -0
- package/constants/virtual-list.d.ts +7 -0
- package/constants/virtual-list.d.ts.map +1 -0
- package/index.css +2 -0
- package/index.d.ts +7 -0
- package/index.d.ts.map +1 -0
- package/index.js +871 -0
- package/models/panel-props.d.ts +211 -0
- package/models/panel-props.d.ts.map +1 -0
- package/models/virtual-row.d.ts +70 -0
- package/models/virtual-row.d.ts.map +1 -0
- package/package.json +28 -0
- package/test-setup.d.ts +1 -0
- package/test-setup.d.ts.map +1 -0
- package/types/conversation-group-key.d.ts +8 -0
- package/types/conversation-group-key.d.ts.map +1 -0
- package/types/conversation-source.d.ts +7 -0
- package/types/conversation-source.d.ts.map +1 -0
- package/types/filter-tab.d.ts +8 -0
- package/types/filter-tab.d.ts.map +1 -0
- package/types/virtual-row.d.ts +6 -0
- package/types/virtual-row.d.ts.map +1 -0
- package/utils/conversation-row.d.ts +14 -0
- package/utils/conversation-row.d.ts.map +1 -0
- package/utils/drag.d.ts +26 -0
- package/utils/drag.d.ts.map +1 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { DropdownItem } from '@epam/ai-dial-ui-kit';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { ConversationGroupKey } from '../types/conversation-group-key';
|
|
4
|
+
import { ConversationSource } from '../types/conversation-source';
|
|
5
|
+
import { FilterTab } from '../types/filter-tab';
|
|
6
|
+
/** Labels for each filter tab — provided as props so the app supplies i18n strings. */
|
|
7
|
+
export interface FilterLabels {
|
|
8
|
+
/** Label for the "All" tab. */
|
|
9
|
+
all: string;
|
|
10
|
+
/** Label for the "My chats" tab. */
|
|
11
|
+
myChats: string;
|
|
12
|
+
/** Label for the "Shared" tab. */
|
|
13
|
+
shared: string;
|
|
14
|
+
/** Label for the "Organization" tab. */
|
|
15
|
+
organization: string;
|
|
16
|
+
}
|
|
17
|
+
/** A single conversation entry shown in the history panel. */
|
|
18
|
+
export interface ConversationHistoryItem {
|
|
19
|
+
/** Unique conversation identifier (path or UUID). */
|
|
20
|
+
id: string;
|
|
21
|
+
/** Human-readable title — typically the first user message. */
|
|
22
|
+
title: string;
|
|
23
|
+
/** When true the item is shown in the Pinned section. */
|
|
24
|
+
isPinned?: boolean;
|
|
25
|
+
/** Ownership/share source — used to filter by tab. */
|
|
26
|
+
source?: ConversationSource;
|
|
27
|
+
/** URL of the model or conversation icon. When absent a default icon is shown. */
|
|
28
|
+
iconUrl?: string;
|
|
29
|
+
/** Tooltip text shown on the deployment icon. Typically the agent or model display name. */
|
|
30
|
+
iconTooltip?: string;
|
|
31
|
+
/** When `true`, a skeleton placeholder is shown instead of the deployment icon. */
|
|
32
|
+
isIconLoading?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Browser-navigable URL for the conversation (e.g. `/conversations/<id>`).
|
|
35
|
+
* When provided, a middle mouse button click on the row opens this URL in a new tab,
|
|
36
|
+
* matching standard browser link behaviour.
|
|
37
|
+
*/
|
|
38
|
+
href?: string;
|
|
39
|
+
}
|
|
40
|
+
/** Font overrides for the header title in `ConversationPanel`. */
|
|
41
|
+
export interface ConversationHistoryTypography {
|
|
42
|
+
/** Font family applied to the panel title. */
|
|
43
|
+
fontFamily?: string;
|
|
44
|
+
/** Font size applied to the panel title. */
|
|
45
|
+
fontSize?: string;
|
|
46
|
+
/** Font weight applied to the panel title. */
|
|
47
|
+
fontWeight?: string | number;
|
|
48
|
+
/** Line height applied to the panel title. */
|
|
49
|
+
lineHeight?: string;
|
|
50
|
+
/**
|
|
51
|
+
* A single utility class (e.g. `'dial-body-semi-text'`) applied to the title span.
|
|
52
|
+
* When provided, individual font CSS vars are ignored in favour of this class.
|
|
53
|
+
*/
|
|
54
|
+
fontClassName?: string;
|
|
55
|
+
/** Typography class applied to collapsible group header buttons. Defaults to `'text-xs font-semibold'`. */
|
|
56
|
+
groupHeaderClassName?: string;
|
|
57
|
+
/** Typography class applied to conversation title text in each row. Defaults to `'text-sm'`. */
|
|
58
|
+
itemTitleClassName?: string;
|
|
59
|
+
/** Typography class applied to the New chat button label. Defaults to `'dial-small-text'`. */
|
|
60
|
+
newChatLabelClassName?: string;
|
|
61
|
+
/** Typography class applied to each filter tab label. Defaults to `'dial-tiny-semi-text'`. */
|
|
62
|
+
tabClassName?: string;
|
|
63
|
+
/** Text color class applied to each filter tab label. Defaults to `'text-primary'`. */
|
|
64
|
+
tabColorClassName?: string;
|
|
65
|
+
/** CSS class applied to the icon badge in each conversation row. Defaults to `'rounded-full'`. */
|
|
66
|
+
itemIconBadgeClassName?: string;
|
|
67
|
+
}
|
|
68
|
+
/** CSS custom-property overrides for `ConversationPanel`. */
|
|
69
|
+
export interface ConversationHistoryColors {
|
|
70
|
+
/** Panel background color. */
|
|
71
|
+
background?: string;
|
|
72
|
+
/** Inner-edge divider border color. */
|
|
73
|
+
border?: string;
|
|
74
|
+
/** Hover background for a conversation row. */
|
|
75
|
+
itemHover?: string;
|
|
76
|
+
/** Active/selected background for a conversation row. */
|
|
77
|
+
itemActive?: string;
|
|
78
|
+
/** Primary text color. */
|
|
79
|
+
text?: string;
|
|
80
|
+
/** Secondary text color (dates, metadata). */
|
|
81
|
+
textSecondary?: string;
|
|
82
|
+
/** Hover background of the New chat button. */
|
|
83
|
+
newChatHoverBackground?: string;
|
|
84
|
+
/** Active/pressed background of the New chat button. */
|
|
85
|
+
newChatActiveBackground?: string;
|
|
86
|
+
/** Background of the New chat button. */
|
|
87
|
+
newChatBackground?: string;
|
|
88
|
+
}
|
|
89
|
+
/** Combined style overrides (colors and typography) for `ConversationPanel`. */
|
|
90
|
+
export interface ConversationPanelStyles {
|
|
91
|
+
/** Color overrides applied as CSS custom properties. */
|
|
92
|
+
colors?: ConversationHistoryColors;
|
|
93
|
+
/** Typography overrides for the panel and its children. */
|
|
94
|
+
typography?: ConversationHistoryTypography;
|
|
95
|
+
}
|
|
96
|
+
/** Props accepted by `ConversationPanel`. */
|
|
97
|
+
export interface ConversationPanelProps {
|
|
98
|
+
/** Ordered list of conversations to display. */
|
|
99
|
+
conversations: ConversationHistoryItem[];
|
|
100
|
+
/** When true, renders skeleton rows instead of the conversation list. */
|
|
101
|
+
isLoading?: boolean;
|
|
102
|
+
/** Whether the panel is currently expanded. */
|
|
103
|
+
isOpen: boolean;
|
|
104
|
+
/** Called with the conversation `id` when a row is clicked. */
|
|
105
|
+
onSelectConversation: (id: string) => void;
|
|
106
|
+
/** `id` of the currently viewed conversation; that row gets `aria-current="page"`. */
|
|
107
|
+
activeConversationId?: string;
|
|
108
|
+
/** Panel heading text (e.g. `"Chats"`). */
|
|
109
|
+
title: string;
|
|
110
|
+
/** Message shown when `conversations` is empty. */
|
|
111
|
+
emptyLabel: string;
|
|
112
|
+
/** Message shown when conversations exist but none match the active filter. */
|
|
113
|
+
noResultsLabel: string;
|
|
114
|
+
/** Called when the New chat button is clicked. */
|
|
115
|
+
onNewChat: () => void;
|
|
116
|
+
/** Label for the New chat button (e.g. `"New chat"`). */
|
|
117
|
+
newChatLabel: string;
|
|
118
|
+
/** Placeholder text for the search input (e.g. `"Search chat…"`). */
|
|
119
|
+
searchPlaceholder: string;
|
|
120
|
+
/** Accessible label for the search input clear button. */
|
|
121
|
+
searchClearLabel: string;
|
|
122
|
+
/** Labels for the four filter tabs. */
|
|
123
|
+
filterLabels: FilterLabels;
|
|
124
|
+
/** Labels for collapsible group section headings. */
|
|
125
|
+
groupLabels?: {
|
|
126
|
+
/** Heading for the Pinned section. Defaults to `"Pinned"`. */
|
|
127
|
+
pinned?: string;
|
|
128
|
+
/** Heading for the My chats section. Defaults to `"My chats"`. */
|
|
129
|
+
myChats?: string;
|
|
130
|
+
/** Heading for the Shared section. Defaults to `"Shared"`. */
|
|
131
|
+
shared?: string;
|
|
132
|
+
/** Heading for the Organization section. Defaults to `"Organization"`. */
|
|
133
|
+
organization?: string;
|
|
134
|
+
};
|
|
135
|
+
/** Color and typography overrides applied as CSS custom properties. */
|
|
136
|
+
styles?: ConversationPanelStyles;
|
|
137
|
+
/** Extra class name(s) merged onto the panel root element. */
|
|
138
|
+
className?: string;
|
|
139
|
+
/**
|
|
140
|
+
* Builds the dropdown menu items for a conversation row.
|
|
141
|
+
* Receives the full item so actions can reflect per-item state (e.g. `isPinned` toggle).
|
|
142
|
+
* When omitted or returns an empty array, no actions trigger is rendered on rows.
|
|
143
|
+
*/
|
|
144
|
+
getActions?: (item: ConversationHistoryItem) => DropdownItem[];
|
|
145
|
+
/** Accessible label for the row actions trigger button. Defaults to `"More actions"`. */
|
|
146
|
+
actionsLabel?: string;
|
|
147
|
+
/**
|
|
148
|
+
* Called when the mobile sidebar toggle icon in the panel header is clicked.
|
|
149
|
+
* When provided, the toggle button becomes visible on mobile screens.
|
|
150
|
+
* The parent is responsible for managing `isOpen` state in response to this callback.
|
|
151
|
+
*/
|
|
152
|
+
onToggle?: () => void;
|
|
153
|
+
/** Accessible label for the sidebar toggle icon button. Required when `onToggle` is provided. */
|
|
154
|
+
closeAriaLabel?: string;
|
|
155
|
+
/**
|
|
156
|
+
* Enables the drag-to-resize handle on the panel's right edge.
|
|
157
|
+
* When false (default) the panel renders at a fixed width.
|
|
158
|
+
* Pass `false` on mobile to disable resizing.
|
|
159
|
+
*/
|
|
160
|
+
resizable?: boolean;
|
|
161
|
+
/** Initial panel width in px used when `resizable` is true. Defaults to 325. */
|
|
162
|
+
defaultPanelWidth?: number;
|
|
163
|
+
/** Minimum panel width in px used when `resizable` is true. Defaults to 312. */
|
|
164
|
+
minPanelWidth?: number;
|
|
165
|
+
/** Maximum panel width in px used when `resizable` is true. Defaults to 600. */
|
|
166
|
+
maxPanelWidth?: number;
|
|
167
|
+
/** Called with the new width in px when the user finishes a resize drag. */
|
|
168
|
+
onPanelResizeStop?: (width: number) => void;
|
|
169
|
+
/**
|
|
170
|
+
* Content rendered in the right action group of the panel header bar.
|
|
171
|
+
* The app supplies any ReactNode — the library does not prescribe its content.
|
|
172
|
+
*/
|
|
173
|
+
headerActions?: ReactNode;
|
|
174
|
+
/**
|
|
175
|
+
* Called when the user completes a valid drag-and-drop move.
|
|
176
|
+
* `draggedId` is the conversation that was moved.
|
|
177
|
+
* `targetGroupKey` is the group it was dropped into.
|
|
178
|
+
* `afterId` is the id of the item the dragged conversation should be placed after,
|
|
179
|
+
* or `null` when dropped at the top of the target group.
|
|
180
|
+
*
|
|
181
|
+
* The app derives the action type from `targetGroupKey`:
|
|
182
|
+
* - dropping into `Pinned` → pin the conversation
|
|
183
|
+
* - dragging from `Pinned` into another group → unpin
|
|
184
|
+
* - same-group drop → reorder
|
|
185
|
+
*/
|
|
186
|
+
onMoveConversation?: (move: ConversationMove) => void;
|
|
187
|
+
/**
|
|
188
|
+
* Imperatively sets the active filter tab. When provided the panel switches
|
|
189
|
+
* to this tab; the user can still change it afterwards. Pass `undefined` to
|
|
190
|
+
* leave the current tab unchanged.
|
|
191
|
+
*/
|
|
192
|
+
activeFilter?: FilterTab;
|
|
193
|
+
/**
|
|
194
|
+
* Called whenever the active filter tab changes — either because the user
|
|
195
|
+
* clicked a tab or because `activeFilter` drove a programmatic switch.
|
|
196
|
+
*/
|
|
197
|
+
onActiveFilterChange?: (tab: FilterTab) => void;
|
|
198
|
+
}
|
|
199
|
+
/** Describes a completed drag-and-drop move in the conversation panel. */
|
|
200
|
+
export interface ConversationMove {
|
|
201
|
+
/** Id of the conversation that was dragged. */
|
|
202
|
+
draggedId: string;
|
|
203
|
+
/** The group the item was dropped into. */
|
|
204
|
+
targetGroupKey: ConversationGroupKey;
|
|
205
|
+
/**
|
|
206
|
+
* Id of the item the dragged conversation should be placed after.
|
|
207
|
+
* `null` means the item was dropped at the top of the target group.
|
|
208
|
+
*/
|
|
209
|
+
afterId: string | null;
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=panel-props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel-props.d.ts","sourceRoot":"","sources":["../../src/models/panel-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,uFAAuF;AACvF,MAAM,WAAW,YAAY;IAC3B,+BAA+B;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,8DAA8D;AAC9D,MAAM,WAAW,uBAAuB;IACtC,qDAAqD;IACrD,EAAE,EAAE,MAAM,CAAC;IACX,+DAA+D;IAC/D,KAAK,EAA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AAI,CAAC;CACxB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { DropdownItem } from '@epam/ai-dial-ui-kit';
|
|
2
|
+
import { ConversationGroupKey } from '../types/conversation-group-key';
|
|
3
|
+
import { VirtualRowKind } from '../types/virtual-row';
|
|
4
|
+
import { ConversationHistoryItem } from './panel-props';
|
|
5
|
+
export { VirtualRowKind };
|
|
6
|
+
/** A collapsible group header row in the virtual list. */
|
|
7
|
+
export interface GroupHeaderRow {
|
|
8
|
+
/** Row discriminant. */
|
|
9
|
+
kind: VirtualRowKind.Header;
|
|
10
|
+
/** Identifies which group this header belongs to. */
|
|
11
|
+
groupKey: ConversationGroupKey;
|
|
12
|
+
/** Visible section heading text. */
|
|
13
|
+
label: string;
|
|
14
|
+
}
|
|
15
|
+
/** A single conversation item row in the virtual list. */
|
|
16
|
+
export interface ConversationItemRow {
|
|
17
|
+
/** Row discriminant. */
|
|
18
|
+
kind: VirtualRowKind.Item;
|
|
19
|
+
/** The conversation to render. */
|
|
20
|
+
item: ConversationHistoryItem;
|
|
21
|
+
/** The group this item belongs to — used for drag-and-drop validation. */
|
|
22
|
+
groupKey: ConversationGroupKey;
|
|
23
|
+
}
|
|
24
|
+
/** Union of all possible virtual row shapes. */
|
|
25
|
+
export type VirtualRow = GroupHeaderRow | ConversationItemRow;
|
|
26
|
+
/** Data passed to every virtual row renderer via `react-window`'s `rowProps`. */
|
|
27
|
+
export interface RowRendererData {
|
|
28
|
+
/** The full flat row array, indexed by the virtual list. */
|
|
29
|
+
rows: VirtualRow[];
|
|
30
|
+
/** Set of group keys that are currently expanded. */
|
|
31
|
+
expandedGroups: Set<string>;
|
|
32
|
+
/** Toggles the expanded state of the given group. */
|
|
33
|
+
onToggleGroup: (key: string) => void;
|
|
34
|
+
/** `id` of the currently active conversation. */
|
|
35
|
+
activeConversationId?: string;
|
|
36
|
+
/** Called when the user selects a conversation row. */
|
|
37
|
+
onSelectConversation: (id: string) => void;
|
|
38
|
+
/** Builds dropdown actions for a conversation item. */
|
|
39
|
+
getActions?: (item: ConversationHistoryItem) => DropdownItem[];
|
|
40
|
+
/** Accessible label for the actions trigger button. */
|
|
41
|
+
actionsLabel?: string;
|
|
42
|
+
/** Typography class applied to group header buttons. */
|
|
43
|
+
groupHeaderClassName?: string;
|
|
44
|
+
/** Typography class applied to conversation title text. */
|
|
45
|
+
itemTitleClassName?: string;
|
|
46
|
+
/** CSS class applied to the icon badge in each conversation row. */
|
|
47
|
+
itemIconBadgeClassName?: string;
|
|
48
|
+
/** Id of the conversation currently being dragged. `null` when no drag is in progress. */
|
|
49
|
+
draggingId: string | null;
|
|
50
|
+
/** Id of the row (item or group header sentinel) currently under the drag cursor. */
|
|
51
|
+
dragOverId: string | null;
|
|
52
|
+
/** Groups that are valid drop targets for the current drag. `null` when no drag is in progress. */
|
|
53
|
+
allowedDropGroups: Set<ConversationGroupKey> | null;
|
|
54
|
+
/** Called when the user starts dragging a conversation row. */
|
|
55
|
+
onDragStart: (id: string) => void;
|
|
56
|
+
/** Called when the drag ends (drop or cancel). */
|
|
57
|
+
onDragEnd: () => void;
|
|
58
|
+
/** Called when the drag cursor enters a row. */
|
|
59
|
+
onDragOver: (id: string) => void;
|
|
60
|
+
/** Called when the drag cursor leaves a row. */
|
|
61
|
+
onDragLeave: () => void;
|
|
62
|
+
/**
|
|
63
|
+
* Called when the user drops onto a target row or group header.
|
|
64
|
+
* `targetId` is the item id or `ConversationGroupKey` sentinel for header drops.
|
|
65
|
+
* `targetGroupKey` is the group the item was dropped into.
|
|
66
|
+
* `afterId` is the id of the item to insert after, or `null` for top of group.
|
|
67
|
+
*/
|
|
68
|
+
onDrop: (targetId: string, targetGroupKey: ConversationGroupKey, afterId: string | null) => void;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=virtual-row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual-row.d.ts","sourceRoot":"","sources":["../../src/models/virtual-row.ts"],"names":[],"mappings":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AAC;IACtB,wDAAwD;IACxD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,2DAA2D;IAC3D,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oEAAoE;IACpE,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,0FAA0F;IAC1F,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,qFAAqF;IACrF,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,mGAAmG;IACnG,iBAAiB,EAAE,GAAG,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC;IACpD,+DAA+D;IAC/D,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,kDAAkD;IAClD,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,gDAAgD;IAChD,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,gDAAgD;IAChD,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB;;;;;OAKG;IACH,MAAM,EAAE,CACN,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,oBAAoB,EACpC,OAAO,EAAE,MAAM,GAAG,IAAI,KACnB,IAAI,CAAC;CACX"}
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@epam/ai-dial-conversation-panel",
|
|
3
|
+
"version": "0.0.0-dev.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.js",
|
|
7
|
+
"module": "./index.js",
|
|
8
|
+
"types": "./index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
"./package.json": "./package.json",
|
|
11
|
+
"./styles.css": "./style.css",
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./index.d.ts",
|
|
14
|
+
"import": "./index.js",
|
|
15
|
+
"default": "./index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"react-window": "^2.2.7"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"react": "^19.0.0",
|
|
23
|
+
"@tabler/icons-react": "^3.0.0",
|
|
24
|
+
"@epam/ai-dial-chat-shared": "0.0.0-dev.0",
|
|
25
|
+
"@epam/ai-dial-ui-kit": "0.12.0-dev.21",
|
|
26
|
+
"@epam/ai-dial-sidebar": "0.0.0-dev.0"
|
|
27
|
+
}
|
|
28
|
+
}
|
package/test-setup.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=test-setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-setup.d.ts","sourceRoot":"","sources":["../src/test-setup.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Identifies one of the four collapsible groups in the conversation panel. */
|
|
2
|
+
export declare enum ConversationGroupKey {
|
|
3
|
+
Pinned = "pinned",
|
|
4
|
+
MyChats = "myChats",
|
|
5
|
+
Shared = "shared",
|
|
6
|
+
Organization = "organization"
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=conversation-group-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-group-key.d.ts","sourceRoot":"","sources":["../../src/types/conversation-group-key.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,oBAAY,oBAAoB;IAC9B,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,YAAY,iBAAiB;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-source.d.ts","sourceRoot":"","sources":["../../src/types/conversation-source.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,oBAAY,kBAAkB;IAC5B,OAAO,aAAa;IACpB,MAAM,WAAW;IACjB,YAAY,iBAAiB;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-tab.d.ts","sourceRoot":"","sources":["../../src/types/filter-tab.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,oBAAY,SAAS;IACnB,GAAG,QAAQ;IACX,OAAO,aAAa;IACpB,MAAM,WAAW;IACjB,YAAY,iBAAiB;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual-row.d.ts","sourceRoot":"","sources":["../../src/types/virtual-row.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,oBAAY,cAAc;IACxB,MAAM,WAAW;IACjB,IAAI,SAAS;CACd"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RowRendererData } from '../models/virtual-row';
|
|
2
|
+
export declare const SKELETON_ROW_COUNT = 15;
|
|
3
|
+
export declare const getSkeletonWidth: (i: number) => string;
|
|
4
|
+
/** Returns the inline-end padding Tailwind class for the row's ghost button based on action state. */
|
|
5
|
+
export declare const getButtonPaddingEnd: (hasActions: boolean, isMenuOpen: boolean) => string;
|
|
6
|
+
/**
|
|
7
|
+
* Returns the pixel height for a virtual list row.
|
|
8
|
+
*
|
|
9
|
+
* Items use `ITEM_ROW_HEIGHT` (32px content + 4px top gap).
|
|
10
|
+
* The first group header uses `FIRST_GROUP_HEADER_ROW_HEIGHT` (24px, no gap above).
|
|
11
|
+
* Subsequent group headers use `GROUP_HEADER_ROW_HEIGHT` (24px + 8px top gap).
|
|
12
|
+
*/
|
|
13
|
+
export declare const getRowHeight: (index: number, rowProps: RowRendererData) => number;
|
|
14
|
+
//# sourceMappingURL=conversation-row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-row.d.ts","sourceRoot":"","sources":["../../src/utils/conversation-row.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,eAAe,EAAkB,MAAM,uBAAuB,CAAC;AAE7E,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,eAAO,MAAM,gBAAgB,GAAI,GAAG,MAAM,WAA+B,CAAC;AAE1E,sGAAsG;AACtG,eAAO,MAAM,mBAAmB,GAC9B,YAAY,OAAO,EACnB,YAAY,OAAO,KAClB,MAIF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GACvB,OAAO,MAAM,EACb,UAAU,eAAe,KACxB,MAIF,CAAC"}
|
package/utils/drag.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DragEvent } from 'react';
|
|
2
|
+
import { ConversationHistoryItem } from '../models/panel-props';
|
|
3
|
+
import { VirtualRow } from '../models/virtual-row';
|
|
4
|
+
import { ConversationGroupKey } from '../types/conversation-group-key';
|
|
5
|
+
import { ConversationSource } from '../types/conversation-source';
|
|
6
|
+
/** Maps a `ConversationSource` to its corresponding `ConversationGroupKey`. */
|
|
7
|
+
export declare const sourceToGroupKey: (source?: ConversationSource) => ConversationGroupKey;
|
|
8
|
+
/** Returns the `ConversationGroupKey` of the virtual row containing the given item id. */
|
|
9
|
+
export declare const findGroupKeyForItem: (rows: VirtualRow[], id: string) => ConversationGroupKey | null;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the set of groups that are valid drop targets for the given dragged item.
|
|
12
|
+
*
|
|
13
|
+
* Rules:
|
|
14
|
+
* - Same group as the drag source is always allowed (reorder).
|
|
15
|
+
* - Any non-Pinned group → Pinned is allowed (pin action).
|
|
16
|
+
* - Pinned → non-Pinned is allowed only when the item's `source` matches the target group (unpin action).
|
|
17
|
+
*/
|
|
18
|
+
export declare const computeAllowedDropGroups: (draggedId: string, draggingGroupKey: ConversationGroupKey | null, conversations: ConversationHistoryItem[]) => Set<ConversationGroupKey>;
|
|
19
|
+
/**
|
|
20
|
+
* Computes the `afterId` for a drop based on cursor vertical position within a row.
|
|
21
|
+
*
|
|
22
|
+
* - Bottom half of the row → insert after the item (`afterId = itemId`).
|
|
23
|
+
* - Top half → insert before the item (`afterId` = id of the preceding item in the group, or `null` for first).
|
|
24
|
+
*/
|
|
25
|
+
export declare const getDropAfterId: (e: Pick<DragEvent, "currentTarget" | "clientY">, itemId: string, rows: VirtualRow[], targetGroupKey: ConversationGroupKey) => string | null;
|
|
26
|
+
//# sourceMappingURL=drag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drag.d.ts","sourceRoot":"","sources":["../../src/utils/drag.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAGlE,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,GAC3B,SAAS,kBAAkB,KAC1B,oBASF,CAAC;AAEF,0FAA0F;AAC1F,eAAO,MAAM,mBAAmB,GAC9B,MAAM,UAAU,EAAE,EAClB,IAAI,MAAM,KACT,oBAAoB,GAAG,IAUzB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,GACnC,WAAW,MAAM,EACjB,kBAAkB,oBAAoB,GAAG,IAAI,EAC7C,eAAe,uBAAuB,EAAE,KACvC,GAAG,CAAC,oBAAoB,CAiB1B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GACzB,GAAG,IAAI,CAAC,SAAS,EAAE,eAAe,GAAG,SAAS,CAAC,EAC/C,QAAQ,MAAM,EACd,MAAM,UAAU,EAAE,EAClB,gBAAgB,oBAAoB,KACnC,MAAM,GAAG,IAkBX,CAAC"}
|