@vokality/design-system 4.0.2 → 5.1.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +3 -3
  3. package/dist/chat.d.ts +65 -2
  4. package/dist/components/ChatInbox/ChatInbox.d.ts +3 -1
  5. package/dist/components/ChatInbox/ChatInbox.js +3 -2
  6. package/dist/components/ChatPanel/ChatPanel.d.ts +1 -1
  7. package/dist/components/ChatPanel/ChatPanel.js +2 -2
  8. package/dist/components/ChatPanel/activity.d.ts +6 -0
  9. package/dist/components/ChatPanel/activity.js +102 -0
  10. package/dist/components/ChatPanel/transcript.d.ts +3 -3
  11. package/dist/components/ChatPanel/transcript.js +5 -4
  12. package/dist/components/Menu/Menu.d.ts +2 -2
  13. package/dist/components/Menu/Menu.js +2 -2
  14. package/dist/components/Popover/Popover.d.ts +2 -2
  15. package/dist/components/Select/Select.d.ts +2 -0
  16. package/dist/components/Select/Select.js +2 -2
  17. package/dist/components.css +65 -6
  18. package/dist/icons/refresh.svg +1 -0
  19. package/dist/icons/settings.svg +1 -0
  20. package/dist/internal/useThrottled.d.ts +2 -0
  21. package/dist/internal/useThrottled.js +17 -0
  22. package/dist/lib/icons.d.ts +15 -0
  23. package/dist/lib/icons.js +9 -0
  24. package/dist/localization.d.ts +13 -0
  25. package/dist/localization.js +13 -1
  26. package/dist/vokality.css +65 -6
  27. package/dist/vokality.iife.js +485 -98
  28. package/docs/components/ChatInbox/README.md +24 -7
  29. package/docs/components/ChatWidget/README.md +48 -7
  30. package/docs/components/Icon/README.md +1 -1
  31. package/docs/components/Menu/README.md +1 -1
  32. package/docs/components/Popover/README.md +3 -2
  33. package/docs/components/Select/README.md +2 -1
  34. package/package.json +1 -1
  35. package/skills/vokality-design-system/SKILL.md +2 -2
  36. package/skills/vokality-design-system/references/examples.tsx +8 -8
@@ -1293,6 +1293,13 @@ Check the top-level render call using <` + parentName + ">.";
1293
1293
  chart: { size: 16, stroke: 1.5, d: ["M3 3v16a2 2 0 0 0 2 2h16", "M18 17V9", "M13 17V5", "M8 17v-3"] },
1294
1294
  clock: { size: 16, stroke: 1.75, d: ["M12 6v6l4 2"], circle: { cx: 12, cy: 12, r: 10 } },
1295
1295
  sidebar: { size: 18, stroke: 1.75, d: ["M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z", "M9 3v18"] },
1296
+ settings: {
1297
+ size: 18,
1298
+ stroke: 1.75,
1299
+ d: ["M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"],
1300
+ circle: { cx: 12, cy: 12, r: 3 }
1301
+ },
1302
+ refresh: { size: 18, stroke: 1.75, d: ["M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8", "M21 3v5h-5"] },
1296
1303
  menu: { size: 22, stroke: 1.75, d: ["M4 6h16M4 12h16M4 18h16"] },
1297
1304
  x: { size: 22, stroke: 1.75, d: ["M18 6 6 18M6 6l12 12"] },
1298
1305
  phone: {
@@ -14349,7 +14356,20 @@ Defaulting to \`null\`.`;
14349
14356
  chooseThread: "Choose a conversation to read and reply.",
14350
14357
  noThreads: "No conversations yet.",
14351
14358
  conversations: "Conversations",
14352
- unread: (count) => String(count) + (count === 1 ? " unread message" : " unread messages")
14359
+ unread: (count) => String(count) + (count === 1 ? " unread message" : " unread messages"),
14360
+ readOnly: "Replies aren't available in this conversation.",
14361
+ activityWorking: "Working",
14362
+ activityWaiting: "Waiting",
14363
+ activityFinished: "Finished",
14364
+ activityFailed: "Failed",
14365
+ activityStopped: "Stopped",
14366
+ stepStarted: "In progress",
14367
+ stepFailed: "Failed",
14368
+ stepKeptRunning: "Kept running",
14369
+ earlierEntries: (count) => formatNumber(count, { locale: "en-US" }) + (count === 1 ? " earlier entry" : " earlier entries"),
14370
+ omittedSteps: (count) => "and " + formatNumber(count, { locale: "en-US" }) + (count === 1 ? " more step" : " more steps"),
14371
+ activityStep: (title, step, state) => title + ": " + step + (state ? " (" + state + ")" : ""),
14372
+ activityStatus: (title, state) => title + ": " + state
14353
14373
  },
14354
14374
  richText: {
14355
14375
  formatting: "Formatting options",
@@ -14489,7 +14509,20 @@ Defaulting to \`null\`.`;
14489
14509
  chooseThread: "Kies een gesprek om te lezen en te antwoorden.",
14490
14510
  noThreads: "Nog geen gesprekken.",
14491
14511
  conversations: "Gesprekken",
14492
- unread: (count) => String(count) + (count === 1 ? " ongelezen bericht" : " ongelezen berichten")
14512
+ unread: (count) => String(count) + (count === 1 ? " ongelezen bericht" : " ongelezen berichten"),
14513
+ readOnly: "In dit gesprek kun je niet antwoorden.",
14514
+ activityWorking: "Bezig",
14515
+ activityWaiting: "Wacht op jou",
14516
+ activityFinished: "Klaar",
14517
+ activityFailed: "Mislukt",
14518
+ activityStopped: "Gestopt",
14519
+ stepStarted: "Bezig",
14520
+ stepFailed: "Mislukt",
14521
+ stepKeptRunning: "Blijft actief",
14522
+ earlierEntries: (count) => formatNumber(count, { locale: "nl-NL" }) + (count === 1 ? " eerdere regel" : " eerdere regels"),
14523
+ omittedSteps: (count) => "en nog " + formatNumber(count, { locale: "nl-NL" }) + (count === 1 ? " stap" : " stappen"),
14524
+ activityStep: (title, step, state) => title + ": " + step + (state ? " (" + state + ")" : ""),
14525
+ activityStatus: (title, state) => title + ": " + state
14493
14526
  },
14494
14527
  richText: {
14495
14528
  formatting: "Opmaakopties",
@@ -14817,6 +14850,7 @@ Defaulting to \`null\`.`;
14817
14850
  value,
14818
14851
  defaultValue,
14819
14852
  onChange,
14853
+ size,
14820
14854
  id,
14821
14855
  className,
14822
14856
  "aria-label": ariaLabel,
@@ -14834,7 +14868,7 @@ Defaulting to \`null\`.`;
14834
14868
  onChange?.(option.value, option);
14835
14869
  };
14836
14870
  return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV("div", {
14837
- className: cx("vk-select", className),
14871
+ className: cx("vk-select", size === "xs" && "vk-select-xs", className),
14838
14872
  children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Select, {
14839
14873
  ...rootProps,
14840
14874
  value: value === null ? "" : value,
@@ -16941,7 +16975,7 @@ Defaulting to \`null\`.`;
16941
16975
  var jsx_dev_runtime40 = __toESM(require_jsx_dev_runtime(), 1);
16942
16976
  "use client";
16943
16977
  function triggerClass(iconOnly, variant, size) {
16944
- return iconOnly ? cx("vk-icon-btn", "vk-icon-btn-" + (variant || "ghost"), size === "xs" && "vk-icon-btn-xs") : cx("vk-btn", "vk-btn-" + (variant || "outline"), size === "sm" && "vk-btn-sm", size === "xs" && "vk-btn-xs");
16978
+ return iconOnly ? cx("vk-icon-btn", variant === "outline" ? "vk-icon-btn-outline" : "vk-icon-btn-ghost", size === "xs" && "vk-icon-btn-xs") : cx("vk-btn", "vk-btn-" + (variant || "outline"), size === "sm" && "vk-btn-sm", size === "xs" && "vk-btn-xs");
16945
16979
  }
16946
16980
  function Menu2({ items, label, icon, triggerLabel, variant, size, align, disabled, className }) {
16947
16981
  const { messages } = useLocale();
@@ -20558,7 +20592,7 @@ Defaulting to \`null\`.`;
20558
20592
  // src/lib/utils.ts
20559
20593
  var utils = { parseDateInput, parseTime, formatTime, pageList, toISO, parseISO, addDays, addMonths, formatBytes, niceTicks, resolveLocale };
20560
20594
  // src/components/ChatWidget/ChatWidget.tsx
20561
- var import_react85 = __toESM(require_react(), 1);
20595
+ var import_react87 = __toESM(require_react(), 1);
20562
20596
 
20563
20597
  // node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs
20564
20598
  var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
@@ -45334,35 +45368,348 @@ Defaulting to \`null\`.`;
45334
45368
  }
45335
45369
 
45336
45370
  // src/components/ChatPanel/transcript.tsx
45371
+ var import_react85 = __toESM(require_react(), 1);
45372
+
45373
+ // src/components/ChatPanel/activity.tsx
45374
+ var import_react84 = __toESM(require_react(), 1);
45375
+
45376
+ // src/internal/useThrottled.ts
45337
45377
  var import_react83 = __toESM(require_react(), 1);
45378
+ "use client";
45379
+ function useThrottled(value, interval) {
45380
+ const [shown, setShown] = import_react83.useState(value);
45381
+ const last = import_react83.useRef(0);
45382
+ import_react83.useEffect(() => {
45383
+ if (Object.is(value, shown))
45384
+ return;
45385
+ const timer = setTimeout(() => {
45386
+ last.current = Date.now();
45387
+ setShown(value);
45388
+ }, Math.max(0, last.current + interval - Date.now()));
45389
+ return () => {
45390
+ clearTimeout(timer);
45391
+ };
45392
+ }, [value, shown, interval]);
45393
+ return shown;
45394
+ }
45395
+
45396
+ // src/components/ChatPanel/activity.tsx
45338
45397
  var jsx_dev_runtime90 = __toESM(require_jsx_dev_runtime(), 1);
45339
45398
  "use client";
45399
+ var LATEST_ENTRIES = 6;
45400
+ var ANNOUNCE_INTERVAL = 5000;
45401
+ var STEP_ICON = { read: "file", search: "search", edit: "pencil", run: "chevron-right", web: "arrow-up-right", plan: "menu", delegate: "users", tool: "ellipsis" };
45402
+ var STATE_ICON = { waiting: "message-circle", finished: "circle-check", failed: "circle-alert", stopped: "minus" };
45403
+ function activityWord(state, chat) {
45404
+ switch (state) {
45405
+ case "working":
45406
+ return chat.activityWorking;
45407
+ case "waiting":
45408
+ return chat.activityWaiting;
45409
+ case "finished":
45410
+ return chat.activityFinished;
45411
+ case "failed":
45412
+ return chat.activityFailed;
45413
+ case "stopped":
45414
+ return chat.activityStopped;
45415
+ }
45416
+ }
45417
+ function stepWord(state, chat) {
45418
+ switch (state) {
45419
+ case "started":
45420
+ return chat.stepStarted;
45421
+ case "failed":
45422
+ return chat.stepFailed;
45423
+ case "left_running":
45424
+ return chat.stepKeptRunning;
45425
+ case "succeeded":
45426
+ return;
45427
+ }
45428
+ }
45429
+ function WorkingMark() {
45430
+ return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
45431
+ className: "vk-spinner vk-chat-activity-spinner",
45432
+ "aria-hidden": "true"
45433
+ }, undefined, false, undefined, this);
45434
+ }
45435
+ function StepState({ state, live }) {
45436
+ const { messages } = useLocale();
45437
+ const word = stepWord(state, messages.chat);
45438
+ if (!word)
45439
+ return null;
45440
+ if (state === "started" && live)
45441
+ return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
45442
+ className: "vk-chat-step-state",
45443
+ children: [
45444
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(WorkingMark, {}, undefined, false, undefined, this),
45445
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
45446
+ className: "vk-sr-only",
45447
+ children: word
45448
+ }, undefined, false, undefined, this)
45449
+ ]
45450
+ }, undefined, true, undefined, this);
45451
+ return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
45452
+ className: "vk-chat-step-state",
45453
+ children: [
45454
+ state === "failed" ? /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Icon, {
45455
+ name: "circle-alert",
45456
+ size: 14
45457
+ }, undefined, false, undefined, this) : null,
45458
+ word
45459
+ ]
45460
+ }, undefined, true, undefined, this);
45461
+ }
45462
+ function Step2({ step, live }) {
45463
+ return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("li", {
45464
+ className: "vk-chat-step",
45465
+ "data-state": step.state,
45466
+ children: [
45467
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Icon, {
45468
+ name: STEP_ICON[step.kind],
45469
+ size: 14,
45470
+ className: "vk-chat-step-icon"
45471
+ }, undefined, false, undefined, this),
45472
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
45473
+ className: "vk-chat-step-text",
45474
+ children: [
45475
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
45476
+ className: "vk-chat-step-label",
45477
+ children: step.label
45478
+ }, undefined, false, undefined, this),
45479
+ step.outcome ? /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
45480
+ className: "vk-chat-step-outcome",
45481
+ children: step.outcome
45482
+ }, undefined, false, undefined, this) : null
45483
+ ]
45484
+ }, undefined, true, undefined, this),
45485
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(StepState, {
45486
+ state: step.state,
45487
+ live
45488
+ }, undefined, false, undefined, this)
45489
+ ]
45490
+ }, undefined, true, undefined, this);
45491
+ }
45492
+ function Entries({ entries, live }) {
45493
+ if (!entries.length)
45494
+ return null;
45495
+ return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("ol", {
45496
+ className: "vk-chat-activity-entries",
45497
+ children: entries.map((entry) => entry.type === "step" ? /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Step2, {
45498
+ step: entry,
45499
+ live
45500
+ }, entry.id, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("li", {
45501
+ className: "vk-prose vk-chat-narration",
45502
+ children: entry.content
45503
+ }, entry.id, false, undefined, this))
45504
+ }, undefined, false, undefined, this);
45505
+ }
45506
+ function Omitted({ count }) {
45507
+ const { messages } = useLocale();
45508
+ if (!count || count <= 0)
45509
+ return null;
45510
+ return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("p", {
45511
+ className: "vk-chat-activity-omitted",
45512
+ children: messages.chat.omittedSteps(count)
45513
+ }, undefined, false, undefined, this);
45514
+ }
45515
+ function Summary({ activity }) {
45516
+ const { messages } = useLocale();
45517
+ return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(jsx_dev_runtime90.Fragment, {
45518
+ children: [
45519
+ activity.state === "working" ? /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(WorkingMark, {}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Icon, {
45520
+ name: STATE_ICON[activity.state],
45521
+ size: 16,
45522
+ className: "vk-chat-activity-icon"
45523
+ }, undefined, false, undefined, this),
45524
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
45525
+ className: "vk-chat-activity-text",
45526
+ children: [
45527
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
45528
+ className: "vk-chat-activity-title",
45529
+ children: activity.title
45530
+ }, undefined, false, undefined, this),
45531
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
45532
+ className: "vk-chat-activity-state",
45533
+ children: activityWord(activity.state, messages.chat)
45534
+ }, undefined, false, undefined, this),
45535
+ activity.outcome ? /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
45536
+ className: "vk-chat-activity-outcome",
45537
+ children: activity.outcome
45538
+ }, undefined, false, undefined, this) : null,
45539
+ activity.elapsed ? /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
45540
+ className: "vk-chat-activity-elapsed",
45541
+ children: activity.elapsed
45542
+ }, undefined, false, undefined, this) : null
45543
+ ]
45544
+ }, undefined, true, undefined, this)
45545
+ ]
45546
+ }, undefined, true, undefined, this);
45547
+ }
45548
+ function OpenActivity({ activity }) {
45549
+ const live = activity.state === "working";
45550
+ const { messages } = useLocale();
45551
+ const earlier = activity.entries.slice(0, Math.max(0, activity.entries.length - LATEST_ENTRIES));
45552
+ const latest = activity.entries.slice(earlier.length);
45553
+ return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(jsx_dev_runtime90.Fragment, {
45554
+ children: [
45555
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("div", {
45556
+ className: "vk-chat-activity-line",
45557
+ children: /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Summary, {
45558
+ activity
45559
+ }, undefined, false, undefined, this)
45560
+ }, undefined, false, undefined, this),
45561
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("div", {
45562
+ className: "vk-chat-activity-body",
45563
+ children: [
45564
+ earlier.length ? /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Collapsible, {
45565
+ className: "vk-chat-activity-earlier",
45566
+ children: [
45567
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(CollapsibleTrigger, {
45568
+ asChild: true,
45569
+ children: /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Button, {
45570
+ type: "button",
45571
+ size: "xs",
45572
+ variant: "ghost",
45573
+ className: "vk-chat-activity-more",
45574
+ children: [
45575
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Icon, {
45576
+ name: "chevron-down",
45577
+ size: 14,
45578
+ className: "vk-chat-activity-chevron"
45579
+ }, undefined, false, undefined, this),
45580
+ messages.chat.earlierEntries(earlier.length)
45581
+ ]
45582
+ }, undefined, true, undefined, this)
45583
+ }, undefined, false, undefined, this),
45584
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(CollapsibleContent, {
45585
+ children: /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Entries, {
45586
+ entries: earlier,
45587
+ live
45588
+ }, undefined, false, undefined, this)
45589
+ }, undefined, false, undefined, this)
45590
+ ]
45591
+ }, undefined, true, undefined, this) : null,
45592
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Entries, {
45593
+ entries: latest,
45594
+ live
45595
+ }, undefined, false, undefined, this),
45596
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Omitted, {
45597
+ count: activity.omitted
45598
+ }, undefined, false, undefined, this)
45599
+ ]
45600
+ }, undefined, true, undefined, this)
45601
+ ]
45602
+ }, undefined, true, undefined, this);
45603
+ }
45604
+ function EndedActivity({ activity }) {
45605
+ if (!activity.entries.length && !activity.omitted)
45606
+ return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("div", {
45607
+ className: "vk-chat-activity-line",
45608
+ children: /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Summary, {
45609
+ activity
45610
+ }, undefined, false, undefined, this)
45611
+ }, undefined, false, undefined, this);
45612
+ return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Collapsible, {
45613
+ children: [
45614
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(CollapsibleTrigger, {
45615
+ className: "vk-chat-activity-line vk-chat-activity-toggle",
45616
+ children: [
45617
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Summary, {
45618
+ activity
45619
+ }, undefined, false, undefined, this),
45620
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Icon, {
45621
+ name: "chevron-down",
45622
+ size: 16,
45623
+ className: "vk-chat-activity-chevron"
45624
+ }, undefined, false, undefined, this)
45625
+ ]
45626
+ }, undefined, true, undefined, this),
45627
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(CollapsibleContent, {
45628
+ className: "vk-chat-activity-body",
45629
+ children: [
45630
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Entries, {
45631
+ entries: activity.entries,
45632
+ live: false
45633
+ }, undefined, false, undefined, this),
45634
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Omitted, {
45635
+ count: activity.omitted
45636
+ }, undefined, false, undefined, this)
45637
+ ]
45638
+ }, undefined, true, undefined, this)
45639
+ ]
45640
+ }, undefined, true, undefined, this);
45641
+ }
45642
+ function latestStep(entries) {
45643
+ for (let index = entries.length - 1;index >= 0; index--) {
45644
+ const entry = entries[index];
45645
+ if (entry?.type === "step")
45646
+ return entry;
45647
+ }
45648
+ return;
45649
+ }
45650
+ function useAnnouncement(activity) {
45651
+ const { messages } = useLocale();
45652
+ const step = latestStep(activity.entries);
45653
+ 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) : "";
45654
+ const [initial] = import_react84.useState(text);
45655
+ const shown = useThrottled(text, ANNOUNCE_INTERVAL);
45656
+ return shown === initial ? "" : shown;
45657
+ }
45658
+ function ActivityItem({ activity, reducedMotion }) {
45659
+ const announcement = useAnnouncement(activity);
45660
+ return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(MotionLi, {
45661
+ className: "vk-chat-activity",
45662
+ "data-state": activity.state,
45663
+ initial: { opacity: 0, y: reducedMotion ? 0 : 4 },
45664
+ animate: { opacity: 1, y: 0 },
45665
+ transition: { duration: reducedMotion ? 0 : 0.16, ease: "easeOut" },
45666
+ children: [
45667
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("div", {
45668
+ "aria-live": "off",
45669
+ children: activity.state === "working" || activity.state === "waiting" ? /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(OpenActivity, {
45670
+ activity
45671
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(EndedActivity, {
45672
+ activity
45673
+ }, undefined, false, undefined, this)
45674
+ }, undefined, false, undefined, this),
45675
+ /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("div", {
45676
+ role: "status",
45677
+ className: "vk-sr-only",
45678
+ children: announcement
45679
+ }, undefined, false, undefined, this)
45680
+ ]
45681
+ }, undefined, true, undefined, this);
45682
+ }
45683
+
45684
+ // src/components/ChatPanel/transcript.tsx
45685
+ var jsx_dev_runtime91 = __toESM(require_jsx_dev_runtime(), 1);
45686
+ "use client";
45340
45687
  function MessageDelivery({ message, onRetry }) {
45341
45688
  const { messages } = useLocale();
45342
45689
  if (!message.delivery)
45343
45690
  return null;
45344
45691
  if (message.delivery.state === "pending")
45345
- return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
45692
+ return /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("span", {
45346
45693
  className: "vk-chat-delivery",
45347
45694
  children: [
45348
- /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Icon, {
45695
+ /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(Icon, {
45349
45696
  name: "clock",
45350
45697
  size: 14
45351
45698
  }, undefined, false, undefined, this),
45352
45699
  messages.chat.sending
45353
45700
  ]
45354
45701
  }, undefined, true, undefined, this);
45355
- return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("div", {
45702
+ return /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("div", {
45356
45703
  className: "vk-chat-delivery vk-chat-delivery-failed",
45357
45704
  children: [
45358
- /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Icon, {
45705
+ /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(Icon, {
45359
45706
  name: "circle-alert",
45360
45707
  size: 14
45361
45708
  }, undefined, false, undefined, this),
45362
- /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
45709
+ /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("span", {
45363
45710
  children: message.delivery.error || messages.chat.failed
45364
45711
  }, undefined, false, undefined, this),
45365
- onRetry ? /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Button, {
45712
+ onRetry ? /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(Button, {
45366
45713
  type: "button",
45367
45714
  size: "sm",
45368
45715
  variant: "ghost",
@@ -45376,61 +45723,79 @@ Defaulting to \`null\`.`;
45376
45723
  }, undefined, true, undefined, this);
45377
45724
  }
45378
45725
  function MessageItem({ message, onRetry, reducedMotion }) {
45379
- return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(MotionLi, {
45726
+ return /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(MotionLi, {
45380
45727
  className: cx("vk-chat-message", "vk-chat-message-" + message.direction),
45381
45728
  initial: { opacity: 0, y: reducedMotion ? 0 : 4 },
45382
45729
  animate: { opacity: 1, y: 0 },
45383
45730
  transition: { duration: reducedMotion ? 0 : 0.16, ease: "easeOut" },
45384
45731
  children: [
45385
- /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
45732
+ /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("span", {
45386
45733
  className: "vk-chat-message-avatar",
45387
- children: message.author.avatar || /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(Avatar, {
45734
+ children: message.author.avatar || /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(Avatar, {
45388
45735
  name: message.author.name,
45389
45736
  size: 28,
45390
45737
  decorative: true
45391
45738
  }, undefined, false, undefined, this)
45392
45739
  }, undefined, false, undefined, this),
45393
- /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("div", {
45740
+ /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("div", {
45394
45741
  className: "vk-chat-message-body",
45395
45742
  children: [
45396
- /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("div", {
45743
+ /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("div", {
45397
45744
  className: "vk-chat-message-meta",
45398
45745
  children: [
45399
- /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
45746
+ /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("span", {
45400
45747
  className: "vk-chat-message-author",
45401
45748
  children: message.author.name
45402
45749
  }, undefined, false, undefined, this),
45403
- message.timestamp ? /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("span", {
45750
+ message.author.source ? /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("span", {
45751
+ className: "vk-chat-message-source",
45752
+ children: [
45753
+ message.author.source.mark,
45754
+ message.author.source.label
45755
+ ]
45756
+ }, undefined, true, undefined, this) : null,
45757
+ message.timestamp ? /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("span", {
45404
45758
  className: "vk-chat-message-time",
45405
45759
  children: message.timestamp
45406
45760
  }, undefined, false, undefined, this) : null
45407
45761
  ]
45408
45762
  }, undefined, true, undefined, this),
45409
- /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("div", {
45763
+ /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("div", {
45410
45764
  className: "vk-prose vk-chat-message-content",
45411
45765
  children: message.content
45412
45766
  }, undefined, false, undefined, this),
45413
- /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(MessageDelivery, {
45767
+ /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(MessageDelivery, {
45414
45768
  message,
45415
45769
  onRetry
45416
45770
  }, undefined, false, undefined, this)
45417
45771
  ]
45418
- }, undefined, true, undefined, this)
45772
+ }, undefined, true, undefined, this),
45773
+ message.actions?.length ? /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("div", {
45774
+ className: "vk-chat-message-actions",
45775
+ children: message.actions.map((action) => /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(Button, {
45776
+ type: "button",
45777
+ size: "xs",
45778
+ variant: action.variant || "outline",
45779
+ disabled: action.disabled,
45780
+ onClick: action.onSelect,
45781
+ children: action.label
45782
+ }, action.id, false, undefined, this))
45783
+ }, undefined, false, undefined, this) : null
45419
45784
  ]
45420
45785
  }, undefined, true, undefined, this);
45421
45786
  }
45422
45787
  function ChatTranscript(props) {
45423
45788
  const { messages } = useLocale();
45424
45789
  const reducedMotion = useReducedMotion() === true;
45425
- const scrollRef = import_react83.useRef(null);
45426
- const follow = import_react83.useRef(true);
45790
+ const scrollRef = import_react85.useRef(null);
45791
+ const follow = import_react85.useRef(true);
45427
45792
  useIsoLayoutEffect(() => {
45428
45793
  const node = scrollRef.current;
45429
45794
  if (node && follow.current)
45430
45795
  node.scrollTop = node.scrollHeight;
45431
- }, [props.messages, props.pending]);
45796
+ }, [props.items, props.pending]);
45432
45797
  const empty = props.emptyState === undefined ? messages.chat.empty : props.emptyState;
45433
- return /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("div", {
45798
+ return /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("div", {
45434
45799
  ref: scrollRef,
45435
45800
  role: "log",
45436
45801
  "aria-label": props.label || messages.chat.messages,
@@ -45444,25 +45809,28 @@ Defaulting to \`null\`.`;
45444
45809
  follow.current = node.scrollHeight - node.scrollTop - node.clientHeight <= 32;
45445
45810
  },
45446
45811
  children: [
45447
- /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(LazyMotion, {
45812
+ /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(LazyMotion, {
45448
45813
  features: domAnimation,
45449
- children: /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("ol", {
45814
+ children: /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("ol", {
45450
45815
  className: "vk-chat-messages",
45451
- children: /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(AnimatePresence, {
45816
+ children: /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(AnimatePresence, {
45452
45817
  initial: false,
45453
- children: props.messages.map((message) => /* @__PURE__ */ jsx_dev_runtime90.jsxDEV(MessageItem, {
45454
- message,
45818
+ children: props.items.map((item) => item.type === "activity" ? /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(ActivityItem, {
45819
+ activity: item,
45820
+ reducedMotion
45821
+ }, item.id, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(MessageItem, {
45822
+ message: item,
45455
45823
  onRetry: props.onRetryMessage,
45456
45824
  reducedMotion
45457
- }, message.id, false, undefined, this))
45825
+ }, item.id, false, undefined, this))
45458
45826
  }, undefined, false, undefined, this)
45459
45827
  }, undefined, false, undefined, this)
45460
45828
  }, undefined, false, undefined, this),
45461
- !props.messages.length && !props.pending && !props.error ? /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("div", {
45829
+ !props.items.length && !props.pending && !props.error ? /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("div", {
45462
45830
  className: "vk-chat-empty",
45463
45831
  children: empty
45464
45832
  }, undefined, false, undefined, this) : null,
45465
- props.pending ? /* @__PURE__ */ jsx_dev_runtime90.jsxDEV("div", {
45833
+ props.pending ? /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("div", {
45466
45834
  className: "vk-chat-pending",
45467
45835
  role: "status",
45468
45836
  children: props.pending
@@ -45472,33 +45840,33 @@ Defaulting to \`null\`.`;
45472
45840
  }
45473
45841
 
45474
45842
  // src/components/ChatPanel/ChatPanel.tsx
45475
- var jsx_dev_runtime91 = __toESM(require_jsx_dev_runtime(), 1);
45843
+ var jsx_dev_runtime92 = __toESM(require_jsx_dev_runtime(), 1);
45476
45844
  "use client";
45477
45845
  function ChatPanel(props) {
45478
45846
  const { messages } = useLocale();
45479
- return /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("div", {
45847
+ return /* @__PURE__ */ jsx_dev_runtime92.jsxDEV("div", {
45480
45848
  className: cx("vk-chat-panel", props.className),
45481
45849
  children: [
45482
- /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(ChatTranscript, {
45483
- messages: props.messages,
45850
+ /* @__PURE__ */ jsx_dev_runtime92.jsxDEV(ChatTranscript, {
45851
+ items: props.items,
45484
45852
  emptyState: props.emptyState,
45485
45853
  pending: props.pending,
45486
45854
  error: props.error,
45487
45855
  label: props["aria-label"],
45488
45856
  onRetryMessage: props.onRetryMessage
45489
45857
  }, undefined, false, undefined, this),
45490
- props.error ? /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("div", {
45858
+ props.error ? /* @__PURE__ */ jsx_dev_runtime92.jsxDEV("div", {
45491
45859
  className: "vk-chat-feedback",
45492
45860
  role: "alert",
45493
45861
  children: [
45494
- /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(Icon, {
45862
+ /* @__PURE__ */ jsx_dev_runtime92.jsxDEV(Icon, {
45495
45863
  name: "circle-alert",
45496
45864
  size: 16
45497
45865
  }, undefined, false, undefined, this),
45498
- /* @__PURE__ */ jsx_dev_runtime91.jsxDEV("div", {
45866
+ /* @__PURE__ */ jsx_dev_runtime92.jsxDEV("div", {
45499
45867
  children: props.error
45500
45868
  }, undefined, false, undefined, this),
45501
- props.onRetry ? /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(Button, {
45869
+ props.onRetry ? /* @__PURE__ */ jsx_dev_runtime92.jsxDEV(Button, {
45502
45870
  type: "button",
45503
45871
  size: "sm",
45504
45872
  variant: "ghost",
@@ -45507,19 +45875,30 @@ Defaulting to \`null\`.`;
45507
45875
  }, undefined, false, undefined, this) : null
45508
45876
  ]
45509
45877
  }, undefined, true, undefined, this) : null,
45510
- /* @__PURE__ */ jsx_dev_runtime91.jsxDEV(ChatComposer, {
45878
+ props.composer ? /* @__PURE__ */ jsx_dev_runtime92.jsxDEV(ChatComposer, {
45511
45879
  options: props.composer
45512
- }, undefined, false, undefined, this)
45880
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime92.jsxDEV("div", {
45881
+ className: "vk-chat-read-only",
45882
+ children: [
45883
+ /* @__PURE__ */ jsx_dev_runtime92.jsxDEV(Icon, {
45884
+ name: "info",
45885
+ size: 16
45886
+ }, undefined, false, undefined, this),
45887
+ /* @__PURE__ */ jsx_dev_runtime92.jsxDEV("div", {
45888
+ children: props.readOnlyNotice === undefined ? messages.chat.readOnly : props.readOnlyNotice
45889
+ }, undefined, false, undefined, this)
45890
+ ]
45891
+ }, undefined, true, undefined, this)
45513
45892
  ]
45514
45893
  }, undefined, true, undefined, this);
45515
45894
  }
45516
45895
 
45517
45896
  // src/components/ChatWidget/ChatWidget.tsx
45518
- var jsx_dev_runtime92 = __toESM(require_jsx_dev_runtime(), 1);
45897
+ var jsx_dev_runtime93 = __toESM(require_jsx_dev_runtime(), 1);
45519
45898
  "use client";
45520
45899
  var MotionIconButton = createMinimalMotionComponent(IconButton);
45521
45900
  function useChatOpen({ open, defaultOpen, onOpenChange }) {
45522
- const [localOpen, setLocalOpen] = import_react85.useState(defaultOpen ?? false);
45901
+ const [localOpen, setLocalOpen] = import_react87.useState(defaultOpen ?? false);
45523
45902
  return {
45524
45903
  open: open ?? localOpen,
45525
45904
  change: (next) => {
@@ -45533,9 +45912,9 @@ Defaulting to \`null\`.`;
45533
45912
  const { messages } = useLocale();
45534
45913
  const reducedMotion = useReducedMotion() === true;
45535
45914
  const descriptionId = titleId + "-description";
45536
- return /* @__PURE__ */ jsx_dev_runtime92.jsxDEV(PopoverPortal, {
45915
+ return /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(PopoverPortal, {
45537
45916
  forceMount: true,
45538
- children: /* @__PURE__ */ jsx_dev_runtime92.jsxDEV(PopoverContent, {
45917
+ children: /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(PopoverContent, {
45539
45918
  forceMount: true,
45540
45919
  asChild: true,
45541
45920
  side: "top",
@@ -45545,39 +45924,39 @@ Defaulting to \`null\`.`;
45545
45924
  "aria-labelledby": titleId,
45546
45925
  "aria-describedby": description ? descriptionId : undefined,
45547
45926
  className: "vk-chat-widget-panel",
45548
- children: /* @__PURE__ */ jsx_dev_runtime92.jsxDEV(MotionDiv, {
45927
+ children: /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(MotionDiv, {
45549
45928
  initial: { opacity: 0, y: reducedMotion ? 0 : 8, scale: reducedMotion ? 1 : 0.99 },
45550
45929
  animate: { opacity: 1, y: 0, scale: 1, transition: { duration: reducedMotion ? 0 : 0.2, ease: [0.2, 0.8, 0.2, 1] } },
45551
45930
  exit: { opacity: 0, y: reducedMotion ? 0 : 8, scale: reducedMotion ? 1 : 0.99, transition: { duration: reducedMotion ? 0 : 0.12 } },
45552
45931
  children: [
45553
- /* @__PURE__ */ jsx_dev_runtime92.jsxDEV("header", {
45932
+ /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("header", {
45554
45933
  className: "vk-chat-header",
45555
45934
  children: [
45556
- /* @__PURE__ */ jsx_dev_runtime92.jsxDEV("div", {
45935
+ /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("div", {
45557
45936
  className: "vk-chat-heading",
45558
45937
  children: [
45559
- /* @__PURE__ */ jsx_dev_runtime92.jsxDEV("h2", {
45938
+ /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("h2", {
45560
45939
  id: titleId,
45561
45940
  className: "vk-chat-title",
45562
45941
  children: title
45563
45942
  }, undefined, false, undefined, this),
45564
- description ? /* @__PURE__ */ jsx_dev_runtime92.jsxDEV("div", {
45943
+ description ? /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("div", {
45565
45944
  id: descriptionId,
45566
45945
  className: "vk-chat-description",
45567
45946
  children: description
45568
45947
  }, undefined, false, undefined, this) : null
45569
45948
  ]
45570
45949
  }, undefined, true, undefined, this),
45571
- /* @__PURE__ */ jsx_dev_runtime92.jsxDEV(PopoverClose, {
45950
+ /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(PopoverClose, {
45572
45951
  asChild: true,
45573
- children: /* @__PURE__ */ jsx_dev_runtime92.jsxDEV(IconButton, {
45952
+ children: /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(IconButton, {
45574
45953
  icon: "x",
45575
45954
  label: messages.chat.close
45576
45955
  }, undefined, false, undefined, this)
45577
45956
  }, undefined, false, undefined, this)
45578
45957
  ]
45579
45958
  }, undefined, true, undefined, this),
45580
- /* @__PURE__ */ jsx_dev_runtime92.jsxDEV(ChatPanel, {
45959
+ /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(ChatPanel, {
45581
45960
  ...panel
45582
45961
  }, undefined, false, undefined, this)
45583
45962
  ]
@@ -45592,19 +45971,19 @@ Defaulting to \`null\`.`;
45592
45971
  const titleId = useUid("vk-chat-title");
45593
45972
  const unread = unreadCount && unreadCount > 0 ? messages.chat.unread(unreadCount) : "";
45594
45973
  const label = (triggerLabel || messages.chat.open) + (unread ? ", " + unread : "");
45595
- return /* @__PURE__ */ jsx_dev_runtime92.jsxDEV(LazyMotion, {
45974
+ return /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(LazyMotion, {
45596
45975
  features: domAnimation,
45597
- children: /* @__PURE__ */ jsx_dev_runtime92.jsxDEV(Popover, {
45976
+ children: /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(Popover, {
45598
45977
  open: disclosure.open,
45599
45978
  onOpenChange: disclosure.change,
45600
45979
  modal,
45601
45980
  children: [
45602
- /* @__PURE__ */ jsx_dev_runtime92.jsxDEV("div", {
45981
+ /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("div", {
45603
45982
  className: cx("vk-chat-widget-launcher", "vk-chat-widget-" + align, className),
45604
45983
  children: [
45605
- /* @__PURE__ */ jsx_dev_runtime92.jsxDEV(PopoverTrigger, {
45984
+ /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(PopoverTrigger, {
45606
45985
  asChild: true,
45607
- children: /* @__PURE__ */ jsx_dev_runtime92.jsxDEV(MotionIconButton, {
45986
+ children: /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(MotionIconButton, {
45608
45987
  icon: "message-circle",
45609
45988
  label,
45610
45989
  variant: "outline",
@@ -45614,16 +45993,16 @@ Defaulting to \`null\`.`;
45614
45993
  transition: { duration: reducedMotion ? 0 : 0.12 }
45615
45994
  }, undefined, false, undefined, this)
45616
45995
  }, undefined, false, undefined, this),
45617
- unreadCount && unreadCount > 0 ? /* @__PURE__ */ jsx_dev_runtime92.jsxDEV("span", {
45996
+ unreadCount && unreadCount > 0 ? /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("span", {
45618
45997
  className: "vk-chat-unread",
45619
45998
  "aria-hidden": "true",
45620
45999
  children: formatNumber(unreadCount, { locale })
45621
46000
  }, undefined, false, undefined, this) : null
45622
46001
  ]
45623
46002
  }, undefined, true, undefined, this),
45624
- /* @__PURE__ */ jsx_dev_runtime92.jsxDEV(AnimatePresence, {
46003
+ /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(AnimatePresence, {
45625
46004
  initial: false,
45626
- children: disclosure.open ? /* @__PURE__ */ jsx_dev_runtime92.jsxDEV(WidgetContent, {
46005
+ children: disclosure.open ? /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(WidgetContent, {
45627
46006
  title,
45628
46007
  description,
45629
46008
  align,
@@ -45637,20 +46016,20 @@ Defaulting to \`null\`.`;
45637
46016
  }
45638
46017
 
45639
46018
  // src/components/ChatInbox/ChatInbox.tsx
45640
- var import_react87 = __toESM(require_react(), 1);
45641
- var jsx_dev_runtime93 = __toESM(require_jsx_dev_runtime(), 1);
46019
+ var import_react89 = __toESM(require_react(), 1);
46020
+ var jsx_dev_runtime94 = __toESM(require_jsx_dev_runtime(), 1);
45642
46021
  "use client";
45643
46022
  function ThreadList({ threads, selectedId, activeRef, onSelect }) {
45644
46023
  const { locale, messages } = useLocale();
45645
46024
  if (!threads.length)
45646
- return /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("div", {
46025
+ return /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("div", {
45647
46026
  className: "vk-chat-empty",
45648
46027
  children: messages.chat.noThreads
45649
46028
  }, undefined, false, undefined, this);
45650
- return /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("ul", {
46029
+ return /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("ul", {
45651
46030
  className: "vk-chat-threads",
45652
- children: threads.map((thread) => /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("li", {
45653
- children: /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("button", {
46031
+ children: threads.map((thread) => /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("li", {
46032
+ children: /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("button", {
45654
46033
  ref: thread.id === selectedId ? activeRef : undefined,
45655
46034
  type: "button",
45656
46035
  className: "vk-chat-thread",
@@ -45660,29 +46039,29 @@ Defaulting to \`null\`.`;
45660
46039
  onSelect(thread.id);
45661
46040
  },
45662
46041
  children: [
45663
- /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("span", {
46042
+ /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("span", {
45664
46043
  className: "vk-chat-thread-avatar",
45665
- children: thread.avatar || /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(Avatar, {
46044
+ children: thread.avatar || /* @__PURE__ */ jsx_dev_runtime94.jsxDEV(Avatar, {
45666
46045
  name: thread.title,
45667
46046
  decorative: true
45668
46047
  }, undefined, false, undefined, this)
45669
46048
  }, undefined, false, undefined, this),
45670
- /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("span", {
46049
+ /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("span", {
45671
46050
  className: "vk-chat-thread-text",
45672
46051
  children: [
45673
- /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("span", {
46052
+ /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("span", {
45674
46053
  className: "vk-chat-thread-title",
45675
46054
  children: thread.title
45676
46055
  }, undefined, false, undefined, this),
45677
- thread.preview ? /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("span", {
46056
+ thread.preview ? /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("span", {
45678
46057
  className: "vk-chat-thread-preview",
45679
46058
  children: thread.preview
45680
46059
  }, undefined, false, undefined, this) : null,
45681
- /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("span", {
46060
+ /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("span", {
45682
46061
  className: "vk-chat-thread-meta",
45683
46062
  children: [
45684
46063
  thread.timestamp,
45685
- thread.unreadCount && thread.unreadCount > 0 ? /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("span", {
46064
+ thread.unreadCount && thread.unreadCount > 0 ? /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("span", {
45686
46065
  className: "vk-chat-thread-count",
45687
46066
  "aria-label": messages.chat.unread(thread.unreadCount),
45688
46067
  children: formatNumber(thread.unreadCount, { locale })
@@ -45696,13 +46075,13 @@ Defaulting to \`null\`.`;
45696
46075
  }, thread.id, false, undefined, this))
45697
46076
  }, undefined, false, undefined, this);
45698
46077
  }
45699
- function ChatInbox({ title, threads, selectedThreadId, onSelectThread, emptySelection, className, ...panel }) {
46078
+ function ChatInbox({ title, threads, selectedThreadId, onSelectThread, emptySelection, headerActions, className, ...panel }) {
45700
46079
  const { messages } = useLocale();
45701
46080
  const listTitleId = useUid("vk-chat-threads");
45702
46081
  const selected = threads.find((thread) => thread.id === selectedThreadId);
45703
- const headingRef = import_react87.useRef(null);
45704
- const activeRef = import_react87.useRef(null);
45705
- const navigation = import_react87.useRef(null);
46082
+ const headingRef = import_react89.useRef(null);
46083
+ const activeRef = import_react89.useRef(null);
46084
+ const navigation = import_react89.useRef(null);
45706
46085
  useIsoLayoutEffect(() => {
45707
46086
  const request = navigation.current;
45708
46087
  if (!request)
@@ -45724,22 +46103,29 @@ Defaulting to \`null\`.`;
45724
46103
  onSelectThread(null);
45725
46104
  };
45726
46105
  const empty = emptySelection === undefined ? messages.chat.chooseThread : emptySelection;
45727
- return /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("div", {
46106
+ const actions = headerActions ? /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("div", {
46107
+ className: "vk-chat-header-actions",
46108
+ children: headerActions
46109
+ }, undefined, false, undefined, this) : null;
46110
+ return /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("div", {
45728
46111
  className: cx("vk-chat-inbox", selected && "vk-chat-inbox-selected", className),
45729
46112
  children: [
45730
- /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("section", {
46113
+ /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("section", {
45731
46114
  className: "vk-chat-inbox-list",
45732
46115
  "aria-labelledby": listTitleId,
45733
46116
  children: [
45734
- /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("header", {
46117
+ /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("header", {
45735
46118
  className: "vk-chat-header",
45736
- children: /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("h2", {
45737
- id: listTitleId,
45738
- className: "vk-chat-title",
45739
- children: title || messages.chat.conversations
45740
- }, undefined, false, undefined, this)
45741
- }, undefined, false, undefined, this),
45742
- /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(ThreadList, {
46119
+ children: [
46120
+ /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("h2", {
46121
+ id: listTitleId,
46122
+ className: "vk-chat-title",
46123
+ children: title || messages.chat.conversations
46124
+ }, undefined, false, undefined, this),
46125
+ selected ? null : actions
46126
+ ]
46127
+ }, undefined, true, undefined, this),
46128
+ /* @__PURE__ */ jsx_dev_runtime94.jsxDEV(ThreadList, {
45743
46129
  threads,
45744
46130
  selectedId: selectedThreadId,
45745
46131
  activeRef,
@@ -45747,33 +46133,34 @@ Defaulting to \`null\`.`;
45747
46133
  }, undefined, false, undefined, this)
45748
46134
  ]
45749
46135
  }, undefined, true, undefined, this),
45750
- /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("section", {
46136
+ /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("section", {
45751
46137
  className: "vk-chat-inbox-detail",
45752
46138
  "aria-label": selected?.title || messages.chat.messages,
45753
- children: selected ? /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(jsx_dev_runtime93.Fragment, {
46139
+ children: selected ? /* @__PURE__ */ jsx_dev_runtime94.jsxDEV(jsx_dev_runtime94.Fragment, {
45754
46140
  children: [
45755
- /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("header", {
46141
+ /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("header", {
45756
46142
  className: "vk-chat-header",
45757
46143
  children: [
45758
- /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(IconButton, {
46144
+ /* @__PURE__ */ jsx_dev_runtime94.jsxDEV(IconButton, {
45759
46145
  icon: "chevron-left",
45760
46146
  label: messages.chat.back,
45761
46147
  className: "vk-chat-back",
45762
46148
  onClick: back
45763
46149
  }, undefined, false, undefined, this),
45764
- /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("h2", {
46150
+ /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("h2", {
45765
46151
  ref: headingRef,
45766
46152
  tabIndex: -1,
45767
46153
  className: "vk-chat-title",
45768
46154
  children: selected.title
45769
- }, undefined, false, undefined, this)
46155
+ }, undefined, false, undefined, this),
46156
+ actions
45770
46157
  ]
45771
46158
  }, undefined, true, undefined, this),
45772
- /* @__PURE__ */ jsx_dev_runtime93.jsxDEV(ChatPanel, {
46159
+ /* @__PURE__ */ jsx_dev_runtime94.jsxDEV(ChatPanel, {
45773
46160
  ...panel
45774
46161
  }, selected.id, false, undefined, this)
45775
46162
  ]
45776
- }, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime93.jsxDEV("div", {
46163
+ }, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime94.jsxDEV("div", {
45777
46164
  className: "vk-chat-empty vk-chat-no-selection",
45778
46165
  children: empty
45779
46166
  }, undefined, false, undefined, this)