@opengeni/react 2.2.0-canary.0 → 2.3.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.
@@ -3,7 +3,7 @@ import {
3
3
  groupTimeline,
4
4
  mcpToolLeaf,
5
5
  toolDisplayName
6
- } from "./chunk-XSA2QAKP.js";
6
+ } from "./chunk-RSXJN73N.js";
7
7
  import {
8
8
  EmptyQueueStateSurface,
9
9
  TimelineAnnotationsChip,
@@ -1440,6 +1440,11 @@ function QuestionControls({
1440
1440
  hint ? `${fieldId}-hint` : null,
1441
1441
  error ? errorId : null
1442
1442
  ].filter(Boolean).join(" ") || void 0;
1443
+ const selectOtherDraft = (current) => ({
1444
+ ...current,
1445
+ otherSelected: true,
1446
+ ...question.kind === "single_select" ? { values: [] } : {}
1447
+ });
1443
1448
  return /* @__PURE__ */ jsxs3(Fragment2, { children: [
1444
1449
  showPromptChrome ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
1445
1450
  /* @__PURE__ */ jsx3("div", { className: "flex flex-wrap items-baseline gap-x-2", children: /* @__PURE__ */ jsxs3(
@@ -1571,12 +1576,17 @@ function QuestionControls({
1571
1576
  id: otherTextId,
1572
1577
  type: "text",
1573
1578
  value: draft.other,
1574
- disabled: !draft.otherSelected || busy,
1579
+ disabled: busy,
1575
1580
  placeholder: "Type a value\u2026",
1576
- onChange: (event) => onUpdate((current) => ({
1577
- ...current,
1578
- other: event.target.value
1579
- })),
1581
+ onClick: () => onUpdate(selectOtherDraft),
1582
+ onFocus: () => onUpdate(selectOtherDraft),
1583
+ onChange: (event) => {
1584
+ const other = event.target.value;
1585
+ onUpdate((current) => ({
1586
+ ...selectOtherDraft(current),
1587
+ other
1588
+ }));
1589
+ },
1580
1590
  className: "mt-1.5 w-full rounded-og-sm border border-og-border bg-og-surface-1 px-2 py-1.5 text-og-sm text-og-fg outline-hidden focus:border-og-accent disabled:opacity-50"
1581
1591
  }
1582
1592
  )
@@ -7225,6 +7235,7 @@ function MessageTimeline({
7225
7235
  const olderPrefetchArmedRef = useRef11(false);
7226
7236
  const [olderPrefetchArmed, setOlderPrefetchArmed] = useState14(false);
7227
7237
  const olderLoadGateRef = useRef11("armed");
7238
+ const underfillLoadWindowRef = useRef11(null);
7228
7239
  const resizeFollowRafRef = useRef11(null);
7229
7240
  const firstGroupKey = allGroups[0] ? timelineGroupKey(allGroups[0]) : null;
7230
7241
  const [revealed, setRevealed] = useState14(resolvedItems[0]?.id === "c");
@@ -7251,6 +7262,8 @@ function MessageTimeline({
7251
7262
  const groupKeyByItemIdRef = useRef11(/* @__PURE__ */ new Map());
7252
7263
  const groupOffsetByKeyRef = useRef11(/* @__PURE__ */ new Map());
7253
7264
  const firstItemId = resolvedItems[0]?.id ?? null;
7265
+ const lastItemId = resolvedItems.at(-1)?.id ?? null;
7266
+ const loadedWindowKey = JSON.stringify([firstItemId, lastItemId, resolvedItems.length]);
7254
7267
  const firstKeyChangedForBulk = previousBulkFirstKeyRef.current !== void 0 && previousBulkFirstKeyRef.current !== firstGroupKey;
7255
7268
  const bulkRender = allGroups.length > 0 && (bulkActive || firstKeyChangedForBulk);
7256
7269
  const applyPinned = useCallback3((value) => {
@@ -7449,6 +7462,22 @@ function MessageTimeline({
7449
7462
  }),
7450
7463
  [beginUserMessageDisclosureChange]
7451
7464
  );
7465
+ const requestOlderIfUnderfilled = useCallback3(
7466
+ (node) => {
7467
+ if (underfillLoadWindowRef.current !== null && underfillLoadWindowRef.current !== loadedWindowKey) {
7468
+ olderLoadGateRef.current = "armed";
7469
+ }
7470
+ if (node.clientHeight <= 1 || maxScrollOf(node) > 1 || !hasOlder || loadingOlder || !onLoadOlder || underfillLoadWindowRef.current === loadedWindowKey) {
7471
+ return;
7472
+ }
7473
+ underfillLoadWindowRef.current = loadedWindowKey;
7474
+ if (olderPrefetchArmedRef.current) {
7475
+ olderLoadGateRef.current = "cooling";
7476
+ }
7477
+ onLoadOlder();
7478
+ },
7479
+ [hasOlder, loadedWindowKey, loadingOlder, onLoadOlder]
7480
+ );
7452
7481
  const driveFollowRef = useRef11(() => void 0);
7453
7482
  const driveFollow = useCallback3(
7454
7483
  (node, nowMs) => {
@@ -7680,9 +7709,16 @@ function MessageTimeline({
7680
7709
  foldMemoryRef.current.clear();
7681
7710
  userMessageDisclosureMemoryRef.current.clear();
7682
7711
  disclosureKeepsUnpinnedRef.current = false;
7712
+ underfillLoadWindowRef.current = null;
7683
7713
  seenActivityIdsRef.current.clear();
7684
7714
  applyPinned(true);
7685
7715
  }, [allGroups.length, revealed, applyPinned]);
7716
+ useEffect11(() => {
7717
+ const node = scrollRef.current;
7718
+ if (node) {
7719
+ requestOlderIfUnderfilled(node);
7720
+ }
7721
+ });
7686
7722
  useLayoutEffect3(() => {
7687
7723
  previousBulkFirstKeyRef.current = firstGroupKey;
7688
7724
  if (!bulkRender) {
@@ -7749,6 +7785,7 @@ function MessageTimeline({
7749
7785
  if (!current) {
7750
7786
  return;
7751
7787
  }
7788
+ requestOlderIfUnderfilled(current);
7752
7789
  if (!autoFollow || !pinnedRef.current || hasNewerRef.current) {
7753
7790
  return;
7754
7791
  }
@@ -7768,7 +7805,7 @@ function MessageTimeline({
7768
7805
  resizeFollowRafRef.current = null;
7769
7806
  }
7770
7807
  };
7771
- }, [autoFollow, driveFollow, snapToBottom]);
7808
+ }, [autoFollow, driveFollow, requestOlderIfUnderfilled, snapToBottom]);
7772
7809
  useEffect11(() => {
7773
7810
  if (hasNewer) {
7774
7811
  stopFollow();
@@ -9401,4 +9438,4 @@ export {
9401
9438
  MessageTimeline,
9402
9439
  TimelineRow
9403
9440
  };
9404
- //# sourceMappingURL=chunk-5RZN3DD5.js.map
9441
+ //# sourceMappingURL=chunk-LS4POUTY.js.map