@openviking/react 0.1.8-beta.10.1.g8e5299efeb0a → 0.1.8-beta.12.1.g83d24ca4fc6f
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/3c~0.js +20 -9
- package/dist/ark-message-list-view~0.js +50 -8
- package/dist/a~0.js +4 -1
- package/dist/components/style.css +154 -21
- package/dist/components/tui/index.d.ts +1 -0
- package/dist/components/tui/tui-empty.d.ts +4 -3
- package/dist/components/tui/types.d.ts +15 -8
- package/dist/components/viking-bot/bot-popover.d.ts +2 -1
- package/dist/components/viking-bot/composer-reference-tags.d.ts +8 -0
- package/dist/components/viking-bot/composer-references.d.ts +0 -5
- package/dist/components/viking-bot/locales/en-US.d.ts +1 -0
- package/dist/components/viking-bot/locales/zh-CN.d.ts +1 -0
- package/dist/components/viking-bot/model.d.ts +1 -0
- package/dist/components/viking-bot/popover-tab-navigation.d.ts +3 -0
- package/dist/components/viking-bot/style.css +154 -21
- package/dist/components/viking-bot/types.d.ts +3 -1
- package/dist/components/viking-bot/user-message-group.d.ts +9 -0
- package/dist/c~0.js +77 -6
- package/dist/icons/viking-bot-icons.d.ts +1 -1
- package/dist/lg~0.js +41 -1
- package/dist/modules/console/style.css +154 -21
- package/dist/modules/console/types.d.ts +9 -7
- package/dist/modules/style.css +154 -21
- package/dist/style.css +308 -42
- package/dist/viking-bot-composer~0.js +86 -29
- package/package.json +1 -1
|
@@ -703,7 +703,6 @@ html.dark .ov-wiki-dashboard, html.dark .ov-experience-dashboard, html.dark .ov-
|
|
|
703
703
|
border: 1px solid var(--ov-viking-bot-border);
|
|
704
704
|
border-radius: var(--ov-viking-bot-radius);
|
|
705
705
|
max-width: 100%;
|
|
706
|
-
color: var(--ov-viking-bot-accent);
|
|
707
706
|
font: inherit;
|
|
708
707
|
overflow-wrap: anywhere;
|
|
709
708
|
cursor: pointer;
|
|
@@ -713,6 +712,14 @@ html.dark .ov-wiki-dashboard, html.dark .ov-experience-dashboard, html.dark .ov-
|
|
|
713
712
|
font-size: 12px;
|
|
714
713
|
}
|
|
715
714
|
|
|
715
|
+
.ov-viking-bot__context {
|
|
716
|
+
color: var(--ov-viking-bot-accent);
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
.ov-viking-bot__attachment {
|
|
720
|
+
color: var(--ov-ui-color-text-2, var(--ov-ui-text-2-default));
|
|
721
|
+
}
|
|
722
|
+
|
|
716
723
|
.ov-viking-bot__context:hover, .ov-viking-bot__attachment:hover {
|
|
717
724
|
background: var(--ov-viking-bot-surface-hover);
|
|
718
725
|
}
|
|
@@ -2489,6 +2496,23 @@ textarea.ov-viking-bot__interaction-input {
|
|
|
2489
2496
|
}
|
|
2490
2497
|
}
|
|
2491
2498
|
|
|
2499
|
+
/*!
|
|
2500
|
+
* Copyright (c) 2026 Bytedance, Inc. and its affiliates.
|
|
2501
|
+
* SPDX-License-Identifier: MIT
|
|
2502
|
+
*/
|
|
2503
|
+
/*!
|
|
2504
|
+
* Copyright (c) 2026 Bytedance, Inc. and its affiliates.
|
|
2505
|
+
* SPDX-License-Identifier: MIT
|
|
2506
|
+
*/
|
|
2507
|
+
.ark-agentic-user-message-file-list-user-message-file-list-1 {
|
|
2508
|
+
justify-content: flex-end;
|
|
2509
|
+
align-items: flex-start;
|
|
2510
|
+
gap: .5rem;
|
|
2511
|
+
width: 100%;
|
|
2512
|
+
display: flex;
|
|
2513
|
+
overflow: auto hidden;
|
|
2514
|
+
}
|
|
2515
|
+
|
|
2492
2516
|
/*!
|
|
2493
2517
|
* Copyright (c) 2026 Bytedance, Inc. and its affiliates.
|
|
2494
2518
|
* SPDX-License-Identifier: MIT
|
|
@@ -9062,54 +9086,134 @@ html.dark .ov-wiki-dashboard, html.dark .ov-experience-dashboard, html.dark .ov-
|
|
|
9062
9086
|
outline: none;
|
|
9063
9087
|
}
|
|
9064
9088
|
|
|
9065
|
-
.ov-viking-
|
|
9066
|
-
|
|
9089
|
+
.ov-viking-bot__quick-inputs button:not(.ov-button):focus-visible, .ov-viking-bot__session-history button:not(.ov-button):focus-visible {
|
|
9090
|
+
outline: 2px solid var(--ov-ui-color-focus, var(--ov-ui-focus-default));
|
|
9091
|
+
outline-offset: 2px;
|
|
9092
|
+
}
|
|
9093
|
+
|
|
9094
|
+
.ov-viking-bot__quick-inputs button:not(.ov-button):disabled {
|
|
9095
|
+
opacity: .5;
|
|
9096
|
+
cursor: not-allowed;
|
|
9097
|
+
}
|
|
9098
|
+
|
|
9099
|
+
.ov-viking-bot__attach > svg {
|
|
9100
|
+
width: 10.208px;
|
|
9101
|
+
height: 10.208px;
|
|
9102
|
+
}
|
|
9103
|
+
|
|
9104
|
+
.ov-viking-bot__reference-tags, .ov-viking-bot__reference-overflow {
|
|
9105
|
+
flex-direction: column;
|
|
9106
|
+
align-items: flex-start;
|
|
9067
9107
|
gap: 6px;
|
|
9068
|
-
|
|
9069
|
-
padding: 0;
|
|
9070
|
-
list-style: none;
|
|
9108
|
+
min-width: 0;
|
|
9071
9109
|
display: flex;
|
|
9072
9110
|
}
|
|
9073
9111
|
|
|
9074
|
-
.ov-viking-bot__reference-tags
|
|
9075
|
-
|
|
9076
|
-
|
|
9112
|
+
.ov-viking-bot__reference-tags {
|
|
9113
|
+
margin-bottom: 10px;
|
|
9114
|
+
}
|
|
9115
|
+
|
|
9116
|
+
.ov-viking-bot__reference-row {
|
|
9077
9117
|
align-items: center;
|
|
9078
9118
|
gap: 4px;
|
|
9079
9119
|
min-width: 0;
|
|
9080
9120
|
max-width: 100%;
|
|
9081
|
-
|
|
9121
|
+
display: flex;
|
|
9122
|
+
}
|
|
9123
|
+
|
|
9124
|
+
.ov-viking-bot__reference-tag, .ov-viking-bot__reference-more {
|
|
9125
|
+
box-sizing: border-box;
|
|
9126
|
+
background: var(--ov-ui-color-bg-3, var(--ov-ui-bg-3-default));
|
|
9127
|
+
max-width: 100%;
|
|
9128
|
+
height: 26px;
|
|
9129
|
+
color: var(--ov-ui-color-text-2, var(--ov-ui-text-2-default));
|
|
9130
|
+
letter-spacing: .036px;
|
|
9131
|
+
border: 0;
|
|
9132
|
+
border-radius: 6px;
|
|
9133
|
+
align-items: center;
|
|
9134
|
+
gap: 4px;
|
|
9135
|
+
padding: 3px 8px;
|
|
9136
|
+
font-family: Roboto, PingFang SC, sans-serif;
|
|
9137
|
+
font-size: 12px;
|
|
9138
|
+
font-weight: 400;
|
|
9139
|
+
line-height: 20px;
|
|
9082
9140
|
display: inline-flex;
|
|
9083
9141
|
}
|
|
9084
9142
|
|
|
9085
|
-
.ov-viking-bot__reference-
|
|
9143
|
+
.ov-viking-bot__reference-tag {
|
|
9144
|
+
min-width: 0;
|
|
9145
|
+
}
|
|
9146
|
+
|
|
9147
|
+
.ov-viking-bot__reference-tag > svg {
|
|
9148
|
+
flex-shrink: 0;
|
|
9149
|
+
}
|
|
9150
|
+
|
|
9151
|
+
.ov-viking-bot__reference-icon {
|
|
9152
|
+
color: var(--ov-ui-viking-bot-reference-icon-light);
|
|
9153
|
+
}
|
|
9154
|
+
|
|
9155
|
+
.dark .ov-viking-bot__reference-icon {
|
|
9156
|
+
color: var(--ov-ui-viking-bot-reference-icon-dark);
|
|
9157
|
+
}
|
|
9158
|
+
|
|
9159
|
+
.ov-viking-bot__reference-path {
|
|
9086
9160
|
text-overflow: ellipsis;
|
|
9087
9161
|
white-space: nowrap;
|
|
9088
9162
|
min-width: 0;
|
|
9089
9163
|
overflow: hidden;
|
|
9090
9164
|
}
|
|
9091
9165
|
|
|
9092
|
-
.ov-viking-bot__reference-
|
|
9166
|
+
.ov-viking-bot__reference-open {
|
|
9167
|
+
min-width: 0;
|
|
9093
9168
|
color: inherit;
|
|
9169
|
+
font: inherit;
|
|
9170
|
+
text-align: start;
|
|
9094
9171
|
cursor: pointer;
|
|
9095
9172
|
background: none;
|
|
9096
9173
|
border: 0;
|
|
9097
|
-
padding: 0
|
|
9174
|
+
padding: 0;
|
|
9175
|
+
display: inline-flex;
|
|
9176
|
+
overflow: hidden;
|
|
9098
9177
|
}
|
|
9099
9178
|
|
|
9100
|
-
.ov-viking-
|
|
9179
|
+
.ov-viking-bot__reference-open:hover {
|
|
9180
|
+
color: var(--ov-ui-color-primary, var(--ov-ui-primary-default));
|
|
9181
|
+
}
|
|
9182
|
+
|
|
9183
|
+
.ov-viking-bot__reference-remove {
|
|
9184
|
+
width: 14px;
|
|
9185
|
+
height: 14px;
|
|
9186
|
+
color: var(--ov-ui-color-text-3, var(--ov-ui-text-3-default));
|
|
9187
|
+
cursor: pointer;
|
|
9188
|
+
background: none;
|
|
9189
|
+
border: 0;
|
|
9190
|
+
border-radius: 2px;
|
|
9191
|
+
flex-shrink: 0;
|
|
9192
|
+
justify-content: center;
|
|
9193
|
+
align-items: center;
|
|
9194
|
+
padding: 0;
|
|
9195
|
+
display: inline-flex;
|
|
9196
|
+
}
|
|
9197
|
+
|
|
9198
|
+
.ov-viking-bot__reference-more {
|
|
9199
|
+
cursor: pointer;
|
|
9200
|
+
flex-shrink: 0;
|
|
9201
|
+
}
|
|
9202
|
+
|
|
9203
|
+
.ov-viking-bot__reference-open:focus-visible, .ov-viking-bot__reference-more:focus-visible, .ov-viking-bot__reference-remove:focus-visible {
|
|
9101
9204
|
outline: 2px solid var(--ov-ui-color-focus, var(--ov-ui-focus-default));
|
|
9102
9205
|
outline-offset: 2px;
|
|
9103
9206
|
}
|
|
9104
9207
|
|
|
9105
|
-
.ov-viking-
|
|
9106
|
-
opacity: .5;
|
|
9208
|
+
.ov-viking-bot__reference-remove:disabled {
|
|
9107
9209
|
cursor: not-allowed;
|
|
9210
|
+
opacity: .5;
|
|
9108
9211
|
}
|
|
9109
9212
|
|
|
9110
|
-
.ov-viking-
|
|
9111
|
-
width:
|
|
9112
|
-
height:
|
|
9213
|
+
.ov-viking-bot__reference-overflow {
|
|
9214
|
+
max-width: min(440px, 100vw - 48px);
|
|
9215
|
+
max-height: min(360px, 50vh);
|
|
9216
|
+
overflow-y: auto;
|
|
9113
9217
|
}
|
|
9114
9218
|
|
|
9115
9219
|
.ov-viking-bot__list {
|
|
@@ -9130,6 +9234,15 @@ html.dark .ov-wiki-dashboard, html.dark .ov-experience-dashboard, html.dark .ov-
|
|
|
9130
9234
|
padding-left: 32px;
|
|
9131
9235
|
}
|
|
9132
9236
|
|
|
9237
|
+
.ov-viking-bot__user-message-group {
|
|
9238
|
+
flex-direction: column;
|
|
9239
|
+
align-items: flex-end;
|
|
9240
|
+
gap: 6px;
|
|
9241
|
+
width: min(88%, 960px);
|
|
9242
|
+
max-width: 100%;
|
|
9243
|
+
display: flex;
|
|
9244
|
+
}
|
|
9245
|
+
|
|
9133
9246
|
.ov-viking-bot__user-bubble {
|
|
9134
9247
|
--agentic-bubble-content-max-width: 100%;
|
|
9135
9248
|
--agentic-bubble-content-filled-bg: var(--ov-ui-color-bg-3, var(--ov-ui-bg-3-default));
|
|
@@ -9138,10 +9251,30 @@ html.dark .ov-wiki-dashboard, html.dark .ov-experience-dashboard, html.dark .ov-
|
|
|
9138
9251
|
--agentic-bubble-content-radius-default: 16px;
|
|
9139
9252
|
--agentic-bubble-content-font-size: 14px;
|
|
9140
9253
|
--agentic-bubble-content-line-height: 22px;
|
|
9141
|
-
width: min(88%, 960px);
|
|
9142
9254
|
max-width: 100%;
|
|
9143
9255
|
}
|
|
9144
9256
|
|
|
9257
|
+
.ov-viking-bot__user-message-content {
|
|
9258
|
+
flex-direction: column;
|
|
9259
|
+
align-items: flex-start;
|
|
9260
|
+
gap: 6px;
|
|
9261
|
+
width: max-content;
|
|
9262
|
+
max-width: 100%;
|
|
9263
|
+
display: flex;
|
|
9264
|
+
}
|
|
9265
|
+
|
|
9266
|
+
.ov-viking-bot__user-message-attachments {
|
|
9267
|
+
flex-wrap: wrap;
|
|
9268
|
+
justify-content: flex-end;
|
|
9269
|
+
align-self: flex-end;
|
|
9270
|
+
align-items: center;
|
|
9271
|
+
gap: 8px;
|
|
9272
|
+
width: 100%;
|
|
9273
|
+
max-width: 100%;
|
|
9274
|
+
display: flex;
|
|
9275
|
+
overflow: visible;
|
|
9276
|
+
}
|
|
9277
|
+
|
|
9145
9278
|
.ov-viking-bot__user-bubble .ark-agentic-bubble__content {
|
|
9146
9279
|
inline-size: max-content;
|
|
9147
9280
|
max-inline-size: 100%;
|
|
@@ -9187,7 +9320,7 @@ html.dark .ov-wiki-dashboard, html.dark .ov-experience-dashboard, html.dark .ov-
|
|
|
9187
9320
|
display: inline-flex;
|
|
9188
9321
|
}
|
|
9189
9322
|
|
|
9190
|
-
.ov-viking-bot__message:hover .ov-viking-bot__message-footer, .ov-viking-bot__message:focus-within .ov-viking-bot__message-footer {
|
|
9323
|
+
.ov-viking-bot__message:not(.ov-viking-bot__message--user):hover .ov-viking-bot__message-footer, .ov-viking-bot__message:not(.ov-viking-bot__message--user):focus-within .ov-viking-bot__message-footer, .ov-viking-bot__user-message-group:hover .ov-viking-bot__message-footer, .ov-viking-bot__user-message-group:focus-within .ov-viking-bot__message-footer {
|
|
9191
9324
|
opacity: 1;
|
|
9192
9325
|
pointer-events: auto;
|
|
9193
9326
|
}
|
|
@@ -73,6 +73,8 @@ export interface VikingBotComposerProps extends VikingBotInputFeatures {
|
|
|
73
73
|
onFilesAdded?: (files: readonly File[]) => void;
|
|
74
74
|
/** 移除一个附件。Removes an attachment. */
|
|
75
75
|
onAttachmentRemove?: (attachment: VikingBotAttachment) => void;
|
|
76
|
+
/** 打开已选中的文件或目录引用。Opens a selected file or directory reference. */
|
|
77
|
+
onOpenUri?: (uri: string) => void;
|
|
76
78
|
/** 上报发送意图;由宿主发送并清空草稿。省略时不能发送。Reports the send intent. */
|
|
77
79
|
onSend?: (draft: VikingBotDraft) => void;
|
|
78
80
|
/** 停止正在进行的回复。省略时不展示停止动作。Stops the streaming reply. */
|
|
@@ -141,7 +143,7 @@ export interface VikingBotProps extends VikingBotInputFeatures, Omit<HTMLAttribu
|
|
|
141
143
|
onSend?: (draft: VikingBotDraft) => void;
|
|
142
144
|
/** 停止正在进行的回复。Stops the streaming reply. */
|
|
143
145
|
onCancel?: () => void;
|
|
144
|
-
/**
|
|
146
|
+
/** 打开消息资源或输入区引用。Opens a message resource or composer reference. */
|
|
145
147
|
onOpenUri?: (uri: string) => void;
|
|
146
148
|
/** 复制由宿主执行,组件只上报意图。The host copies; the component reports intent. */
|
|
147
149
|
onCopy?: (text: string) => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { VikingBotMessage } from './model.js';
|
|
3
|
+
import type { VikingBotMessageListProps } from './types.js';
|
|
4
|
+
export declare function UserMessageGroup({ message, labels, footer, onOpenUri, }: {
|
|
5
|
+
message: VikingBotMessage;
|
|
6
|
+
labels: NonNullable<VikingBotMessageListProps['labels']>;
|
|
7
|
+
footer: ReactNode;
|
|
8
|
+
onOpenUri?: (uri: string) => void;
|
|
9
|
+
}): import("react").JSX.Element | null;
|
package/dist/c~0.js
CHANGED
|
@@ -22,6 +22,7 @@ const en_US_messages = {
|
|
|
22
22
|
searchReferences: 'Search files and directories',
|
|
23
23
|
emptyReferences: 'No matching files or directories',
|
|
24
24
|
removeReference: 'Remove reference',
|
|
25
|
+
openReference: 'Open {uri}',
|
|
25
26
|
expandReference: 'Expand {name}',
|
|
26
27
|
collapseReference: 'Collapse {name}',
|
|
27
28
|
welcomeTitle: 'Welcome to VikingBot',
|
|
@@ -62,6 +63,7 @@ const zh_CN_messages = {
|
|
|
62
63
|
searchReferences: '搜索文件或目录',
|
|
63
64
|
emptyReferences: '暂无匹配的文件或目录',
|
|
64
65
|
removeReference: '移除引用',
|
|
66
|
+
openReference: '打开 {uri}',
|
|
65
67
|
expandReference: '展开 {name}',
|
|
66
68
|
collapseReference: '收起 {name}',
|
|
67
69
|
welcomeTitle: '欢迎使用 VikingBot',
|
|
@@ -95,20 +97,82 @@ const DEFAULT_LABELS = en_US;
|
|
|
95
97
|
function resolveVikingBotLabels(locale, labels) {
|
|
96
98
|
return resolveLocale(LOCALES, locale, labels);
|
|
97
99
|
}
|
|
100
|
+
function navigatePopoverTab(event, anchor, surface, close) {
|
|
101
|
+
if ('Tab' !== event.key || event.altKey || event.ctrlKey || event.metaKey) return;
|
|
102
|
+
const trigger = anchor?.querySelector('button');
|
|
103
|
+
const controls = [
|
|
104
|
+
...surface?.querySelectorAll('button, a[href], input, select, textarea, [tabindex], [contenteditable="true"]') ?? []
|
|
105
|
+
].filter((element)=>element.tabIndex >= 0 && !element.matches(':disabled'));
|
|
106
|
+
const first = controls[0];
|
|
107
|
+
const last = controls.at(-1);
|
|
108
|
+
const destination = event.shiftKey || event.target !== trigger ? event.shiftKey && event.target === first ? trigger : void 0 : first;
|
|
109
|
+
if (destination) {
|
|
110
|
+
event.preventDefault();
|
|
111
|
+
event.stopPropagation();
|
|
112
|
+
destination.focus();
|
|
113
|
+
} else if (!event.shiftKey && event.target === last) {
|
|
114
|
+
event.stopPropagation();
|
|
115
|
+
close();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
98
118
|
const subscribe = ()=>()=>{};
|
|
99
|
-
function BotPopover({ label, trigger: renderTrigger, children, placement = 'bottom', onOpen }) {
|
|
119
|
+
function BotPopover({ label, trigger: renderTrigger, children, placement = 'bottom', onOpen, hover = false }) {
|
|
100
120
|
const mounted = useSyncExternalStore(subscribe, ()=>true, ()=>false);
|
|
101
121
|
const native = mounted && 'popover' in HTMLElement.prototype;
|
|
102
122
|
const [open, setOpen] = useState(false);
|
|
103
123
|
const [surface, setSurface] = useState(null);
|
|
104
124
|
const anchor = useRef(null);
|
|
125
|
+
const dismissTimer = useRef(void 0);
|
|
126
|
+
const skipFocus = useRef(false);
|
|
105
127
|
const id = useId();
|
|
106
128
|
const position = useOverlayPosition(open, anchor, surface, placement, 'end');
|
|
107
|
-
const
|
|
129
|
+
const cancelDismiss = ()=>window.clearTimeout(dismissTimer.current);
|
|
130
|
+
const hide = ()=>{
|
|
131
|
+
cancelDismiss();
|
|
108
132
|
if (native) surface?.hidePopover();
|
|
109
133
|
else setOpen(false);
|
|
134
|
+
};
|
|
135
|
+
const show = ()=>{
|
|
136
|
+
cancelDismiss();
|
|
137
|
+
if (native) surface?.showPopover({
|
|
138
|
+
source: anchor.current?.querySelector('button') ?? void 0
|
|
139
|
+
});
|
|
140
|
+
else {
|
|
141
|
+
setOpen(true);
|
|
142
|
+
if (!open) onOpen?.();
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
const close = ()=>{
|
|
146
|
+
skipFocus.current = true;
|
|
147
|
+
hide();
|
|
110
148
|
anchor.current?.querySelector('button')?.focus();
|
|
149
|
+
skipFocus.current = false;
|
|
111
150
|
};
|
|
151
|
+
const interest = hover ? {
|
|
152
|
+
onMouseEnter: show,
|
|
153
|
+
onMouseLeave: ()=>{
|
|
154
|
+
cancelDismiss();
|
|
155
|
+
dismissTimer.current = window.setTimeout(()=>{
|
|
156
|
+
if (!anchor.current?.contains(document.activeElement) && !surface?.contains(document.activeElement)) hide();
|
|
157
|
+
}, 100);
|
|
158
|
+
},
|
|
159
|
+
onFocus: ()=>{
|
|
160
|
+
if (!skipFocus.current) show();
|
|
161
|
+
},
|
|
162
|
+
onBlur: (event)=>{
|
|
163
|
+
const next = event.relatedTarget;
|
|
164
|
+
if (next && !anchor.current?.contains(next) && !surface?.contains(next)) hide();
|
|
165
|
+
},
|
|
166
|
+
onKeyDown: (event)=>{
|
|
167
|
+
if (open && !native) navigatePopoverTab(event, anchor.current, surface, close);
|
|
168
|
+
if (open && 'Escape' === event.key) {
|
|
169
|
+
event.preventDefault();
|
|
170
|
+
event.stopPropagation();
|
|
171
|
+
close();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
} : {};
|
|
175
|
+
useEffect(()=>()=>window.clearTimeout(dismissTimer.current), []);
|
|
112
176
|
useEffect(()=>{
|
|
113
177
|
if (!surface) return;
|
|
114
178
|
const toggle = ()=>{
|
|
@@ -124,11 +188,12 @@ function BotPopover({ label, trigger: renderTrigger, children, placement = 'bott
|
|
|
124
188
|
onOpen
|
|
125
189
|
]);
|
|
126
190
|
useEffect(()=>{
|
|
127
|
-
if (!open) return;
|
|
191
|
+
if (!open || hover) return;
|
|
128
192
|
(surface?.querySelector('input, button') ?? surface)?.focus();
|
|
129
193
|
}, [
|
|
130
194
|
open,
|
|
131
|
-
surface
|
|
195
|
+
surface,
|
|
196
|
+
hover
|
|
132
197
|
]);
|
|
133
198
|
useEffect(()=>{
|
|
134
199
|
if (native || !open) return;
|
|
@@ -158,13 +223,17 @@ function BotPopover({ label, trigger: renderTrigger, children, placement = 'bott
|
|
|
158
223
|
return /*#__PURE__*/ jsxs("span", {
|
|
159
224
|
className: "ov-viking-bot__popover-anchor",
|
|
160
225
|
ref: anchor,
|
|
226
|
+
...interest,
|
|
161
227
|
children: [
|
|
162
228
|
renderTrigger({
|
|
163
229
|
...invoker,
|
|
164
230
|
'aria-haspopup': 'dialog',
|
|
165
231
|
'aria-controls': id,
|
|
166
232
|
'aria-expanded': open,
|
|
167
|
-
onClick:
|
|
233
|
+
onClick: hover ? (event)=>{
|
|
234
|
+
event.preventDefault();
|
|
235
|
+
show();
|
|
236
|
+
} : native ? void 0 : ()=>{
|
|
168
237
|
setOpen(!open);
|
|
169
238
|
if (!open) onOpen?.();
|
|
170
239
|
}
|
|
@@ -172,7 +241,7 @@ function BotPopover({ label, trigger: renderTrigger, children, placement = 'bott
|
|
|
172
241
|
mounted ? /*#__PURE__*/ createPortal(/*#__PURE__*/ jsx("div", {
|
|
173
242
|
ref: setSurface,
|
|
174
243
|
id: id,
|
|
175
|
-
popover:
|
|
244
|
+
popover: native ? 'auto' : void 0,
|
|
176
245
|
role: "dialog",
|
|
177
246
|
tabIndex: -1,
|
|
178
247
|
"aria-label": label,
|
|
@@ -182,6 +251,7 @@ function BotPopover({ label, trigger: renderTrigger, children, placement = 'bott
|
|
|
182
251
|
top: position.top,
|
|
183
252
|
left: position.left
|
|
184
253
|
},
|
|
254
|
+
...interest,
|
|
185
255
|
children: open ? children(close) : null
|
|
186
256
|
}), document.body) : null
|
|
187
257
|
]
|
|
@@ -678,6 +748,7 @@ function VikingBot({ messages, className, streaming, draft, attachments, isSendi
|
|
|
678
748
|
} : void 0,
|
|
679
749
|
onFilesAdded: onFilesAdded,
|
|
680
750
|
onAttachmentRemove: onAttachmentRemove,
|
|
751
|
+
onOpenUri: onOpenUri,
|
|
681
752
|
onSend: onSend,
|
|
682
753
|
onCancel: onCancel,
|
|
683
754
|
labels: overrides
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SVGProps } from 'react';
|
|
2
|
-
export type VikingBotIconName = 'bulb' | 'book' | 'video' | 'report' | 'history' | 'newSession' | 'remove' | 'tool';
|
|
2
|
+
export type VikingBotIconName = 'bulb' | 'book' | 'video' | 'report' | 'history' | 'newSession' | 'remove' | 'tool' | 'contextFolder' | 'contextClose';
|
|
3
3
|
/** Reference artwork and the local remove glyph. See packages/icons/README.md. */
|
|
4
4
|
export declare function VikingBotIcon({ name, 'aria-label': ariaLabel, ...props }: SVGProps<SVGSVGElement> & {
|
|
5
5
|
name: VikingBotIconName;
|
package/dist/lg~0.js
CHANGED
|
@@ -131,6 +131,44 @@ const SvgTool = (props)=>/*#__PURE__*/ jsx("svg", {
|
|
|
131
131
|
})
|
|
132
132
|
});
|
|
133
133
|
const toolreact = SvgTool;
|
|
134
|
+
const SvgContextFolder = (props)=>/*#__PURE__*/ jsx("svg", {
|
|
135
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
136
|
+
width: 14,
|
|
137
|
+
height: 14,
|
|
138
|
+
fill: "none",
|
|
139
|
+
overflow: "visible",
|
|
140
|
+
preserveAspectRatio: "none",
|
|
141
|
+
style: {
|
|
142
|
+
display: "block"
|
|
143
|
+
},
|
|
144
|
+
viewBox: "0 0 14 14",
|
|
145
|
+
...props,
|
|
146
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
147
|
+
fill: "currentColor",
|
|
148
|
+
d: "M11.9 6.275H2.635v2.357c0 .473 0 .8.02 1.056.021.25.059.39.112.495l.047.085c.118.19.286.347.487.45l.086.036c.096.035.222.06.41.075.255.02.583.021 1.055.021h4.83c.473 0 .8 0 1.056-.021.25-.02.39-.058.495-.112l.085-.047c.19-.117.347-.286.45-.486l.036-.087c.034-.095.06-.222.075-.41.02-.254.021-.582.021-1.055zm.884 2.357c0 .459.001.829-.023 1.128a2.3 2.3 0 0 1-.162.73l-.044.095a2.1 2.1 0 0 1-.775.84l-.145.08c-.25.128-.52.18-.825.206-.3.024-.67.024-1.128.024h-4.83c-.458 0-.828 0-1.128-.024a2.3 2.3 0 0 1-.73-.162l-.095-.044a2.1 2.1 0 0 1-.839-.775l-.08-.145c-.128-.25-.181-.52-.206-.825-.025-.3-.024-.67-.024-1.128v-3.78c0-.458 0-.828.024-1.128.025-.304.078-.574.206-.825l.08-.145c.203-.33.493-.598.84-.774l.094-.045c.224-.096.464-.14.73-.161.3-.025.67-.024 1.128-.024h.487c.1 0 .17 0 .237.004l.176.019c.406.059.787.236 1.096.51l.17.167c.078.079.105.105.13.128l.079.065c.19.143.42.228.658.242l.183.003h1.614c.459 0 .829-.001 1.128.023.305.025.575.079.825.206l.145.08c.33.203.598.493.775.84l.044.095c.096.223.14.463.162.73.024.3.024.67.024 1.128zM2.634 5.39h9.263a7 7 0 0 0-.018-.456 1.6 1.6 0 0 0-.075-.41l-.037-.085a1.2 1.2 0 0 0-.45-.487l-.084-.047c-.104-.054-.245-.091-.495-.112-.255-.02-.583-.02-1.056-.02H8.068l-.237-.005a2.1 2.1 0 0 1-1.135-.418l-.136-.112c-.051-.045-.1-.094-.17-.166l-.131-.128c-.179-.16-.4-.262-.636-.296l-.1-.011c-.035-.002-.073-.002-.184-.002h-.487c-.472 0-.8 0-1.055.02-.188.016-.314.041-.41.075l-.086.037c-.2.103-.37.259-.487.45l-.047.084c-.053.105-.09.246-.111.496-.021.255-.021.583-.021 1.055z"
|
|
149
|
+
})
|
|
150
|
+
});
|
|
151
|
+
const context_folderreact = SvgContextFolder;
|
|
152
|
+
const SvgContextClose = (props)=>/*#__PURE__*/ jsx("svg", {
|
|
153
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
154
|
+
width: 14,
|
|
155
|
+
height: 14,
|
|
156
|
+
fill: "none",
|
|
157
|
+
overflow: "visible",
|
|
158
|
+
preserveAspectRatio: "none",
|
|
159
|
+
style: {
|
|
160
|
+
display: "block"
|
|
161
|
+
},
|
|
162
|
+
viewBox: "0 0 14 14",
|
|
163
|
+
...props,
|
|
164
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
165
|
+
stroke: "currentColor",
|
|
166
|
+
strokeLinecap: "round",
|
|
167
|
+
strokeLinejoin: "round",
|
|
168
|
+
d: "M10.5 3.5 7 7m0 0-3.5 3.5M7 7 3.5 3.5M7 7l3.5 3.5"
|
|
169
|
+
})
|
|
170
|
+
});
|
|
171
|
+
const context_closereact = SvgContextClose;
|
|
134
172
|
const icons = {
|
|
135
173
|
bulb: bulbreact,
|
|
136
174
|
book: bookreact,
|
|
@@ -139,7 +177,9 @@ const icons = {
|
|
|
139
177
|
history: historyreact,
|
|
140
178
|
newSession: new_sessionreact,
|
|
141
179
|
remove: removereact,
|
|
142
|
-
tool: toolreact
|
|
180
|
+
tool: toolreact,
|
|
181
|
+
contextFolder: context_folderreact,
|
|
182
|
+
contextClose: context_closereact
|
|
143
183
|
};
|
|
144
184
|
function VikingBotIcon({ name, 'aria-label': ariaLabel, ...props }) {
|
|
145
185
|
const Icon = icons[name];
|