@adecore/agents-react 0.70.0 → 0.71.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 (95) hide show
  1. package/dist/chat/logic/fork.js +1 -0
  2. package/dist/chat/logic/thread-cards.js +1 -0
  3. package/dist/chat/logic/timeline.js +7 -0
  4. package/dist/chat/ui/CodeBlock.d.ts +6 -1
  5. package/dist/chat/ui/CodeBlock.js +39 -23
  6. package/dist/chat/ui/intelligent-ui/UiReply.js +11 -2
  7. package/dist/chat/ui/intelligent-ui/key-caps.d.ts +1 -0
  8. package/dist/chat/ui/intelligent-ui/key-caps.js +45 -0
  9. package/dist/chat/ui/intelligent-ui/link-action.d.ts +9 -0
  10. package/dist/chat/ui/intelligent-ui/link-action.js +32 -0
  11. package/dist/chat/ui/intelligent-ui/node-text.js +1 -1
  12. package/dist/chat/ui/intelligent-ui/patch-clip.d.ts +4 -0
  13. package/dist/chat/ui/intelligent-ui/patch-clip.js +64 -0
  14. package/dist/chat/ui/intelligent-ui/registry.js +31 -5
  15. package/dist/chat/ui/intelligent-ui/render-context.d.ts +13 -0
  16. package/dist/chat/ui/intelligent-ui/renderers/alternatives.d.ts +6 -0
  17. package/dist/chat/ui/intelligent-ui/renderers/alternatives.js +296 -0
  18. package/dist/chat/ui/intelligent-ui/renderers/changes.d.ts +4 -0
  19. package/dist/chat/ui/intelligent-ui/renderers/changes.js +266 -0
  20. package/dist/chat/ui/intelligent-ui/renderers/chart.js +522 -371
  21. package/dist/chat/ui/intelligent-ui/renderers/content.d.ts +1 -1
  22. package/dist/chat/ui/intelligent-ui/renderers/content.js +94 -43
  23. package/dist/chat/ui/intelligent-ui/renderers/data.js +478 -245
  24. package/dist/chat/ui/intelligent-ui/renderers/diff.d.ts +4 -0
  25. package/dist/chat/ui/intelligent-ui/renderers/diff.js +427 -0
  26. package/dist/chat/ui/intelligent-ui/renderers/inputs.d.ts +1 -0
  27. package/dist/chat/ui/intelligent-ui/renderers/inputs.js +354 -110
  28. package/dist/chat/ui/intelligent-ui/renderers/keys.d.ts +3 -0
  29. package/dist/chat/ui/intelligent-ui/renderers/keys.js +60 -0
  30. package/dist/chat/ui/intelligent-ui/renderers/links.d.ts +13 -2
  31. package/dist/chat/ui/intelligent-ui/renderers/links.js +65 -85
  32. package/dist/chat/ui/intelligent-ui/renderers/meter.d.ts +4 -0
  33. package/dist/chat/ui/intelligent-ui/renderers/meter.js +371 -0
  34. package/dist/chat/ui/intelligent-ui/renderers/quote.d.ts +3 -0
  35. package/dist/chat/ui/intelligent-ui/renderers/quote.js +123 -0
  36. package/dist/chat/ui/intelligent-ui/renderers/radio.d.ts +3 -0
  37. package/dist/chat/ui/intelligent-ui/renderers/radio.js +205 -0
  38. package/dist/chat/ui/intelligent-ui/renderers/structure.d.ts +2 -0
  39. package/dist/chat/ui/intelligent-ui/renderers/structure.js +156 -45
  40. package/dist/chat/ui/intelligent-ui/renderers/text.js +365 -215
  41. package/dist/chat/ui/intelligent-ui/renderers/tree.d.ts +5 -0
  42. package/dist/chat/ui/intelligent-ui/renderers/tree.js +284 -0
  43. package/dist/chat/ui/intelligent-ui/table-data.d.ts +9 -2
  44. package/dist/chat/ui/intelligent-ui/table-data.js +68 -3
  45. package/dist/chat/ui/intelligent-ui/tones.d.ts +1 -1
  46. package/dist/chat/ui/intelligent-ui/tones.js +7 -7
  47. package/dist/chat/ui/intelligent-ui/use-ui-diffs.d.ts +4 -0
  48. package/dist/chat/ui/intelligent-ui/use-ui-diffs.js +201 -0
  49. package/dist/chat/ui/rows/MessageRows.d.ts +4 -1
  50. package/dist/chat/ui/rows/MessageRows.js +92 -1
  51. package/dist/chat/ui/rows/Rows.js +45 -31
  52. package/dist/host/host.d.ts +2 -1
  53. package/dist/host/timeline-row.d.ts +5 -1
  54. package/dist/locales/en/agent-chat.d.ts +62 -0
  55. package/dist/locales/en/agent-chat.js +63 -1
  56. package/dist/locales/nl/agent-chat.d.ts +62 -0
  57. package/dist/locales/nl/agent-chat.js +63 -1
  58. package/dist/theme.css +6 -0
  59. package/package.json +9 -9
  60. package/src/chat/logic/fork.ts +1 -0
  61. package/src/chat/logic/thread-cards.ts +1 -0
  62. package/src/chat/logic/timeline.ts +4 -0
  63. package/src/chat/ui/CodeBlock.tsx +38 -18
  64. package/src/chat/ui/intelligent-ui/UiReply.tsx +13 -2
  65. package/src/chat/ui/intelligent-ui/key-caps.ts +51 -0
  66. package/src/chat/ui/intelligent-ui/link-action.ts +32 -0
  67. package/src/chat/ui/intelligent-ui/node-text.ts +1 -0
  68. package/src/chat/ui/intelligent-ui/patch-clip.ts +83 -0
  69. package/src/chat/ui/intelligent-ui/registry.ts +31 -4
  70. package/src/chat/ui/intelligent-ui/render-context.ts +21 -0
  71. package/src/chat/ui/intelligent-ui/renderers/alternatives.tsx +76 -0
  72. package/src/chat/ui/intelligent-ui/renderers/changes.tsx +97 -0
  73. package/src/chat/ui/intelligent-ui/renderers/chart.tsx +122 -46
  74. package/src/chat/ui/intelligent-ui/renderers/content.tsx +27 -7
  75. package/src/chat/ui/intelligent-ui/renderers/data.tsx +165 -52
  76. package/src/chat/ui/intelligent-ui/renderers/diff.tsx +144 -0
  77. package/src/chat/ui/intelligent-ui/renderers/inputs.tsx +111 -19
  78. package/src/chat/ui/intelligent-ui/renderers/keys.tsx +26 -0
  79. package/src/chat/ui/intelligent-ui/renderers/links.tsx +40 -24
  80. package/src/chat/ui/intelligent-ui/renderers/meter.tsx +105 -0
  81. package/src/chat/ui/intelligent-ui/renderers/quote.tsx +29 -0
  82. package/src/chat/ui/intelligent-ui/renderers/radio.tsx +130 -0
  83. package/src/chat/ui/intelligent-ui/renderers/structure.tsx +54 -7
  84. package/src/chat/ui/intelligent-ui/renderers/text.tsx +70 -36
  85. package/src/chat/ui/intelligent-ui/renderers/tree.tsx +85 -0
  86. package/src/chat/ui/intelligent-ui/table-data.ts +84 -6
  87. package/src/chat/ui/intelligent-ui/tones.ts +7 -7
  88. package/src/chat/ui/intelligent-ui/use-ui-diffs.ts +119 -0
  89. package/src/chat/ui/rows/MessageRows.tsx +23 -0
  90. package/src/chat/ui/rows/Rows.tsx +3 -0
  91. package/src/host/host.ts +4 -0
  92. package/src/host/timeline-row.ts +3 -0
  93. package/src/locales/en/agent-chat.ts +63 -1
  94. package/src/locales/nl/agent-chat.ts +63 -1
  95. package/src/theme.css +6 -0
@@ -1,8 +1,8 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
- import { Button, Checkbox, Input, Segmented, Select, Slider, Switch, Tooltip } from '@adecore/ui';
3
- import { formatNumber } from '@adecore/ui/format';
2
+ import { Button, Checkbox, Input, Segmented, Select, Slider, Switch, TextArea, Tooltip } from '@adecore/ui';
3
+ import { formatNumber, formatRounded } from '@adecore/ui/format';
4
4
  import clsx from 'clsx';
5
- import { createContext, useContext, useId } from 'react';
5
+ import { createContext, useContext, useId, useState } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
7
7
  import { uiChildrenOf, uiNodeLabel, uiOwnLabel, uiWithUnit } from '../node-text.js';
8
8
  import { useTruncated } from '../use-truncated.js';
@@ -130,14 +130,15 @@ export function ChecklistRenderer(t0) {
130
130
  }
131
131
  /* The whole tile is the label, ringed in the accent while checked; a link inside it keeps its own click and checks nothing. */
132
132
  export function ItemRenderer(t0) {
133
- const $ = _c(22);
133
+ const $ = _c(27);
134
134
  const {
135
135
  node,
136
136
  children
137
137
  } = t0;
138
138
  const list = useContext(ChecklistContext);
139
139
  const {
140
- value
140
+ value,
141
+ detail
141
142
  } = node.props;
142
143
  let checked;
143
144
  let t1;
@@ -198,7 +199,7 @@ export function ItemRenderer(t0) {
198
199
  let t6;
199
200
  if ($[15] !== children) {
200
201
  t6 = /*#__PURE__*/_jsx("div", {
201
- className: "min-w-0 grow",
202
+ className: "min-w-0",
202
203
  children: children
203
204
  });
204
205
  $[15] = children;
@@ -207,21 +208,44 @@ export function ItemRenderer(t0) {
207
208
  t6 = $[16];
208
209
  }
209
210
  let t7;
210
- if ($[17] !== t1 || $[18] !== t5 || $[19] !== t6 || $[20] !== toggleRow) {
211
- t7 = /*#__PURE__*/_jsxs("div", {
211
+ if ($[17] !== detail) {
212
+ t7 = detail !== undefined && detail !== "" && /*#__PURE__*/_jsx("div", {
213
+ className: "text-2xs wrap-break-word text-text-muted",
214
+ children: detail
215
+ });
216
+ $[17] = detail;
217
+ $[18] = t7;
218
+ } else {
219
+ t7 = $[18];
220
+ }
221
+ let t8;
222
+ if ($[19] !== t6 || $[20] !== t7) {
223
+ t8 = /*#__PURE__*/_jsxs("div", {
224
+ className: "flex min-w-0 grow flex-col gap-0.5",
225
+ children: [t6, t7]
226
+ });
227
+ $[19] = t6;
228
+ $[20] = t7;
229
+ $[21] = t8;
230
+ } else {
231
+ t8 = $[21];
232
+ }
233
+ let t9;
234
+ if ($[22] !== t1 || $[23] !== t5 || $[24] !== t8 || $[25] !== toggleRow) {
235
+ t9 = /*#__PURE__*/_jsxs("div", {
212
236
  className: t1,
213
237
  onClick: toggleRow,
214
- children: [t5, t6]
238
+ children: [t5, t8]
215
239
  });
216
- $[17] = t1;
217
- $[18] = t5;
218
- $[19] = t6;
219
- $[20] = toggleRow;
220
- $[21] = t7;
240
+ $[22] = t1;
241
+ $[23] = t5;
242
+ $[24] = t8;
243
+ $[25] = toggleRow;
244
+ $[26] = t9;
221
245
  } else {
222
- t7 = $[21];
246
+ t9 = $[26];
223
247
  }
224
- return t7;
248
+ return t9;
225
249
  }
226
250
  export function SwitchRenderer(t0) {
227
251
  const $ = _c(20);
@@ -398,9 +422,9 @@ export function SliderRenderer(t0) {
398
422
  }
399
423
  /* A label longer than this reads as a sentence, which wraps badly beside another; the options then stand in a column. */
400
424
  const SIDE_BY_SIDE_LABEL = 24;
401
- /* Left aligned, never the full width. Each Option is a segment by its place, since a value may be any scalar. */
425
+ /* Left aligned, never the full width, under its label where it has one. Each Option is a segment by its place, since a value may be any scalar. */
402
426
  export function SegmentedRenderer(t0) {
403
- const $ = _c(31);
427
+ const $ = _c(38);
404
428
  const {
405
429
  node,
406
430
  context
@@ -426,26 +450,44 @@ export function SegmentedRenderer(t0) {
426
450
  let t4;
427
451
  let t5;
428
452
  let t6;
453
+ let t7;
429
454
  if ($[3] !== current || $[4] !== node || $[5] !== t) {
430
455
  options = uiChildrenOf(node, "Option").map(_temp);
431
456
  const picked = options.find(option_0 => option_0.value === current)?.id ?? "";
432
- const t7 = !node.complete && PENDING;
433
- if ($[13] !== t7) {
434
- t6 = clsx(t7);
435
- $[13] = t7;
436
- $[14] = t6;
457
+ const {
458
+ label
459
+ } = node.props;
460
+ const named = label !== undefined && label !== "";
461
+ const t8 = !node.complete && PENDING;
462
+ if ($[14] !== t8) {
463
+ t6 = clsx("flex flex-col items-start gap-1.5", t8);
464
+ $[14] = t8;
465
+ $[15] = t6;
466
+ } else {
467
+ t6 = $[15];
468
+ }
469
+ if ($[16] !== label || $[17] !== named) {
470
+ t7 = named && /*#__PURE__*/_jsx("span", {
471
+ className: "px-0.5 text-2xs text-text-muted",
472
+ children: label
473
+ });
474
+ $[16] = label;
475
+ $[17] = named;
476
+ $[18] = t7;
437
477
  } else {
438
- t6 = $[14];
478
+ t7 = $[18];
439
479
  }
440
480
  T0 = Segmented;
441
481
  t2 = picked;
442
482
  t3 = options;
443
- if ($[15] !== t) {
444
- t4 = t("blocks.options");
445
- $[15] = t;
446
- $[16] = t4;
483
+ if ($[19] !== label || $[20] !== named || $[21] !== t) {
484
+ t4 = named ? label : t("blocks.options");
485
+ $[19] = label;
486
+ $[20] = named;
487
+ $[21] = t;
488
+ $[22] = t4;
447
489
  } else {
448
- t4 = $[16];
490
+ t4 = $[22];
449
491
  }
450
492
  t5 = options.some(_temp2) ? "vertical" : "horizontal";
451
493
  $[3] = current;
@@ -458,6 +500,7 @@ export function SegmentedRenderer(t0) {
458
500
  $[10] = t4;
459
501
  $[11] = t5;
460
502
  $[12] = t6;
503
+ $[13] = t7;
461
504
  } else {
462
505
  T0 = $[6];
463
506
  options = $[7];
@@ -466,56 +509,58 @@ export function SegmentedRenderer(t0) {
466
509
  t4 = $[10];
467
510
  t5 = $[11];
468
511
  t6 = $[12];
512
+ t7 = $[13];
469
513
  }
470
- const t7 = binding === null;
471
- let t8;
472
- if ($[17] !== binding || $[18] !== options) {
473
- t8 = id => {
514
+ const t8 = binding === null;
515
+ let t9;
516
+ if ($[23] !== binding || $[24] !== options) {
517
+ t9 = id => {
474
518
  const option_2 = options[Number(id)];
475
519
  if (option_2 !== undefined) {
476
520
  binding?.onValueChange(option_2.value);
477
521
  }
478
522
  };
479
- $[17] = binding;
480
- $[18] = options;
481
- $[19] = t8;
523
+ $[23] = binding;
524
+ $[24] = options;
525
+ $[25] = t9;
482
526
  } else {
483
- t8 = $[19];
527
+ t9 = $[25];
484
528
  }
485
- let t9;
486
- if ($[20] !== T0 || $[21] !== t2 || $[22] !== t3 || $[23] !== t4 || $[24] !== t5 || $[25] !== t7 || $[26] !== t8) {
487
- t9 = /*#__PURE__*/_jsx(T0, {
529
+ let t10;
530
+ if ($[26] !== T0 || $[27] !== t2 || $[28] !== t3 || $[29] !== t4 || $[30] !== t5 || $[31] !== t8 || $[32] !== t9) {
531
+ t10 = /*#__PURE__*/_jsx(T0, {
488
532
  value: t2,
489
533
  options: t3,
490
534
  label: t4,
491
535
  orientation: t5,
492
- disabled: t7,
493
- onValueChange: t8
536
+ disabled: t8,
537
+ onValueChange: t9
494
538
  });
495
- $[20] = T0;
496
- $[21] = t2;
497
- $[22] = t3;
498
- $[23] = t4;
499
- $[24] = t5;
500
- $[25] = t7;
501
- $[26] = t8;
502
- $[27] = t9;
539
+ $[26] = T0;
540
+ $[27] = t2;
541
+ $[28] = t3;
542
+ $[29] = t4;
543
+ $[30] = t5;
544
+ $[31] = t8;
545
+ $[32] = t9;
546
+ $[33] = t10;
503
547
  } else {
504
- t9 = $[27];
548
+ t10 = $[33];
505
549
  }
506
- let t10;
507
- if ($[28] !== t6 || $[29] !== t9) {
508
- t10 = /*#__PURE__*/_jsx("div", {
550
+ let t11;
551
+ if ($[34] !== t10 || $[35] !== t6 || $[36] !== t7) {
552
+ t11 = /*#__PURE__*/_jsxs("div", {
509
553
  className: t6,
510
- children: t9
554
+ children: [t7, t10]
511
555
  });
512
- $[28] = t6;
513
- $[29] = t9;
514
- $[30] = t10;
556
+ $[34] = t10;
557
+ $[35] = t6;
558
+ $[36] = t7;
559
+ $[37] = t11;
515
560
  } else {
516
- t10 = $[30];
561
+ t11 = $[37];
517
562
  }
518
- return t10;
563
+ return t11;
519
564
  }
520
565
  /* The longest a text field takes when its agent names none; the schema allows up to 1024. */
521
566
  function _temp2(option_1) {
@@ -532,11 +577,12 @@ const DEFAULT_MAX_LENGTH = 256;
532
577
  /* The count under a field appears once the field is this full, and never nags before. */
533
578
  const COUNT_FROM = 0.8;
534
579
  /*
535
- * A line of text: the label above the field, which stops taking characters at its limit. Nothing here binds
536
- * a key or submits on Enter, so the value reaches the agent only through a Choice.
580
+ * A line of text, or with `multiline` a few lines that grow with what is typed: the label above the field,
581
+ * which stops taking characters at its limit. Nothing here binds a key or submits on Enter, so the value
582
+ * reaches the agent only through a Choice.
537
583
  */
538
584
  export function TextFieldRenderer(t0) {
539
- const $ = _c(29);
585
+ const $ = _c(28);
540
586
  const {
541
587
  node,
542
588
  children,
@@ -558,7 +604,8 @@ export function TextFieldRenderer(t0) {
558
604
  const binding = t1;
559
605
  const {
560
606
  maxLength: t2,
561
- placeholder
607
+ placeholder,
608
+ multiline
562
609
  } = node.props;
563
610
  const maxLength = t2 === undefined ? DEFAULT_MAX_LENGTH : t2;
564
611
  const value = binding?.value ?? node.props.value;
@@ -586,43 +633,45 @@ export function TextFieldRenderer(t0) {
586
633
  } else {
587
634
  t5 = $[7];
588
635
  }
589
- const t6 = binding === null;
590
- const t7 = counting ? countId : undefined;
591
- let t8;
592
- if ($[8] !== binding) {
593
- t8 = event => binding?.onValueChange(event.target.value);
594
- $[8] = binding;
595
- $[9] = t8;
596
- } else {
597
- t8 = $[9];
598
- }
599
- let t9;
600
- if ($[10] !== id || $[11] !== maxLength || $[12] !== placeholder || $[13] !== t6 || $[14] !== t7 || $[15] !== t8 || $[16] !== value) {
601
- t9 = /*#__PURE__*/_jsx(Input, {
636
+ let t6;
637
+ if ($[8] !== binding || $[9] !== countId || $[10] !== counting || $[11] !== id || $[12] !== maxLength || $[13] !== multiline || $[14] !== placeholder || $[15] !== value) {
638
+ t6 = multiline === true ? /*#__PURE__*/_jsx(TextArea, {
602
639
  id: id,
603
640
  value: value,
604
641
  size: "sm",
642
+ rows: 2,
605
643
  maxLength: maxLength,
606
644
  placeholder: placeholder,
607
- disabled: t6,
608
- "aria-describedby": t7,
645
+ disabled: binding === null,
646
+ "aria-describedby": counting ? countId : undefined,
647
+ className: "max-h-40 field-sizing-content border-transparent bg-ui-tile",
648
+ onChange: event => binding?.onValueChange(event.target.value)
649
+ }) : /*#__PURE__*/_jsx(Input, {
650
+ id: id,
651
+ value: value,
652
+ size: "sm",
653
+ maxLength: maxLength,
654
+ placeholder: placeholder,
655
+ disabled: binding === null,
656
+ "aria-describedby": counting ? countId : undefined,
609
657
  className: "border-transparent bg-ui-tile",
610
- onChange: t8
658
+ onChange: event_0 => binding?.onValueChange(event_0.target.value)
611
659
  });
612
- $[10] = id;
613
- $[11] = maxLength;
614
- $[12] = placeholder;
615
- $[13] = t6;
616
- $[14] = t7;
617
- $[15] = t8;
618
- $[16] = value;
619
- $[17] = t9;
660
+ $[8] = binding;
661
+ $[9] = countId;
662
+ $[10] = counting;
663
+ $[11] = id;
664
+ $[12] = maxLength;
665
+ $[13] = multiline;
666
+ $[14] = placeholder;
667
+ $[15] = value;
668
+ $[16] = t6;
620
669
  } else {
621
- t9 = $[17];
670
+ t6 = $[16];
622
671
  }
623
- let t10;
624
- if ($[18] !== countId || $[19] !== counting || $[20] !== maxLength || $[21] !== t || $[22] !== value.length) {
625
- t10 = counting && /*#__PURE__*/_jsx("span", {
672
+ let t7;
673
+ if ($[17] !== countId || $[18] !== counting || $[19] !== maxLength || $[20] !== t || $[21] !== value.length) {
674
+ t7 = counting && /*#__PURE__*/_jsx("span", {
626
675
  id: countId,
627
676
  className: "text-xs text-text-muted tabular-nums",
628
677
  children: t("blocks.textField.count", {
@@ -630,30 +679,225 @@ export function TextFieldRenderer(t0) {
630
679
  max: formatNumber(maxLength)
631
680
  })
632
681
  });
633
- $[18] = countId;
634
- $[19] = counting;
635
- $[20] = maxLength;
636
- $[21] = t;
637
- $[22] = value.length;
638
- $[23] = t10;
682
+ $[17] = countId;
683
+ $[18] = counting;
684
+ $[19] = maxLength;
685
+ $[20] = t;
686
+ $[21] = value.length;
687
+ $[22] = t7;
639
688
  } else {
640
- t10 = $[23];
689
+ t7 = $[22];
641
690
  }
642
- let t11;
643
- if ($[24] !== t10 || $[25] !== t4 || $[26] !== t5 || $[27] !== t9) {
644
- t11 = /*#__PURE__*/_jsxs("div", {
691
+ let t8;
692
+ if ($[23] !== t4 || $[24] !== t5 || $[25] !== t6 || $[26] !== t7) {
693
+ t8 = /*#__PURE__*/_jsxs("div", {
645
694
  className: t4,
646
- children: [t5, t9, t10]
695
+ children: [t5, t6, t7]
647
696
  });
648
- $[24] = t10;
649
- $[25] = t4;
650
- $[26] = t5;
651
- $[27] = t9;
652
- $[28] = t11;
697
+ $[23] = t4;
698
+ $[24] = t5;
699
+ $[25] = t6;
700
+ $[26] = t7;
701
+ $[27] = t8;
653
702
  } else {
654
- t11 = $[28];
703
+ t8 = $[27];
655
704
  }
656
- return t11;
705
+ return t8;
706
+ }
707
+ /* What a person typed as a number, or null for text that is none or lies outside the field's range. */
708
+ function typedNumber(text, min, max) {
709
+ const value = text.trim() === '' ? Number.NaN : Number(text);
710
+ return Number.isFinite(value) && (min === undefined || value >= min) && (max === undefined || value <= max) ? value : null;
711
+ }
712
+ /*
713
+ * A number a person types: the label above the field, the unit inside it at the end. What is typed stays in
714
+ * the field while it has the focus, and reaches the local state only as a number inside the range, so a
715
+ * half-typed or refused value never leaves the block. Leaving the field puts the last good number back.
716
+ */
717
+ export function NumberFieldRenderer(t0) {
718
+ const $ = _c(43);
719
+ const {
720
+ node,
721
+ children,
722
+ context
723
+ } = t0;
724
+ const {
725
+ t
726
+ } = useTranslation("agent-chat");
727
+ const id = useId();
728
+ let t1;
729
+ if ($[0] !== context || $[1] !== node) {
730
+ t1 = bindingOf(node, context);
731
+ $[0] = context;
732
+ $[1] = node;
733
+ $[2] = t1;
734
+ } else {
735
+ t1 = $[2];
736
+ }
737
+ const binding = t1;
738
+ const {
739
+ min,
740
+ max,
741
+ step,
742
+ unit
743
+ } = node.props;
744
+ const value = binding?.value ?? node.props.value;
745
+ const [typed, setTyped] = useState(null);
746
+ let t2;
747
+ if ($[3] !== max || $[4] !== min || $[5] !== typed) {
748
+ t2 = typed !== null && typedNumber(typed, min, max) === null;
749
+ $[3] = max;
750
+ $[4] = min;
751
+ $[5] = typed;
752
+ $[6] = t2;
753
+ } else {
754
+ t2 = $[6];
755
+ }
756
+ const refused = t2;
757
+ const hintId = `${id}-hint`;
758
+ let t3;
759
+ if ($[7] !== max || $[8] !== min || $[9] !== t) {
760
+ t3 = min !== undefined && max !== undefined ? t("blocks.numberField.between", {
761
+ min: formatRounded(min, 6),
762
+ max: formatRounded(max, 6)
763
+ }) : min !== undefined ? t("blocks.numberField.atLeast", {
764
+ min: formatRounded(min, 6)
765
+ }) : max !== undefined ? t("blocks.numberField.atMost", {
766
+ max: formatRounded(max, 6)
767
+ }) : t("blocks.numberField.number");
768
+ $[7] = max;
769
+ $[8] = min;
770
+ $[9] = t;
771
+ $[10] = t3;
772
+ } else {
773
+ t3 = $[10];
774
+ }
775
+ const range = t3;
776
+ const t4 = !node.complete && PENDING;
777
+ let t5;
778
+ if ($[11] !== t4) {
779
+ t5 = clsx("flex flex-col gap-1.5", t4);
780
+ $[11] = t4;
781
+ $[12] = t5;
782
+ } else {
783
+ t5 = $[12];
784
+ }
785
+ let t6;
786
+ if ($[13] !== children || $[14] !== id) {
787
+ t6 = /*#__PURE__*/_jsx("label", {
788
+ htmlFor: id,
789
+ className: "px-0.5 text-2xs text-text-muted",
790
+ children: children
791
+ });
792
+ $[13] = children;
793
+ $[14] = id;
794
+ $[15] = t6;
795
+ } else {
796
+ t6 = $[15];
797
+ }
798
+ const t7 = typed ?? String(value);
799
+ const t8 = step ?? "any";
800
+ const t9 = binding === null;
801
+ const t10 = refused || undefined;
802
+ const t11 = refused ? hintId : undefined;
803
+ let t12;
804
+ if ($[16] !== unit) {
805
+ t12 = unit !== undefined && unit !== "" ? /*#__PURE__*/_jsx("span", {
806
+ className: "pr-1.5 text-2xs text-text-muted",
807
+ children: unit
808
+ }) : undefined;
809
+ $[16] = unit;
810
+ $[17] = t12;
811
+ } else {
812
+ t12 = $[17];
813
+ }
814
+ let t13;
815
+ if ($[18] !== binding || $[19] !== max || $[20] !== min) {
816
+ t13 = event => {
817
+ const text = event.target.value;
818
+ const number = typedNumber(text, min, max);
819
+ setTyped(text);
820
+ if (number !== null) {
821
+ binding?.onValueChange(number);
822
+ }
823
+ };
824
+ $[18] = binding;
825
+ $[19] = max;
826
+ $[20] = min;
827
+ $[21] = t13;
828
+ } else {
829
+ t13 = $[21];
830
+ }
831
+ let t14;
832
+ if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
833
+ t14 = () => setTyped(null);
834
+ $[22] = t14;
835
+ } else {
836
+ t14 = $[22];
837
+ }
838
+ let t15;
839
+ if ($[23] !== id || $[24] !== max || $[25] !== min || $[26] !== t10 || $[27] !== t11 || $[28] !== t12 || $[29] !== t13 || $[30] !== t7 || $[31] !== t8 || $[32] !== t9) {
840
+ t15 = /*#__PURE__*/_jsx(Input, {
841
+ id: id,
842
+ type: "number",
843
+ inputMode: "decimal",
844
+ value: t7,
845
+ size: "sm",
846
+ min: min,
847
+ max: max,
848
+ step: t8,
849
+ disabled: t9,
850
+ "aria-invalid": t10,
851
+ "aria-describedby": t11,
852
+ className: "border-transparent bg-ui-tile",
853
+ end: t12,
854
+ onChange: t13,
855
+ onBlur: t14
856
+ });
857
+ $[23] = id;
858
+ $[24] = max;
859
+ $[25] = min;
860
+ $[26] = t10;
861
+ $[27] = t11;
862
+ $[28] = t12;
863
+ $[29] = t13;
864
+ $[30] = t7;
865
+ $[31] = t8;
866
+ $[32] = t9;
867
+ $[33] = t15;
868
+ } else {
869
+ t15 = $[33];
870
+ }
871
+ let t16;
872
+ if ($[34] !== hintId || $[35] !== range || $[36] !== refused) {
873
+ t16 = refused && /*#__PURE__*/_jsx("span", {
874
+ id: hintId,
875
+ role: "status",
876
+ className: "text-2xs text-status-error",
877
+ children: range
878
+ });
879
+ $[34] = hintId;
880
+ $[35] = range;
881
+ $[36] = refused;
882
+ $[37] = t16;
883
+ } else {
884
+ t16 = $[37];
885
+ }
886
+ let t17;
887
+ if ($[38] !== t15 || $[39] !== t16 || $[40] !== t5 || $[41] !== t6) {
888
+ t17 = /*#__PURE__*/_jsxs("div", {
889
+ className: t5,
890
+ children: [t6, t15, t16]
891
+ });
892
+ $[38] = t15;
893
+ $[39] = t16;
894
+ $[40] = t5;
895
+ $[41] = t6;
896
+ $[42] = t17;
897
+ } else {
898
+ t17 = $[42];
899
+ }
900
+ return t17;
657
901
  }
658
902
  /*
659
903
  * Left aligned, never the full width. Like Segmented, each Option is an item by its place, since a value may be any scalar.
@@ -0,0 +1,3 @@
1
+ import type { UiProps } from '@adecore/intelligent-ui';
2
+ import type { UiRendererProps } from '../render-context.js';
3
+ export declare function KeysRenderer({ node }: UiRendererProps<UiProps<'Keys'>>): import("react").JSX.Element | null;
@@ -0,0 +1,60 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { KeyCap } from '@adecore/ui';
3
+ import { useChatHost } from '../../../../host/host.js';
4
+ import { uiKeyCaps } from '../key-caps.js';
5
+ import { uiNodeLabel } from '../node-text.js';
6
+ /* Inline, so a shortcut stands in the sentence that names it. */
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ export function KeysRenderer(t0) {
9
+ const $ = _c(8);
10
+ const {
11
+ node
12
+ } = t0;
13
+ const host = useChatHost();
14
+ let t1;
15
+ let t2;
16
+ let t3;
17
+ if ($[0] !== host || $[1] !== node) {
18
+ t3 = Symbol.for("react.early_return_sentinel");
19
+ bb0: {
20
+ const caps = uiKeyCaps(uiNodeLabel(node), host.isApplePlatform());
21
+ if (caps.length === 0) {
22
+ t3 = null;
23
+ break bb0;
24
+ }
25
+ t1 = "mx-0.5 inline-flex items-center gap-0.5 align-middle";
26
+ t2 = caps.map(_temp);
27
+ }
28
+ $[0] = host;
29
+ $[1] = node;
30
+ $[2] = t1;
31
+ $[3] = t2;
32
+ $[4] = t3;
33
+ } else {
34
+ t1 = $[2];
35
+ t2 = $[3];
36
+ t3 = $[4];
37
+ }
38
+ if (t3 !== Symbol.for("react.early_return_sentinel")) {
39
+ return t3;
40
+ }
41
+ let t4;
42
+ if ($[5] !== t1 || $[6] !== t2) {
43
+ t4 = /*#__PURE__*/_jsx("span", {
44
+ className: t1,
45
+ children: t2
46
+ });
47
+ $[5] = t1;
48
+ $[6] = t2;
49
+ $[7] = t4;
50
+ } else {
51
+ t4 = $[7];
52
+ }
53
+ return t4;
54
+ }
55
+ function _temp(cap, index) {
56
+ return /*#__PURE__*/_jsx(KeyCap, {
57
+ size: "sm",
58
+ children: cap
59
+ }, `${cap}-${index}`);
60
+ }
@@ -1,6 +1,17 @@
1
1
  import type { UiProps } from '@adecore/intelligent-ui';
2
- import type { UiRendererProps } from '../render-context.js';
2
+ import type { ReactNode } from 'react';
3
+ import type { UiLinkTarget, UiRenderContext, UiRendererProps } from '../render-context.js';
4
+ export declare function UiLinkChip({ target, context, refused }: {
5
+ target: UiLinkTarget;
6
+ context: UiRenderContext;
7
+ refused?: string;
8
+ }): import("react").JSX.Element;
9
+ export declare function LinkRow({ target, context, described, children }: {
10
+ target: UiLinkTarget;
11
+ context: UiRenderContext;
12
+ described: boolean;
13
+ children: ReactNode;
14
+ }): import("react").JSX.Element;
3
15
  export declare function FileRenderer({ node, children, context }: UiRendererProps<UiProps<'File'>>): import("react").JSX.Element;
4
- export declare function DiffRenderer({ node, children, context }: UiRendererProps<UiProps<'Diff'>>): import("react").JSX.Element;
5
16
  export declare function CommitRenderer({ node, children, context }: UiRendererProps<UiProps<'Commit'>>): import("react").JSX.Element;
6
17
  export declare function NodeRenderer({ node, children, context }: UiRendererProps<UiProps<'Node'>>): import("react").JSX.Element;