@opengeni/react 2.5.0-canary.1 → 3.0.0-canary.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 (70) hide show
  1. package/README.md +15 -0
  2. package/dist/accounts.d.ts +64 -0
  3. package/dist/accounts.js +746 -0
  4. package/dist/accounts.js.map +1 -0
  5. package/dist/{browser-viewer-GXUICIAG.js → browser-viewer-AEFHUYZK.js} +3 -3
  6. package/dist/{chunk-MXJGO7LE.js → chunk-D3UIAJKY.js} +52 -2
  7. package/dist/chunk-D3UIAJKY.js.map +1 -0
  8. package/dist/{chunk-QGBJ6GHG.js → chunk-ELIYWBZR.js} +4 -4
  9. package/dist/{chunk-6H6S5V4Z.js → chunk-HQVCKCLG.js} +758 -871
  10. package/dist/chunk-HQVCKCLG.js.map +1 -0
  11. package/dist/{chunk-T7VAYG2I.js → chunk-MZ2G2XBA.js} +54 -2
  12. package/dist/chunk-MZ2G2XBA.js.map +1 -0
  13. package/dist/{chunk-X4JAFD5R.js → chunk-OAM4WAAM.js} +4 -4
  14. package/dist/{chunk-KSDXER4X.js → chunk-RGALCTWO.js} +64 -15
  15. package/dist/chunk-RGALCTWO.js.map +1 -0
  16. package/dist/chunk-YFKJ7VZH.js +268 -0
  17. package/dist/chunk-YFKJ7VZH.js.map +1 -0
  18. package/dist/{chunk-ATQJEWCA.js → chunk-YJFGAFBD.js} +124 -50
  19. package/dist/chunk-YJFGAFBD.js.map +1 -0
  20. package/dist/components/composer.d.ts +8 -0
  21. package/dist/components/file-browser.d.ts +4 -1
  22. package/dist/components/sandbox-files.d.ts +4 -1
  23. package/dist/components/sandbox-workspace.d.ts +5 -0
  24. package/dist/composer.js +3 -3
  25. package/dist/{computer-viewer-ZOP4Q7A7.js → computer-viewer-FWEZISW4.js} +3 -3
  26. package/dist/embedded-session-client.d.ts +23 -0
  27. package/dist/file-node-visibility.d.ts +15 -0
  28. package/dist/hooks/use-file-attachments.d.ts +9 -2
  29. package/dist/human-input.d.ts +3 -1
  30. package/dist/index.d.ts +5 -1
  31. package/dist/index.js +139 -53
  32. package/dist/index.js.map +1 -1
  33. package/dist/interaction.js +3 -3
  34. package/dist/session-ui.js +4 -4
  35. package/dist/session.d.ts +2 -0
  36. package/dist/session.js +7 -5
  37. package/dist/timeline/index.d.ts +1 -0
  38. package/dist/timeline/screenshot-lightbox.d.ts +16 -1
  39. package/package.json +6 -2
  40. package/src/accounts.tsx +970 -0
  41. package/src/components/chat-composer.tsx +88 -84
  42. package/src/components/composer.tsx +61 -9
  43. package/src/components/file-browser.tsx +33 -20
  44. package/src/components/human-input-surface.tsx +10 -6
  45. package/src/components/message-timeline.tsx +37 -9
  46. package/src/components/sandbox-files.tsx +42 -2
  47. package/src/components/sandbox-workspace.tsx +10 -0
  48. package/src/embedded-session-client.ts +104 -0
  49. package/src/file-node-visibility.ts +66 -0
  50. package/src/hooks/use-composer.ts +64 -2
  51. package/src/hooks/use-file-attachments.ts +38 -6
  52. package/src/hooks/use-human-input.ts +31 -4
  53. package/src/human-input.ts +12 -1
  54. package/src/index.ts +12 -0
  55. package/src/session.ts +5 -0
  56. package/src/timeline/index.ts +1 -0
  57. package/src/timeline/screenshot-lightbox.tsx +93 -29
  58. package/styles/compiled.css +11 -1
  59. package/styles/tokens.css +3 -1
  60. package/dist/chunk-6H6S5V4Z.js.map +0 -1
  61. package/dist/chunk-ATQJEWCA.js.map +0 -1
  62. package/dist/chunk-FK6VG4LL.js +0 -90
  63. package/dist/chunk-FK6VG4LL.js.map +0 -1
  64. package/dist/chunk-KSDXER4X.js.map +0 -1
  65. package/dist/chunk-MXJGO7LE.js.map +0 -1
  66. package/dist/chunk-T7VAYG2I.js.map +0 -1
  67. /package/dist/{browser-viewer-GXUICIAG.js.map → browser-viewer-AEFHUYZK.js.map} +0 -0
  68. /package/dist/{chunk-QGBJ6GHG.js.map → chunk-ELIYWBZR.js.map} +0 -0
  69. /package/dist/{chunk-X4JAFD5R.js.map → chunk-OAM4WAAM.js.map} +0 -0
  70. /package/dist/{computer-viewer-ZOP4Q7A7.js.map → computer-viewer-FWEZISW4.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  shouldSteerOnKey,
3
3
  shouldSubmitOnKey
4
- } from "./chunk-T7VAYG2I.js";
4
+ } from "./chunk-MZ2G2XBA.js";
5
5
  import {
6
6
  groupPickerRowsByBillingClass
7
7
  } from "./chunk-X4A66EWZ.js";
@@ -9,8 +9,9 @@ import {
9
9
  Tooltip,
10
10
  TooltipContent,
11
11
  TooltipProvider,
12
- TooltipTrigger
13
- } from "./chunk-FK6VG4LL.js";
12
+ TooltipTrigger,
13
+ useLightboxOptional
14
+ } from "./chunk-YFKJ7VZH.js";
14
15
  import {
15
16
  ComposerResponsiveContext
16
17
  } from "./chunk-VZTQ73XT.js";
@@ -2883,6 +2884,7 @@ import {
2883
2884
  useContext,
2884
2885
  useEffect as useEffect3,
2885
2886
  useId as useId2,
2887
+ useLayoutEffect,
2886
2888
  useMemo as useMemo4,
2887
2889
  useRef as useRef4,
2888
2890
  useState as useState4
@@ -2935,6 +2937,10 @@ var defaultChatComposerMessages = {
2935
2937
  removeRestoredResource: (index) => `Remove restored resource ${index + 1}`,
2936
2938
  uploading: "Uploading",
2937
2939
  uploadFailed: "Upload failed",
2940
+ previewAttachment: (name) => `Preview ${name}`,
2941
+ attachmentPreviewLabel: "Attachment preview",
2942
+ downloadAttachment: (name) => `Download ${name}`,
2943
+ closeAttachmentPreview: "Close",
2938
2944
  retryAttachment: (name) => `Retry ${name}`,
2939
2945
  retryUpload: "Retry upload",
2940
2946
  removeAttachment: (name) => `Remove ${name}`,
@@ -3046,21 +3052,31 @@ function useChatComposerController({
3046
3052
  const [submitting, setSubmitting] = useState4(false);
3047
3053
  const submittingRef = useRef4(false);
3048
3054
  const controlOperationRef = useRef4(false);
3055
+ const deliveryValue = delivery.value;
3056
+ const setDeliveryValue = delivery.setValue;
3049
3057
  const mountedRef = useRef4(true);
3050
- const deliveredValueRef = useRef4(delivery.value);
3051
- const liveValueRef = useRef4(delivery.value);
3052
- if (delivery.value !== deliveredValueRef.current) {
3053
- deliveredValueRef.current = delivery.value;
3054
- liveValueRef.current = delivery.value;
3058
+ const deliveredValueRef = useRef4(deliveryValue);
3059
+ const liveValueRef = useRef4(deliveryValue);
3060
+ const [renderedValue, setRenderedValue] = useState4(deliveryValue);
3061
+ const deliveryChanged = deliveryValue !== deliveredValueRef.current;
3062
+ if (deliveryChanged) {
3063
+ deliveredValueRef.current = deliveryValue;
3064
+ liveValueRef.current = deliveryValue;
3055
3065
  }
3056
3066
  const setComposerValue = useCallback4(
3057
3067
  (next) => {
3058
3068
  liveValueRef.current = next;
3059
- delivery.setValue(next);
3069
+ setRenderedValue(next);
3070
+ setDeliveryValue(next);
3060
3071
  },
3061
- [delivery.setValue]
3072
+ [setDeliveryValue]
3062
3073
  );
3063
- const visibleValue = liveValueRef.current;
3074
+ const visibleValue = deliveryChanged ? deliveryValue : renderedValue;
3075
+ useLayoutEffect(() => {
3076
+ if (renderedValue !== liveValueRef.current) {
3077
+ setRenderedValue(liveValueRef.current);
3078
+ }
3079
+ }, [deliveryValue, renderedValue]);
3064
3080
  useEffect3(() => {
3065
3081
  mountedRef.current = true;
3066
3082
  return () => {
@@ -3489,7 +3505,8 @@ function Attachments() {
3489
3505
  attachments: controller.attachments.attachments,
3490
3506
  messages: controller.messages,
3491
3507
  onRemove: controller.attachments.remove,
3492
- onRetry: controller.attachments.retry
3508
+ onRetry: controller.attachments.retry,
3509
+ onRetainPreview: controller.attachments.retainPreview
3493
3510
  }
3494
3511
  );
3495
3512
  }
@@ -4007,8 +4024,10 @@ function AttachmentChips({
4007
4024
  attachments,
4008
4025
  messages,
4009
4026
  onRemove,
4010
- onRetry
4027
+ onRetry,
4028
+ onRetainPreview
4011
4029
  }) {
4030
+ const lightbox = useLightboxOptional();
4012
4031
  return /* @__PURE__ */ jsx3("div", { className: "flex flex-wrap gap-2 px-3 py-2", children: attachments.map((attachment) => {
4013
4032
  const failed = attachment.status === "failed";
4014
4033
  const statusText = attachment.status === "uploading" ? messages.uploading : failed ? attachment.error || messages.uploadFailed : messages.formatBytes(attachment.sizeBytes);
@@ -4020,7 +4039,37 @@ function AttachmentChips({
4020
4039
  failed ? "border-og-status-failed/40 bg-og-status-failed/10" : "border-og-border bg-og-surface-2"
4021
4040
  ),
4022
4041
  children: [
4023
- attachment.previewUrl ? /* @__PURE__ */ jsx3(
4042
+ attachment.previewUrl && lightbox ? /* @__PURE__ */ jsx3(
4043
+ "button",
4044
+ {
4045
+ type: "button",
4046
+ className: "size-8 shrink-0 overflow-hidden rounded outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent",
4047
+ "aria-label": messages.previewAttachment(attachment.name),
4048
+ onClick: (event) => {
4049
+ const releasePreview = onRetainPreview(attachment.id);
4050
+ lightbox.open(
4051
+ attachment.previewUrl,
4052
+ attachment.name,
4053
+ event.currentTarget,
4054
+ messages.attachmentPreviewLabel,
4055
+ attachment.name,
4056
+ {
4057
+ download: messages.downloadAttachment(attachment.name),
4058
+ close: messages.closeAttachmentPreview
4059
+ },
4060
+ releasePreview
4061
+ );
4062
+ },
4063
+ children: /* @__PURE__ */ jsx3(
4064
+ "img",
4065
+ {
4066
+ src: attachment.previewUrl,
4067
+ alt: "",
4068
+ className: "h-full w-full object-cover transition-opacity hover:opacity-80"
4069
+ }
4070
+ )
4071
+ }
4072
+ ) : attachment.previewUrl ? /* @__PURE__ */ jsx3(
4024
4073
  "img",
4025
4074
  {
4026
4075
  src: attachment.previewUrl,
@@ -4545,4 +4594,4 @@ export {
4545
4594
  Status,
4546
4595
  ComposerTranscriptionControl
4547
4596
  };
4548
- //# sourceMappingURL=chunk-KSDXER4X.js.map
4597
+ //# sourceMappingURL=chunk-RGALCTWO.js.map