@vokality/design-system 4.0.1 → 5.0.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/CHANGELOG.md +23 -0
- package/README.md +2 -2
- package/dist/chat.d.ts +65 -2
- package/dist/components/ChatInbox/ChatInbox.d.ts +3 -1
- package/dist/components/ChatInbox/ChatInbox.js +3 -2
- package/dist/components/ChatPanel/ChatPanel.d.ts +1 -1
- package/dist/components/ChatPanel/ChatPanel.js +2 -2
- package/dist/components/ChatPanel/activity.d.ts +6 -0
- package/dist/components/ChatPanel/activity.js +102 -0
- package/dist/components/ChatPanel/transcript.d.ts +3 -3
- package/dist/components/ChatPanel/transcript.js +5 -4
- package/dist/components.css +59 -4
- package/dist/internal/useThrottled.d.ts +2 -0
- package/dist/internal/useThrottled.js +17 -0
- package/dist/localization.d.ts +13 -0
- package/dist/localization.js +13 -1
- package/dist/vokality.css +59 -4
- package/dist/vokality.iife.js +475 -96
- package/docs/components/ChatInbox/README.md +24 -7
- package/docs/components/ChatWidget/README.md +48 -7
- package/package.json +1 -1
- package/skills/vokality-design-system/SKILL.md +2 -2
- package/skills/vokality-design-system/references/examples.tsx +8 -8
package/dist/vokality.iife.js
CHANGED
|
@@ -14349,7 +14349,20 @@ Defaulting to \`null\`.`;
|
|
|
14349
14349
|
chooseThread: "Choose a conversation to read and reply.",
|
|
14350
14350
|
noThreads: "No conversations yet.",
|
|
14351
14351
|
conversations: "Conversations",
|
|
14352
|
-
unread: (count) => String(count) + (count === 1 ? " unread message" : " unread messages")
|
|
14352
|
+
unread: (count) => String(count) + (count === 1 ? " unread message" : " unread messages"),
|
|
14353
|
+
readOnly: "Replies aren't available in this conversation.",
|
|
14354
|
+
activityWorking: "Working",
|
|
14355
|
+
activityWaiting: "Waiting",
|
|
14356
|
+
activityFinished: "Finished",
|
|
14357
|
+
activityFailed: "Failed",
|
|
14358
|
+
activityStopped: "Stopped",
|
|
14359
|
+
stepStarted: "In progress",
|
|
14360
|
+
stepFailed: "Failed",
|
|
14361
|
+
stepKeptRunning: "Kept running",
|
|
14362
|
+
earlierEntries: (count) => formatNumber(count, { locale: "en-US" }) + (count === 1 ? " earlier entry" : " earlier entries"),
|
|
14363
|
+
omittedSteps: (count) => "and " + formatNumber(count, { locale: "en-US" }) + (count === 1 ? " more step" : " more steps"),
|
|
14364
|
+
activityStep: (title, step, state) => title + ": " + step + (state ? " (" + state + ")" : ""),
|
|
14365
|
+
activityStatus: (title, state) => title + ": " + state
|
|
14353
14366
|
},
|
|
14354
14367
|
richText: {
|
|
14355
14368
|
formatting: "Formatting options",
|
|
@@ -14489,7 +14502,20 @@ Defaulting to \`null\`.`;
|
|
|
14489
14502
|
chooseThread: "Kies een gesprek om te lezen en te antwoorden.",
|
|
14490
14503
|
noThreads: "Nog geen gesprekken.",
|
|
14491
14504
|
conversations: "Gesprekken",
|
|
14492
|
-
unread: (count) => String(count) + (count === 1 ? " ongelezen bericht" : " ongelezen berichten")
|
|
14505
|
+
unread: (count) => String(count) + (count === 1 ? " ongelezen bericht" : " ongelezen berichten"),
|
|
14506
|
+
readOnly: "In dit gesprek kun je niet antwoorden.",
|
|
14507
|
+
activityWorking: "Bezig",
|
|
14508
|
+
activityWaiting: "Wacht op jou",
|
|
14509
|
+
activityFinished: "Klaar",
|
|
14510
|
+
activityFailed: "Mislukt",
|
|
14511
|
+
activityStopped: "Gestopt",
|
|
14512
|
+
stepStarted: "Bezig",
|
|
14513
|
+
stepFailed: "Mislukt",
|
|
14514
|
+
stepKeptRunning: "Blijft actief",
|
|
14515
|
+
earlierEntries: (count) => formatNumber(count, { locale: "nl-NL" }) + (count === 1 ? " eerdere regel" : " eerdere regels"),
|
|
14516
|
+
omittedSteps: (count) => "en nog " + formatNumber(count, { locale: "nl-NL" }) + (count === 1 ? " stap" : " stappen"),
|
|
14517
|
+
activityStep: (title, step, state) => title + ": " + step + (state ? " (" + state + ")" : ""),
|
|
14518
|
+
activityStatus: (title, state) => title + ": " + state
|
|
14493
14519
|
},
|
|
14494
14520
|
richText: {
|
|
14495
14521
|
formatting: "Opmaakopties",
|
|
@@ -20558,7 +20584,7 @@ Defaulting to \`null\`.`;
|
|
|
20558
20584
|
// src/lib/utils.ts
|
|
20559
20585
|
var utils = { parseDateInput, parseTime, formatTime, pageList, toISO, parseISO, addDays, addMonths, formatBytes, niceTicks, resolveLocale };
|
|
20560
20586
|
// src/components/ChatWidget/ChatWidget.tsx
|
|
20561
|
-
var
|
|
20587
|
+
var import_react87 = __toESM(require_react(), 1);
|
|
20562
20588
|
|
|
20563
20589
|
// node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs
|
|
20564
20590
|
var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -45334,35 +45360,348 @@ Defaulting to \`null\`.`;
|
|
|
45334
45360
|
}
|
|
45335
45361
|
|
|
45336
45362
|
// src/components/ChatPanel/transcript.tsx
|
|
45363
|
+
var import_react85 = __toESM(require_react(), 1);
|
|
45364
|
+
|
|
45365
|
+
// src/components/ChatPanel/activity.tsx
|
|
45366
|
+
var import_react84 = __toESM(require_react(), 1);
|
|
45367
|
+
|
|
45368
|
+
// src/internal/useThrottled.ts
|
|
45337
45369
|
var import_react83 = __toESM(require_react(), 1);
|
|
45370
|
+
"use client";
|
|
45371
|
+
function useThrottled(value, interval) {
|
|
45372
|
+
const [shown, setShown] = import_react83.useState(value);
|
|
45373
|
+
const last = import_react83.useRef(0);
|
|
45374
|
+
import_react83.useEffect(() => {
|
|
45375
|
+
if (Object.is(value, shown))
|
|
45376
|
+
return;
|
|
45377
|
+
const timer = setTimeout(() => {
|
|
45378
|
+
last.current = Date.now();
|
|
45379
|
+
setShown(value);
|
|
45380
|
+
}, Math.max(0, last.current + interval - Date.now()));
|
|
45381
|
+
return () => {
|
|
45382
|
+
clearTimeout(timer);
|
|
45383
|
+
};
|
|
45384
|
+
}, [value, shown, interval]);
|
|
45385
|
+
return shown;
|
|
45386
|
+
}
|
|
45387
|
+
|
|
45388
|
+
// src/components/ChatPanel/activity.tsx
|
|
45338
45389
|
var jsx_dev_runtime90 = __toESM(require_jsx_dev_runtime(), 1);
|
|
45339
45390
|
"use client";
|
|
45391
|
+
var LATEST_ENTRIES = 6;
|
|
45392
|
+
var ANNOUNCE_INTERVAL = 5000;
|
|
45393
|
+
var STEP_ICON = { read: "file", search: "search", edit: "pencil", run: "chevron-right", web: "arrow-up-right", plan: "menu", delegate: "users", tool: "ellipsis" };
|
|
45394
|
+
var STATE_ICON = { waiting: "message-circle", finished: "circle-check", failed: "circle-alert", stopped: "minus" };
|
|
45395
|
+
function activityWord(state, chat) {
|
|
45396
|
+
switch (state) {
|
|
45397
|
+
case "working":
|
|
45398
|
+
return chat.activityWorking;
|
|
45399
|
+
case "waiting":
|
|
45400
|
+
return chat.activityWaiting;
|
|
45401
|
+
case "finished":
|
|
45402
|
+
return chat.activityFinished;
|
|
45403
|
+
case "failed":
|
|
45404
|
+
return chat.activityFailed;
|
|
45405
|
+
case "stopped":
|
|
45406
|
+
return chat.activityStopped;
|
|
45407
|
+
}
|
|
45408
|
+
}
|
|
45409
|
+
function stepWord(state, chat) {
|
|
45410
|
+
switch (state) {
|
|
45411
|
+
case "started":
|
|
45412
|
+
return chat.stepStarted;
|
|
45413
|
+
case "failed":
|
|
45414
|
+
return chat.stepFailed;
|
|
45415
|
+
case "left_running":
|
|
45416
|
+
return chat.stepKeptRunning;
|
|
45417
|
+
case "succeeded":
|
|
45418
|
+
return;
|
|
45419
|
+
}
|
|
45420
|
+
}
|
|
45421
|
+
function WorkingMark() {
|
|
45422
|
+
return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
|
|
45423
|
+
className: "vk-spinner vk-chat-activity-spinner",
|
|
45424
|
+
"aria-hidden": "true"
|
|
45425
|
+
}, undefined, false, undefined, this);
|
|
45426
|
+
}
|
|
45427
|
+
function StepState({ state, live }) {
|
|
45428
|
+
const { messages } = useLocale();
|
|
45429
|
+
const word = stepWord(state, messages.chat);
|
|
45430
|
+
if (!word)
|
|
45431
|
+
return null;
|
|
45432
|
+
if (state === "started" && live)
|
|
45433
|
+
return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
|
|
45434
|
+
className: "vk-chat-step-state",
|
|
45435
|
+
children: [
|
|
45436
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV(WorkingMark, {}, undefined, false, undefined, this),
|
|
45437
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
|
|
45438
|
+
className: "vk-sr-only",
|
|
45439
|
+
children: word
|
|
45440
|
+
}, undefined, false, undefined, this)
|
|
45441
|
+
]
|
|
45442
|
+
}, undefined, true, undefined, this);
|
|
45443
|
+
return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
|
|
45444
|
+
className: "vk-chat-step-state",
|
|
45445
|
+
children: [
|
|
45446
|
+
state === "failed" ? /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Icon, {
|
|
45447
|
+
name: "circle-alert",
|
|
45448
|
+
size: 14
|
|
45449
|
+
}, undefined, false, undefined, this) : null,
|
|
45450
|
+
word
|
|
45451
|
+
]
|
|
45452
|
+
}, undefined, true, undefined, this);
|
|
45453
|
+
}
|
|
45454
|
+
function Step2({ step, live }) {
|
|
45455
|
+
return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("li", {
|
|
45456
|
+
className: "vk-chat-step",
|
|
45457
|
+
"data-state": step.state,
|
|
45458
|
+
children: [
|
|
45459
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Icon, {
|
|
45460
|
+
name: STEP_ICON[step.kind],
|
|
45461
|
+
size: 14,
|
|
45462
|
+
className: "vk-chat-step-icon"
|
|
45463
|
+
}, undefined, false, undefined, this),
|
|
45464
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
|
|
45465
|
+
className: "vk-chat-step-text",
|
|
45466
|
+
children: [
|
|
45467
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
|
|
45468
|
+
className: "vk-chat-step-label",
|
|
45469
|
+
children: step.label
|
|
45470
|
+
}, undefined, false, undefined, this),
|
|
45471
|
+
step.outcome ? /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
|
|
45472
|
+
className: "vk-chat-step-outcome",
|
|
45473
|
+
children: step.outcome
|
|
45474
|
+
}, undefined, false, undefined, this) : null
|
|
45475
|
+
]
|
|
45476
|
+
}, undefined, true, undefined, this),
|
|
45477
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV(StepState, {
|
|
45478
|
+
state: step.state,
|
|
45479
|
+
live
|
|
45480
|
+
}, undefined, false, undefined, this)
|
|
45481
|
+
]
|
|
45482
|
+
}, undefined, true, undefined, this);
|
|
45483
|
+
}
|
|
45484
|
+
function Entries({ entries, live }) {
|
|
45485
|
+
if (!entries.length)
|
|
45486
|
+
return null;
|
|
45487
|
+
return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("ol", {
|
|
45488
|
+
className: "vk-chat-activity-entries",
|
|
45489
|
+
children: entries.map((entry) => entry.type === "step" ? /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Step2, {
|
|
45490
|
+
step: entry,
|
|
45491
|
+
live
|
|
45492
|
+
}, entry.id, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("li", {
|
|
45493
|
+
className: "vk-prose vk-chat-narration",
|
|
45494
|
+
children: entry.content
|
|
45495
|
+
}, entry.id, false, undefined, this))
|
|
45496
|
+
}, undefined, false, undefined, this);
|
|
45497
|
+
}
|
|
45498
|
+
function Omitted({ count }) {
|
|
45499
|
+
const { messages } = useLocale();
|
|
45500
|
+
if (!count || count <= 0)
|
|
45501
|
+
return null;
|
|
45502
|
+
return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("p", {
|
|
45503
|
+
className: "vk-chat-activity-omitted",
|
|
45504
|
+
children: messages.chat.omittedSteps(count)
|
|
45505
|
+
}, undefined, false, undefined, this);
|
|
45506
|
+
}
|
|
45507
|
+
function Summary({ activity }) {
|
|
45508
|
+
const { messages } = useLocale();
|
|
45509
|
+
return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(jsx_dev_runtime90.Fragment, {
|
|
45510
|
+
children: [
|
|
45511
|
+
activity.state === "working" ? /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(WorkingMark, {}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Icon, {
|
|
45512
|
+
name: STATE_ICON[activity.state],
|
|
45513
|
+
size: 16,
|
|
45514
|
+
className: "vk-chat-activity-icon"
|
|
45515
|
+
}, undefined, false, undefined, this),
|
|
45516
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
|
|
45517
|
+
className: "vk-chat-activity-text",
|
|
45518
|
+
children: [
|
|
45519
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
|
|
45520
|
+
className: "vk-chat-activity-title",
|
|
45521
|
+
children: activity.title
|
|
45522
|
+
}, undefined, false, undefined, this),
|
|
45523
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
|
|
45524
|
+
className: "vk-chat-activity-state",
|
|
45525
|
+
children: activityWord(activity.state, messages.chat)
|
|
45526
|
+
}, undefined, false, undefined, this),
|
|
45527
|
+
activity.outcome ? /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
|
|
45528
|
+
className: "vk-chat-activity-outcome",
|
|
45529
|
+
children: activity.outcome
|
|
45530
|
+
}, undefined, false, undefined, this) : null,
|
|
45531
|
+
activity.elapsed ? /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
|
|
45532
|
+
className: "vk-chat-activity-elapsed",
|
|
45533
|
+
children: activity.elapsed
|
|
45534
|
+
}, undefined, false, undefined, this) : null
|
|
45535
|
+
]
|
|
45536
|
+
}, undefined, true, undefined, this)
|
|
45537
|
+
]
|
|
45538
|
+
}, undefined, true, undefined, this);
|
|
45539
|
+
}
|
|
45540
|
+
function OpenActivity({ activity }) {
|
|
45541
|
+
const live = activity.state === "working";
|
|
45542
|
+
const { messages } = useLocale();
|
|
45543
|
+
const earlier = activity.entries.slice(0, Math.max(0, activity.entries.length - LATEST_ENTRIES));
|
|
45544
|
+
const latest = activity.entries.slice(earlier.length);
|
|
45545
|
+
return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(jsx_dev_runtime90.Fragment, {
|
|
45546
|
+
children: [
|
|
45547
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV("div", {
|
|
45548
|
+
className: "vk-chat-activity-line",
|
|
45549
|
+
children: /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Summary, {
|
|
45550
|
+
activity
|
|
45551
|
+
}, undefined, false, undefined, this)
|
|
45552
|
+
}, undefined, false, undefined, this),
|
|
45553
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV("div", {
|
|
45554
|
+
className: "vk-chat-activity-body",
|
|
45555
|
+
children: [
|
|
45556
|
+
earlier.length ? /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Collapsible, {
|
|
45557
|
+
className: "vk-chat-activity-earlier",
|
|
45558
|
+
children: [
|
|
45559
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV(CollapsibleTrigger, {
|
|
45560
|
+
asChild: true,
|
|
45561
|
+
children: /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Button, {
|
|
45562
|
+
type: "button",
|
|
45563
|
+
size: "xs",
|
|
45564
|
+
variant: "ghost",
|
|
45565
|
+
className: "vk-chat-activity-more",
|
|
45566
|
+
children: [
|
|
45567
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Icon, {
|
|
45568
|
+
name: "chevron-down",
|
|
45569
|
+
size: 14,
|
|
45570
|
+
className: "vk-chat-activity-chevron"
|
|
45571
|
+
}, undefined, false, undefined, this),
|
|
45572
|
+
messages.chat.earlierEntries(earlier.length)
|
|
45573
|
+
]
|
|
45574
|
+
}, undefined, true, undefined, this)
|
|
45575
|
+
}, undefined, false, undefined, this),
|
|
45576
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV(CollapsibleContent, {
|
|
45577
|
+
children: /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Entries, {
|
|
45578
|
+
entries: earlier,
|
|
45579
|
+
live
|
|
45580
|
+
}, undefined, false, undefined, this)
|
|
45581
|
+
}, undefined, false, undefined, this)
|
|
45582
|
+
]
|
|
45583
|
+
}, undefined, true, undefined, this) : null,
|
|
45584
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Entries, {
|
|
45585
|
+
entries: latest,
|
|
45586
|
+
live
|
|
45587
|
+
}, undefined, false, undefined, this),
|
|
45588
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Omitted, {
|
|
45589
|
+
count: activity.omitted
|
|
45590
|
+
}, undefined, false, undefined, this)
|
|
45591
|
+
]
|
|
45592
|
+
}, undefined, true, undefined, this)
|
|
45593
|
+
]
|
|
45594
|
+
}, undefined, true, undefined, this);
|
|
45595
|
+
}
|
|
45596
|
+
function EndedActivity({ activity }) {
|
|
45597
|
+
if (!activity.entries.length && !activity.omitted)
|
|
45598
|
+
return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("div", {
|
|
45599
|
+
className: "vk-chat-activity-line",
|
|
45600
|
+
children: /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Summary, {
|
|
45601
|
+
activity
|
|
45602
|
+
}, undefined, false, undefined, this)
|
|
45603
|
+
}, undefined, false, undefined, this);
|
|
45604
|
+
return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Collapsible, {
|
|
45605
|
+
children: [
|
|
45606
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV(CollapsibleTrigger, {
|
|
45607
|
+
className: "vk-chat-activity-line vk-chat-activity-toggle",
|
|
45608
|
+
children: [
|
|
45609
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Summary, {
|
|
45610
|
+
activity
|
|
45611
|
+
}, undefined, false, undefined, this),
|
|
45612
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Icon, {
|
|
45613
|
+
name: "chevron-down",
|
|
45614
|
+
size: 16,
|
|
45615
|
+
className: "vk-chat-activity-chevron"
|
|
45616
|
+
}, undefined, false, undefined, this)
|
|
45617
|
+
]
|
|
45618
|
+
}, undefined, true, undefined, this),
|
|
45619
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV(CollapsibleContent, {
|
|
45620
|
+
className: "vk-chat-activity-body",
|
|
45621
|
+
children: [
|
|
45622
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Entries, {
|
|
45623
|
+
entries: activity.entries,
|
|
45624
|
+
live: false
|
|
45625
|
+
}, undefined, false, undefined, this),
|
|
45626
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Omitted, {
|
|
45627
|
+
count: activity.omitted
|
|
45628
|
+
}, undefined, false, undefined, this)
|
|
45629
|
+
]
|
|
45630
|
+
}, undefined, true, undefined, this)
|
|
45631
|
+
]
|
|
45632
|
+
}, undefined, true, undefined, this);
|
|
45633
|
+
}
|
|
45634
|
+
function latestStep(entries) {
|
|
45635
|
+
for (let index = entries.length - 1;index >= 0; index--) {
|
|
45636
|
+
const entry = entries[index];
|
|
45637
|
+
if (entry?.type === "step")
|
|
45638
|
+
return entry;
|
|
45639
|
+
}
|
|
45640
|
+
return;
|
|
45641
|
+
}
|
|
45642
|
+
function useAnnouncement(activity) {
|
|
45643
|
+
const { messages } = useLocale();
|
|
45644
|
+
const step = latestStep(activity.entries);
|
|
45645
|
+
const text = activity.state !== "working" ? messages.chat.activityStatus(activity.title, activityWord(activity.state, messages.chat)) : step ? messages.chat.activityStep(activity.title, step.label, step.state === "failed" ? messages.chat.stepFailed : undefined) : "";
|
|
45646
|
+
const [initial] = import_react84.useState(text);
|
|
45647
|
+
const shown = useThrottled(text, ANNOUNCE_INTERVAL);
|
|
45648
|
+
return shown === initial ? "" : shown;
|
|
45649
|
+
}
|
|
45650
|
+
function ActivityItem({ activity, reducedMotion }) {
|
|
45651
|
+
const announcement = useAnnouncement(activity);
|
|
45652
|
+
return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(MotionLi, {
|
|
45653
|
+
className: "vk-chat-activity",
|
|
45654
|
+
"data-state": activity.state,
|
|
45655
|
+
initial: { opacity: 0, y: reducedMotion ? 0 : 4 },
|
|
45656
|
+
animate: { opacity: 1, y: 0 },
|
|
45657
|
+
transition: { duration: reducedMotion ? 0 : 0.16, ease: "easeOut" },
|
|
45658
|
+
children: [
|
|
45659
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV("div", {
|
|
45660
|
+
"aria-live": "off",
|
|
45661
|
+
children: activity.state === "working" || activity.state === "waiting" ? /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(OpenActivity, {
|
|
45662
|
+
activity
|
|
45663
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(EndedActivity, {
|
|
45664
|
+
activity
|
|
45665
|
+
}, undefined, false, undefined, this)
|
|
45666
|
+
}, undefined, false, undefined, this),
|
|
45667
|
+
/* @__PURE__ */ jsx_dev_runtime90.jsxDEV("div", {
|
|
45668
|
+
role: "status",
|
|
45669
|
+
className: "vk-sr-only",
|
|
45670
|
+
children: announcement
|
|
45671
|
+
}, undefined, false, undefined, this)
|
|
45672
|
+
]
|
|
45673
|
+
}, undefined, true, undefined, this);
|
|
45674
|
+
}
|
|
45675
|
+
|
|
45676
|
+
// src/components/ChatPanel/transcript.tsx
|
|
45677
|
+
var jsx_dev_runtime91 = __toESM(require_jsx_dev_runtime(), 1);
|
|
45678
|
+
"use client";
|
|
45340
45679
|
function MessageDelivery({ message, onRetry }) {
|
|
45341
45680
|
const { messages } = useLocale();
|
|
45342
45681
|
if (!message.delivery)
|
|
45343
45682
|
return null;
|
|
45344
45683
|
if (message.delivery.state === "pending")
|
|
45345
|
-
return /* @__PURE__ */
|
|
45684
|
+
return /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("span", {
|
|
45346
45685
|
className: "vk-chat-delivery",
|
|
45347
45686
|
children: [
|
|
45348
|
-
/* @__PURE__ */
|
|
45687
|
+
/* @__PURE__ */ jsx_dev_runtime91.jsxDEV(Icon, {
|
|
45349
45688
|
name: "clock",
|
|
45350
45689
|
size: 14
|
|
45351
45690
|
}, undefined, false, undefined, this),
|
|
45352
45691
|
messages.chat.sending
|
|
45353
45692
|
]
|
|
45354
45693
|
}, undefined, true, undefined, this);
|
|
45355
|
-
return /* @__PURE__ */
|
|
45694
|
+
return /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("div", {
|
|
45356
45695
|
className: "vk-chat-delivery vk-chat-delivery-failed",
|
|
45357
45696
|
children: [
|
|
45358
|
-
/* @__PURE__ */
|
|
45697
|
+
/* @__PURE__ */ jsx_dev_runtime91.jsxDEV(Icon, {
|
|
45359
45698
|
name: "circle-alert",
|
|
45360
45699
|
size: 14
|
|
45361
45700
|
}, undefined, false, undefined, this),
|
|
45362
|
-
/* @__PURE__ */
|
|
45701
|
+
/* @__PURE__ */ jsx_dev_runtime91.jsxDEV("span", {
|
|
45363
45702
|
children: message.delivery.error || messages.chat.failed
|
|
45364
45703
|
}, undefined, false, undefined, this),
|
|
45365
|
-
onRetry ? /* @__PURE__ */
|
|
45704
|
+
onRetry ? /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(Button, {
|
|
45366
45705
|
type: "button",
|
|
45367
45706
|
size: "sm",
|
|
45368
45707
|
variant: "ghost",
|
|
@@ -45376,61 +45715,79 @@ Defaulting to \`null\`.`;
|
|
|
45376
45715
|
}, undefined, true, undefined, this);
|
|
45377
45716
|
}
|
|
45378
45717
|
function MessageItem({ message, onRetry, reducedMotion }) {
|
|
45379
|
-
return /* @__PURE__ */
|
|
45718
|
+
return /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(MotionLi, {
|
|
45380
45719
|
className: cx("vk-chat-message", "vk-chat-message-" + message.direction),
|
|
45381
45720
|
initial: { opacity: 0, y: reducedMotion ? 0 : 4 },
|
|
45382
45721
|
animate: { opacity: 1, y: 0 },
|
|
45383
45722
|
transition: { duration: reducedMotion ? 0 : 0.16, ease: "easeOut" },
|
|
45384
45723
|
children: [
|
|
45385
|
-
/* @__PURE__ */
|
|
45724
|
+
/* @__PURE__ */ jsx_dev_runtime91.jsxDEV("span", {
|
|
45386
45725
|
className: "vk-chat-message-avatar",
|
|
45387
|
-
children: message.author.avatar || /* @__PURE__ */
|
|
45726
|
+
children: message.author.avatar || /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(Avatar, {
|
|
45388
45727
|
name: message.author.name,
|
|
45389
45728
|
size: 28,
|
|
45390
45729
|
decorative: true
|
|
45391
45730
|
}, undefined, false, undefined, this)
|
|
45392
45731
|
}, undefined, false, undefined, this),
|
|
45393
|
-
/* @__PURE__ */
|
|
45732
|
+
/* @__PURE__ */ jsx_dev_runtime91.jsxDEV("div", {
|
|
45394
45733
|
className: "vk-chat-message-body",
|
|
45395
45734
|
children: [
|
|
45396
|
-
/* @__PURE__ */
|
|
45735
|
+
/* @__PURE__ */ jsx_dev_runtime91.jsxDEV("div", {
|
|
45397
45736
|
className: "vk-chat-message-meta",
|
|
45398
45737
|
children: [
|
|
45399
|
-
/* @__PURE__ */
|
|
45738
|
+
/* @__PURE__ */ jsx_dev_runtime91.jsxDEV("span", {
|
|
45400
45739
|
className: "vk-chat-message-author",
|
|
45401
45740
|
children: message.author.name
|
|
45402
45741
|
}, undefined, false, undefined, this),
|
|
45403
|
-
message.
|
|
45742
|
+
message.author.source ? /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("span", {
|
|
45743
|
+
className: "vk-chat-message-source",
|
|
45744
|
+
children: [
|
|
45745
|
+
message.author.source.mark,
|
|
45746
|
+
message.author.source.label
|
|
45747
|
+
]
|
|
45748
|
+
}, undefined, true, undefined, this) : null,
|
|
45749
|
+
message.timestamp ? /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("span", {
|
|
45404
45750
|
className: "vk-chat-message-time",
|
|
45405
45751
|
children: message.timestamp
|
|
45406
45752
|
}, undefined, false, undefined, this) : null
|
|
45407
45753
|
]
|
|
45408
45754
|
}, undefined, true, undefined, this),
|
|
45409
|
-
/* @__PURE__ */
|
|
45755
|
+
/* @__PURE__ */ jsx_dev_runtime91.jsxDEV("div", {
|
|
45410
45756
|
className: "vk-prose vk-chat-message-content",
|
|
45411
45757
|
children: message.content
|
|
45412
45758
|
}, undefined, false, undefined, this),
|
|
45413
|
-
/* @__PURE__ */
|
|
45759
|
+
/* @__PURE__ */ jsx_dev_runtime91.jsxDEV(MessageDelivery, {
|
|
45414
45760
|
message,
|
|
45415
45761
|
onRetry
|
|
45416
45762
|
}, undefined, false, undefined, this)
|
|
45417
45763
|
]
|
|
45418
|
-
}, undefined, true, undefined, this)
|
|
45764
|
+
}, undefined, true, undefined, this),
|
|
45765
|
+
message.actions?.length ? /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("div", {
|
|
45766
|
+
className: "vk-chat-message-actions",
|
|
45767
|
+
children: message.actions.map((action) => /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(Button, {
|
|
45768
|
+
type: "button",
|
|
45769
|
+
size: "xs",
|
|
45770
|
+
variant: action.variant || "outline",
|
|
45771
|
+
disabled: action.disabled,
|
|
45772
|
+
onClick: action.onSelect,
|
|
45773
|
+
children: action.label
|
|
45774
|
+
}, action.id, false, undefined, this))
|
|
45775
|
+
}, undefined, false, undefined, this) : null
|
|
45419
45776
|
]
|
|
45420
45777
|
}, undefined, true, undefined, this);
|
|
45421
45778
|
}
|
|
45422
45779
|
function ChatTranscript(props) {
|
|
45423
45780
|
const { messages } = useLocale();
|
|
45424
45781
|
const reducedMotion = useReducedMotion() === true;
|
|
45425
|
-
const scrollRef =
|
|
45426
|
-
const follow =
|
|
45782
|
+
const scrollRef = import_react85.useRef(null);
|
|
45783
|
+
const follow = import_react85.useRef(true);
|
|
45427
45784
|
useIsoLayoutEffect(() => {
|
|
45428
45785
|
const node = scrollRef.current;
|
|
45429
45786
|
if (node && follow.current)
|
|
45430
45787
|
node.scrollTop = node.scrollHeight;
|
|
45431
|
-
}, [props.
|
|
45788
|
+
}, [props.items, props.pending]);
|
|
45432
45789
|
const empty = props.emptyState === undefined ? messages.chat.empty : props.emptyState;
|
|
45433
|
-
return /* @__PURE__ */
|
|
45790
|
+
return /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("div", {
|
|
45434
45791
|
ref: scrollRef,
|
|
45435
45792
|
role: "log",
|
|
45436
45793
|
"aria-label": props.label || messages.chat.messages,
|
|
@@ -45444,25 +45801,28 @@ Defaulting to \`null\`.`;
|
|
|
45444
45801
|
follow.current = node.scrollHeight - node.scrollTop - node.clientHeight <= 32;
|
|
45445
45802
|
},
|
|
45446
45803
|
children: [
|
|
45447
|
-
/* @__PURE__ */
|
|
45804
|
+
/* @__PURE__ */ jsx_dev_runtime91.jsxDEV(LazyMotion, {
|
|
45448
45805
|
features: domAnimation,
|
|
45449
|
-
children: /* @__PURE__ */
|
|
45806
|
+
children: /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("ol", {
|
|
45450
45807
|
className: "vk-chat-messages",
|
|
45451
|
-
children: /* @__PURE__ */
|
|
45808
|
+
children: /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(AnimatePresence, {
|
|
45452
45809
|
initial: false,
|
|
45453
|
-
children: props.
|
|
45454
|
-
|
|
45810
|
+
children: props.items.map((item) => item.type === "activity" ? /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(ActivityItem, {
|
|
45811
|
+
activity: item,
|
|
45812
|
+
reducedMotion
|
|
45813
|
+
}, item.id, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(MessageItem, {
|
|
45814
|
+
message: item,
|
|
45455
45815
|
onRetry: props.onRetryMessage,
|
|
45456
45816
|
reducedMotion
|
|
45457
|
-
},
|
|
45817
|
+
}, item.id, false, undefined, this))
|
|
45458
45818
|
}, undefined, false, undefined, this)
|
|
45459
45819
|
}, undefined, false, undefined, this)
|
|
45460
45820
|
}, undefined, false, undefined, this),
|
|
45461
|
-
!props.
|
|
45821
|
+
!props.items.length && !props.pending && !props.error ? /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("div", {
|
|
45462
45822
|
className: "vk-chat-empty",
|
|
45463
45823
|
children: empty
|
|
45464
45824
|
}, undefined, false, undefined, this) : null,
|
|
45465
|
-
props.pending ? /* @__PURE__ */
|
|
45825
|
+
props.pending ? /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("div", {
|
|
45466
45826
|
className: "vk-chat-pending",
|
|
45467
45827
|
role: "status",
|
|
45468
45828
|
children: props.pending
|
|
@@ -45472,33 +45832,33 @@ Defaulting to \`null\`.`;
|
|
|
45472
45832
|
}
|
|
45473
45833
|
|
|
45474
45834
|
// src/components/ChatPanel/ChatPanel.tsx
|
|
45475
|
-
var
|
|
45835
|
+
var jsx_dev_runtime92 = __toESM(require_jsx_dev_runtime(), 1);
|
|
45476
45836
|
"use client";
|
|
45477
45837
|
function ChatPanel(props) {
|
|
45478
45838
|
const { messages } = useLocale();
|
|
45479
|
-
return /* @__PURE__ */
|
|
45839
|
+
return /* @__PURE__ */ jsx_dev_runtime92.jsxDEV("div", {
|
|
45480
45840
|
className: cx("vk-chat-panel", props.className),
|
|
45481
45841
|
children: [
|
|
45482
|
-
/* @__PURE__ */
|
|
45483
|
-
|
|
45842
|
+
/* @__PURE__ */ jsx_dev_runtime92.jsxDEV(ChatTranscript, {
|
|
45843
|
+
items: props.items,
|
|
45484
45844
|
emptyState: props.emptyState,
|
|
45485
45845
|
pending: props.pending,
|
|
45486
45846
|
error: props.error,
|
|
45487
45847
|
label: props["aria-label"],
|
|
45488
45848
|
onRetryMessage: props.onRetryMessage
|
|
45489
45849
|
}, undefined, false, undefined, this),
|
|
45490
|
-
props.error ? /* @__PURE__ */
|
|
45850
|
+
props.error ? /* @__PURE__ */ jsx_dev_runtime92.jsxDEV("div", {
|
|
45491
45851
|
className: "vk-chat-feedback",
|
|
45492
45852
|
role: "alert",
|
|
45493
45853
|
children: [
|
|
45494
|
-
/* @__PURE__ */
|
|
45854
|
+
/* @__PURE__ */ jsx_dev_runtime92.jsxDEV(Icon, {
|
|
45495
45855
|
name: "circle-alert",
|
|
45496
45856
|
size: 16
|
|
45497
45857
|
}, undefined, false, undefined, this),
|
|
45498
|
-
/* @__PURE__ */
|
|
45858
|
+
/* @__PURE__ */ jsx_dev_runtime92.jsxDEV("div", {
|
|
45499
45859
|
children: props.error
|
|
45500
45860
|
}, undefined, false, undefined, this),
|
|
45501
|
-
props.onRetry ? /* @__PURE__ */
|
|
45861
|
+
props.onRetry ? /* @__PURE__ */ jsx_dev_runtime92.jsxDEV(Button, {
|
|
45502
45862
|
type: "button",
|
|
45503
45863
|
size: "sm",
|
|
45504
45864
|
variant: "ghost",
|
|
@@ -45507,19 +45867,30 @@ Defaulting to \`null\`.`;
|
|
|
45507
45867
|
}, undefined, false, undefined, this) : null
|
|
45508
45868
|
]
|
|
45509
45869
|
}, undefined, true, undefined, this) : null,
|
|
45510
|
-
/* @__PURE__ */
|
|
45870
|
+
props.composer ? /* @__PURE__ */ jsx_dev_runtime92.jsxDEV(ChatComposer, {
|
|
45511
45871
|
options: props.composer
|
|
45512
|
-
}, undefined, false, undefined, this)
|
|
45872
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime92.jsxDEV("div", {
|
|
45873
|
+
className: "vk-chat-read-only",
|
|
45874
|
+
children: [
|
|
45875
|
+
/* @__PURE__ */ jsx_dev_runtime92.jsxDEV(Icon, {
|
|
45876
|
+
name: "info",
|
|
45877
|
+
size: 16
|
|
45878
|
+
}, undefined, false, undefined, this),
|
|
45879
|
+
/* @__PURE__ */ jsx_dev_runtime92.jsxDEV("div", {
|
|
45880
|
+
children: props.readOnlyNotice === undefined ? messages.chat.readOnly : props.readOnlyNotice
|
|
45881
|
+
}, undefined, false, undefined, this)
|
|
45882
|
+
]
|
|
45883
|
+
}, undefined, true, undefined, this)
|
|
45513
45884
|
]
|
|
45514
45885
|
}, undefined, true, undefined, this);
|
|
45515
45886
|
}
|
|
45516
45887
|
|
|
45517
45888
|
// src/components/ChatWidget/ChatWidget.tsx
|
|
45518
|
-
var
|
|
45889
|
+
var jsx_dev_runtime93 = __toESM(require_jsx_dev_runtime(), 1);
|
|
45519
45890
|
"use client";
|
|
45520
45891
|
var MotionIconButton = createMinimalMotionComponent(IconButton);
|
|
45521
45892
|
function useChatOpen({ open, defaultOpen, onOpenChange }) {
|
|
45522
|
-
const [localOpen, setLocalOpen] =
|
|
45893
|
+
const [localOpen, setLocalOpen] = import_react87.useState(defaultOpen ?? false);
|
|
45523
45894
|
return {
|
|
45524
45895
|
open: open ?? localOpen,
|
|
45525
45896
|
change: (next) => {
|
|
@@ -45533,9 +45904,9 @@ Defaulting to \`null\`.`;
|
|
|
45533
45904
|
const { messages } = useLocale();
|
|
45534
45905
|
const reducedMotion = useReducedMotion() === true;
|
|
45535
45906
|
const descriptionId = titleId + "-description";
|
|
45536
|
-
return /* @__PURE__ */
|
|
45907
|
+
return /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(PopoverPortal, {
|
|
45537
45908
|
forceMount: true,
|
|
45538
|
-
children: /* @__PURE__ */
|
|
45909
|
+
children: /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(PopoverContent, {
|
|
45539
45910
|
forceMount: true,
|
|
45540
45911
|
asChild: true,
|
|
45541
45912
|
side: "top",
|
|
@@ -45545,39 +45916,39 @@ Defaulting to \`null\`.`;
|
|
|
45545
45916
|
"aria-labelledby": titleId,
|
|
45546
45917
|
"aria-describedby": description ? descriptionId : undefined,
|
|
45547
45918
|
className: "vk-chat-widget-panel",
|
|
45548
|
-
children: /* @__PURE__ */
|
|
45919
|
+
children: /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(MotionDiv, {
|
|
45549
45920
|
initial: { opacity: 0, y: reducedMotion ? 0 : 8, scale: reducedMotion ? 1 : 0.99 },
|
|
45550
45921
|
animate: { opacity: 1, y: 0, scale: 1, transition: { duration: reducedMotion ? 0 : 0.2, ease: [0.2, 0.8, 0.2, 1] } },
|
|
45551
45922
|
exit: { opacity: 0, y: reducedMotion ? 0 : 8, scale: reducedMotion ? 1 : 0.99, transition: { duration: reducedMotion ? 0 : 0.12 } },
|
|
45552
45923
|
children: [
|
|
45553
|
-
/* @__PURE__ */
|
|
45924
|
+
/* @__PURE__ */ jsx_dev_runtime93.jsxDEV("header", {
|
|
45554
45925
|
className: "vk-chat-header",
|
|
45555
45926
|
children: [
|
|
45556
|
-
/* @__PURE__ */
|
|
45927
|
+
/* @__PURE__ */ jsx_dev_runtime93.jsxDEV("div", {
|
|
45557
45928
|
className: "vk-chat-heading",
|
|
45558
45929
|
children: [
|
|
45559
|
-
/* @__PURE__ */
|
|
45930
|
+
/* @__PURE__ */ jsx_dev_runtime93.jsxDEV("h2", {
|
|
45560
45931
|
id: titleId,
|
|
45561
45932
|
className: "vk-chat-title",
|
|
45562
45933
|
children: title
|
|
45563
45934
|
}, undefined, false, undefined, this),
|
|
45564
|
-
description ? /* @__PURE__ */
|
|
45935
|
+
description ? /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("div", {
|
|
45565
45936
|
id: descriptionId,
|
|
45566
45937
|
className: "vk-chat-description",
|
|
45567
45938
|
children: description
|
|
45568
45939
|
}, undefined, false, undefined, this) : null
|
|
45569
45940
|
]
|
|
45570
45941
|
}, undefined, true, undefined, this),
|
|
45571
|
-
/* @__PURE__ */
|
|
45942
|
+
/* @__PURE__ */ jsx_dev_runtime93.jsxDEV(PopoverClose, {
|
|
45572
45943
|
asChild: true,
|
|
45573
|
-
children: /* @__PURE__ */
|
|
45944
|
+
children: /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(IconButton, {
|
|
45574
45945
|
icon: "x",
|
|
45575
45946
|
label: messages.chat.close
|
|
45576
45947
|
}, undefined, false, undefined, this)
|
|
45577
45948
|
}, undefined, false, undefined, this)
|
|
45578
45949
|
]
|
|
45579
45950
|
}, undefined, true, undefined, this),
|
|
45580
|
-
/* @__PURE__ */
|
|
45951
|
+
/* @__PURE__ */ jsx_dev_runtime93.jsxDEV(ChatPanel, {
|
|
45581
45952
|
...panel
|
|
45582
45953
|
}, undefined, false, undefined, this)
|
|
45583
45954
|
]
|
|
@@ -45592,19 +45963,19 @@ Defaulting to \`null\`.`;
|
|
|
45592
45963
|
const titleId = useUid("vk-chat-title");
|
|
45593
45964
|
const unread = unreadCount && unreadCount > 0 ? messages.chat.unread(unreadCount) : "";
|
|
45594
45965
|
const label = (triggerLabel || messages.chat.open) + (unread ? ", " + unread : "");
|
|
45595
|
-
return /* @__PURE__ */
|
|
45966
|
+
return /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(LazyMotion, {
|
|
45596
45967
|
features: domAnimation,
|
|
45597
|
-
children: /* @__PURE__ */
|
|
45968
|
+
children: /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(Popover, {
|
|
45598
45969
|
open: disclosure.open,
|
|
45599
45970
|
onOpenChange: disclosure.change,
|
|
45600
45971
|
modal,
|
|
45601
45972
|
children: [
|
|
45602
|
-
/* @__PURE__ */
|
|
45973
|
+
/* @__PURE__ */ jsx_dev_runtime93.jsxDEV("div", {
|
|
45603
45974
|
className: cx("vk-chat-widget-launcher", "vk-chat-widget-" + align, className),
|
|
45604
45975
|
children: [
|
|
45605
|
-
/* @__PURE__ */
|
|
45976
|
+
/* @__PURE__ */ jsx_dev_runtime93.jsxDEV(PopoverTrigger, {
|
|
45606
45977
|
asChild: true,
|
|
45607
|
-
children: /* @__PURE__ */
|
|
45978
|
+
children: /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(MotionIconButton, {
|
|
45608
45979
|
icon: "message-circle",
|
|
45609
45980
|
label,
|
|
45610
45981
|
variant: "outline",
|
|
@@ -45614,16 +45985,16 @@ Defaulting to \`null\`.`;
|
|
|
45614
45985
|
transition: { duration: reducedMotion ? 0 : 0.12 }
|
|
45615
45986
|
}, undefined, false, undefined, this)
|
|
45616
45987
|
}, undefined, false, undefined, this),
|
|
45617
|
-
unreadCount && unreadCount > 0 ? /* @__PURE__ */
|
|
45988
|
+
unreadCount && unreadCount > 0 ? /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("span", {
|
|
45618
45989
|
className: "vk-chat-unread",
|
|
45619
45990
|
"aria-hidden": "true",
|
|
45620
45991
|
children: formatNumber(unreadCount, { locale })
|
|
45621
45992
|
}, undefined, false, undefined, this) : null
|
|
45622
45993
|
]
|
|
45623
45994
|
}, undefined, true, undefined, this),
|
|
45624
|
-
/* @__PURE__ */
|
|
45995
|
+
/* @__PURE__ */ jsx_dev_runtime93.jsxDEV(AnimatePresence, {
|
|
45625
45996
|
initial: false,
|
|
45626
|
-
children: disclosure.open ? /* @__PURE__ */
|
|
45997
|
+
children: disclosure.open ? /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(WidgetContent, {
|
|
45627
45998
|
title,
|
|
45628
45999
|
description,
|
|
45629
46000
|
align,
|
|
@@ -45637,20 +46008,20 @@ Defaulting to \`null\`.`;
|
|
|
45637
46008
|
}
|
|
45638
46009
|
|
|
45639
46010
|
// src/components/ChatInbox/ChatInbox.tsx
|
|
45640
|
-
var
|
|
45641
|
-
var
|
|
46011
|
+
var import_react89 = __toESM(require_react(), 1);
|
|
46012
|
+
var jsx_dev_runtime94 = __toESM(require_jsx_dev_runtime(), 1);
|
|
45642
46013
|
"use client";
|
|
45643
46014
|
function ThreadList({ threads, selectedId, activeRef, onSelect }) {
|
|
45644
46015
|
const { locale, messages } = useLocale();
|
|
45645
46016
|
if (!threads.length)
|
|
45646
|
-
return /* @__PURE__ */
|
|
46017
|
+
return /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("div", {
|
|
45647
46018
|
className: "vk-chat-empty",
|
|
45648
46019
|
children: messages.chat.noThreads
|
|
45649
46020
|
}, undefined, false, undefined, this);
|
|
45650
|
-
return /* @__PURE__ */
|
|
46021
|
+
return /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("ul", {
|
|
45651
46022
|
className: "vk-chat-threads",
|
|
45652
|
-
children: threads.map((thread) => /* @__PURE__ */
|
|
45653
|
-
children: /* @__PURE__ */
|
|
46023
|
+
children: threads.map((thread) => /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("li", {
|
|
46024
|
+
children: /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("button", {
|
|
45654
46025
|
ref: thread.id === selectedId ? activeRef : undefined,
|
|
45655
46026
|
type: "button",
|
|
45656
46027
|
className: "vk-chat-thread",
|
|
@@ -45660,29 +46031,29 @@ Defaulting to \`null\`.`;
|
|
|
45660
46031
|
onSelect(thread.id);
|
|
45661
46032
|
},
|
|
45662
46033
|
children: [
|
|
45663
|
-
/* @__PURE__ */
|
|
46034
|
+
/* @__PURE__ */ jsx_dev_runtime94.jsxDEV("span", {
|
|
45664
46035
|
className: "vk-chat-thread-avatar",
|
|
45665
|
-
children: thread.avatar || /* @__PURE__ */
|
|
46036
|
+
children: thread.avatar || /* @__PURE__ */ jsx_dev_runtime94.jsxDEV(Avatar, {
|
|
45666
46037
|
name: thread.title,
|
|
45667
46038
|
decorative: true
|
|
45668
46039
|
}, undefined, false, undefined, this)
|
|
45669
46040
|
}, undefined, false, undefined, this),
|
|
45670
|
-
/* @__PURE__ */
|
|
46041
|
+
/* @__PURE__ */ jsx_dev_runtime94.jsxDEV("span", {
|
|
45671
46042
|
className: "vk-chat-thread-text",
|
|
45672
46043
|
children: [
|
|
45673
|
-
/* @__PURE__ */
|
|
46044
|
+
/* @__PURE__ */ jsx_dev_runtime94.jsxDEV("span", {
|
|
45674
46045
|
className: "vk-chat-thread-title",
|
|
45675
46046
|
children: thread.title
|
|
45676
46047
|
}, undefined, false, undefined, this),
|
|
45677
|
-
thread.preview ? /* @__PURE__ */
|
|
46048
|
+
thread.preview ? /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("span", {
|
|
45678
46049
|
className: "vk-chat-thread-preview",
|
|
45679
46050
|
children: thread.preview
|
|
45680
46051
|
}, undefined, false, undefined, this) : null,
|
|
45681
|
-
/* @__PURE__ */
|
|
46052
|
+
/* @__PURE__ */ jsx_dev_runtime94.jsxDEV("span", {
|
|
45682
46053
|
className: "vk-chat-thread-meta",
|
|
45683
46054
|
children: [
|
|
45684
46055
|
thread.timestamp,
|
|
45685
|
-
thread.unreadCount && thread.unreadCount > 0 ? /* @__PURE__ */
|
|
46056
|
+
thread.unreadCount && thread.unreadCount > 0 ? /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("span", {
|
|
45686
46057
|
className: "vk-chat-thread-count",
|
|
45687
46058
|
"aria-label": messages.chat.unread(thread.unreadCount),
|
|
45688
46059
|
children: formatNumber(thread.unreadCount, { locale })
|
|
@@ -45696,13 +46067,13 @@ Defaulting to \`null\`.`;
|
|
|
45696
46067
|
}, thread.id, false, undefined, this))
|
|
45697
46068
|
}, undefined, false, undefined, this);
|
|
45698
46069
|
}
|
|
45699
|
-
function ChatInbox({ title, threads, selectedThreadId, onSelectThread, emptySelection, className, ...panel }) {
|
|
46070
|
+
function ChatInbox({ title, threads, selectedThreadId, onSelectThread, emptySelection, headerActions, className, ...panel }) {
|
|
45700
46071
|
const { messages } = useLocale();
|
|
45701
46072
|
const listTitleId = useUid("vk-chat-threads");
|
|
45702
46073
|
const selected = threads.find((thread) => thread.id === selectedThreadId);
|
|
45703
|
-
const headingRef =
|
|
45704
|
-
const activeRef =
|
|
45705
|
-
const navigation =
|
|
46074
|
+
const headingRef = import_react89.useRef(null);
|
|
46075
|
+
const activeRef = import_react89.useRef(null);
|
|
46076
|
+
const navigation = import_react89.useRef(null);
|
|
45706
46077
|
useIsoLayoutEffect(() => {
|
|
45707
46078
|
const request = navigation.current;
|
|
45708
46079
|
if (!request)
|
|
@@ -45724,22 +46095,29 @@ Defaulting to \`null\`.`;
|
|
|
45724
46095
|
onSelectThread(null);
|
|
45725
46096
|
};
|
|
45726
46097
|
const empty = emptySelection === undefined ? messages.chat.chooseThread : emptySelection;
|
|
45727
|
-
|
|
46098
|
+
const actions = headerActions ? /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("div", {
|
|
46099
|
+
className: "vk-chat-header-actions",
|
|
46100
|
+
children: headerActions
|
|
46101
|
+
}, undefined, false, undefined, this) : null;
|
|
46102
|
+
return /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("div", {
|
|
45728
46103
|
className: cx("vk-chat-inbox", selected && "vk-chat-inbox-selected", className),
|
|
45729
46104
|
children: [
|
|
45730
|
-
/* @__PURE__ */
|
|
46105
|
+
/* @__PURE__ */ jsx_dev_runtime94.jsxDEV("section", {
|
|
45731
46106
|
className: "vk-chat-inbox-list",
|
|
45732
46107
|
"aria-labelledby": listTitleId,
|
|
45733
46108
|
children: [
|
|
45734
|
-
/* @__PURE__ */
|
|
46109
|
+
/* @__PURE__ */ jsx_dev_runtime94.jsxDEV("header", {
|
|
45735
46110
|
className: "vk-chat-header",
|
|
45736
|
-
children:
|
|
45737
|
-
|
|
45738
|
-
|
|
45739
|
-
|
|
45740
|
-
|
|
45741
|
-
|
|
45742
|
-
|
|
46111
|
+
children: [
|
|
46112
|
+
/* @__PURE__ */ jsx_dev_runtime94.jsxDEV("h2", {
|
|
46113
|
+
id: listTitleId,
|
|
46114
|
+
className: "vk-chat-title",
|
|
46115
|
+
children: title || messages.chat.conversations
|
|
46116
|
+
}, undefined, false, undefined, this),
|
|
46117
|
+
selected ? null : actions
|
|
46118
|
+
]
|
|
46119
|
+
}, undefined, true, undefined, this),
|
|
46120
|
+
/* @__PURE__ */ jsx_dev_runtime94.jsxDEV(ThreadList, {
|
|
45743
46121
|
threads,
|
|
45744
46122
|
selectedId: selectedThreadId,
|
|
45745
46123
|
activeRef,
|
|
@@ -45747,33 +46125,34 @@ Defaulting to \`null\`.`;
|
|
|
45747
46125
|
}, undefined, false, undefined, this)
|
|
45748
46126
|
]
|
|
45749
46127
|
}, undefined, true, undefined, this),
|
|
45750
|
-
/* @__PURE__ */
|
|
46128
|
+
/* @__PURE__ */ jsx_dev_runtime94.jsxDEV("section", {
|
|
45751
46129
|
className: "vk-chat-inbox-detail",
|
|
45752
46130
|
"aria-label": selected?.title || messages.chat.messages,
|
|
45753
|
-
children: selected ? /* @__PURE__ */
|
|
46131
|
+
children: selected ? /* @__PURE__ */ jsx_dev_runtime94.jsxDEV(jsx_dev_runtime94.Fragment, {
|
|
45754
46132
|
children: [
|
|
45755
|
-
/* @__PURE__ */
|
|
46133
|
+
/* @__PURE__ */ jsx_dev_runtime94.jsxDEV("header", {
|
|
45756
46134
|
className: "vk-chat-header",
|
|
45757
46135
|
children: [
|
|
45758
|
-
/* @__PURE__ */
|
|
46136
|
+
/* @__PURE__ */ jsx_dev_runtime94.jsxDEV(IconButton, {
|
|
45759
46137
|
icon: "chevron-left",
|
|
45760
46138
|
label: messages.chat.back,
|
|
45761
46139
|
className: "vk-chat-back",
|
|
45762
46140
|
onClick: back
|
|
45763
46141
|
}, undefined, false, undefined, this),
|
|
45764
|
-
/* @__PURE__ */
|
|
46142
|
+
/* @__PURE__ */ jsx_dev_runtime94.jsxDEV("h2", {
|
|
45765
46143
|
ref: headingRef,
|
|
45766
46144
|
tabIndex: -1,
|
|
45767
46145
|
className: "vk-chat-title",
|
|
45768
46146
|
children: selected.title
|
|
45769
|
-
}, undefined, false, undefined, this)
|
|
46147
|
+
}, undefined, false, undefined, this),
|
|
46148
|
+
actions
|
|
45770
46149
|
]
|
|
45771
46150
|
}, undefined, true, undefined, this),
|
|
45772
|
-
/* @__PURE__ */
|
|
46151
|
+
/* @__PURE__ */ jsx_dev_runtime94.jsxDEV(ChatPanel, {
|
|
45773
46152
|
...panel
|
|
45774
46153
|
}, selected.id, false, undefined, this)
|
|
45775
46154
|
]
|
|
45776
|
-
}, undefined, true, undefined, this) : /* @__PURE__ */
|
|
46155
|
+
}, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("div", {
|
|
45777
46156
|
className: "vk-chat-empty vk-chat-no-selection",
|
|
45778
46157
|
children: empty
|
|
45779
46158
|
}, undefined, false, undefined, this)
|