@qoretechnologies/reqraft 0.10.46-pr.95.ge595a13 → 0.10.46

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 (147) hide show
  1. package/.claude/CLAUDE.md +12 -0
  2. package/.tasks/INDEX.md +1 -0
  3. package/.tasks/TEMPLATE_TOKEN_GRAMMAR.md +72 -0
  4. package/dist/components/composer/Composer.d.ts.map +1 -1
  5. package/dist/components/composer/Composer.js +5 -1
  6. package/dist/components/composer/Composer.js.map +1 -1
  7. package/dist/components/form/engine/CompactRow.d.ts +14 -0
  8. package/dist/components/form/engine/CompactRow.d.ts.map +1 -1
  9. package/dist/components/form/engine/CompactRow.js +199 -41
  10. package/dist/components/form/engine/CompactRow.js.map +1 -1
  11. package/dist/components/form/engine/CompactToolbar.d.ts.map +1 -1
  12. package/dist/components/form/engine/CompactToolbar.js +72 -72
  13. package/dist/components/form/engine/CompactToolbar.js.map +1 -1
  14. package/dist/components/form/engine/FormEngine.d.ts +65 -1
  15. package/dist/components/form/engine/FormEngine.d.ts.map +1 -1
  16. package/dist/components/form/engine/FormEngine.js +276 -108
  17. package/dist/components/form/engine/FormEngine.js.map +1 -1
  18. package/dist/components/form/engine/_structuredData/SchemaDataView.d.ts.map +1 -1
  19. package/dist/components/form/engine/_structuredData/SchemaDataView.js +55 -13
  20. package/dist/components/form/engine/_structuredData/SchemaDataView.js.map +1 -1
  21. package/dist/components/form/engine/_structuredData/structuredData.d.ts +15 -0
  22. package/dist/components/form/engine/_structuredData/structuredData.d.ts.map +1 -1
  23. package/dist/components/form/engine/_structuredData/structuredData.js +22 -1
  24. package/dist/components/form/engine/_structuredData/structuredData.js.map +1 -1
  25. package/dist/components/form/engine/compactRowStyles.d.ts.map +1 -1
  26. package/dist/components/form/engine/compactRowStyles.js +15 -3
  27. package/dist/components/form/engine/compactRowStyles.js.map +1 -1
  28. package/dist/components/form/engine/compactToolbarContext.d.ts +8 -0
  29. package/dist/components/form/engine/compactToolbarContext.d.ts.map +1 -1
  30. package/dist/components/form/engine/compactToolbarContext.js.map +1 -1
  31. package/dist/components/form/engine/readFirst.d.ts +24 -0
  32. package/dist/components/form/engine/readFirst.d.ts.map +1 -1
  33. package/dist/components/form/engine/readFirst.js +84 -6
  34. package/dist/components/form/engine/readFirst.js.map +1 -1
  35. package/dist/components/form/fields/Field.d.ts.map +1 -1
  36. package/dist/components/form/fields/Field.js +1 -1
  37. package/dist/components/form/fields/Field.js.map +1 -1
  38. package/dist/components/form/fields/allowed-values/AllowedValues.d.ts +12 -2
  39. package/dist/components/form/fields/allowed-values/AllowedValues.d.ts.map +1 -1
  40. package/dist/components/form/fields/allowed-values/AllowedValues.js +16 -6
  41. package/dist/components/form/fields/allowed-values/AllowedValues.js.map +1 -1
  42. package/dist/components/form/fields/auto/AutoFormField.d.ts.map +1 -1
  43. package/dist/components/form/fields/auto/AutoFormField.js +64 -14
  44. package/dist/components/form/fields/auto/AutoFormField.js.map +1 -1
  45. package/dist/components/form/fields/long-string/LongString.d.ts +9 -1
  46. package/dist/components/form/fields/long-string/LongString.d.ts.map +1 -1
  47. package/dist/components/form/fields/long-string/LongString.js +25 -4
  48. package/dist/components/form/fields/long-string/LongString.js.map +1 -1
  49. package/dist/components/form/fields/template/ExampleValueModal.d.ts +29 -0
  50. package/dist/components/form/fields/template/ExampleValueModal.d.ts.map +1 -0
  51. package/dist/components/form/fields/template/ExampleValueModal.js +122 -0
  52. package/dist/components/form/fields/template/ExampleValueModal.js.map +1 -0
  53. package/dist/components/form/fields/template/ReadOnlyTemplateTag.d.ts.map +1 -1
  54. package/dist/components/form/fields/template/ReadOnlyTemplateTag.js +3 -3
  55. package/dist/components/form/fields/template/ReadOnlyTemplateTag.js.map +1 -1
  56. package/dist/components/form/fields/template/TemplateField.d.ts.map +1 -1
  57. package/dist/components/form/fields/template/TemplateField.js +81 -27
  58. package/dist/components/form/fields/template/TemplateField.js.map +1 -1
  59. package/dist/components/form/fields/template/__fixtures__/longExampleValue.d.ts +2 -0
  60. package/dist/components/form/fields/template/__fixtures__/longExampleValue.d.ts.map +1 -0
  61. package/dist/components/form/fields/template/__fixtures__/longExampleValue.js +9 -0
  62. package/dist/components/form/fields/template/__fixtures__/longExampleValue.js.map +1 -0
  63. package/dist/components/form/index.d.ts +1 -0
  64. package/dist/components/form/index.d.ts.map +1 -1
  65. package/dist/components/form/index.js +1 -0
  66. package/dist/components/form/index.js.map +1 -1
  67. package/dist/components/searchFilterBar/SearchFilterBar.d.ts +12 -1
  68. package/dist/components/searchFilterBar/SearchFilterBar.d.ts.map +1 -1
  69. package/dist/components/searchFilterBar/SearchFilterBar.js +2 -2
  70. package/dist/components/searchFilterBar/SearchFilterBar.js.map +1 -1
  71. package/dist/components/ticketThread/TicketThread.d.ts.map +1 -1
  72. package/dist/components/ticketThread/TicketThread.js +1 -1
  73. package/dist/components/ticketThread/TicketThread.js.map +1 -1
  74. package/dist/helpers/common.d.ts +8 -1
  75. package/dist/helpers/common.d.ts.map +1 -1
  76. package/dist/helpers/common.js +9 -1
  77. package/dist/helpers/common.js.map +1 -1
  78. package/dist/helpers/expressions.d.ts.map +1 -1
  79. package/dist/helpers/expressions.js +15 -2
  80. package/dist/helpers/expressions.js.map +1 -1
  81. package/dist/helpers/optionUiTypes.d.ts +30 -0
  82. package/dist/helpers/optionUiTypes.d.ts.map +1 -0
  83. package/dist/helpers/optionUiTypes.js +156 -0
  84. package/dist/helpers/optionUiTypes.js.map +1 -0
  85. package/dist/helpers/options.d.ts +19 -0
  86. package/dist/helpers/options.d.ts.map +1 -1
  87. package/dist/helpers/options.js +25 -1
  88. package/dist/helpers/options.js.map +1 -1
  89. package/dist/helpers/providerValue.d.ts +68 -0
  90. package/dist/helpers/providerValue.d.ts.map +1 -0
  91. package/dist/helpers/providerValue.js +50 -0
  92. package/dist/helpers/providerValue.js.map +1 -0
  93. package/dist/helpers/singleLineString.d.ts +37 -0
  94. package/dist/helpers/singleLineString.d.ts.map +1 -0
  95. package/dist/helpers/singleLineString.js +66 -0
  96. package/dist/helpers/singleLineString.js.map +1 -0
  97. package/dist/helpers/templates.d.ts +100 -0
  98. package/dist/helpers/templates.d.ts.map +1 -1
  99. package/dist/helpers/templates.js +237 -4
  100. package/dist/helpers/templates.js.map +1 -1
  101. package/dist/helpers/validations.d.ts +103 -2
  102. package/dist/helpers/validations.d.ts.map +1 -1
  103. package/dist/helpers/validations.js +858 -91
  104. package/dist/helpers/validations.js.map +1 -1
  105. package/dist/index.d.ts +1 -1
  106. package/dist/index.d.ts.map +1 -1
  107. package/dist/index.js +2 -1
  108. package/dist/index.js.map +1 -1
  109. package/package.json +1 -1
  110. package/src/components/composer/Composer.tsx +7 -3
  111. package/src/components/form/engine/CompactRow.tsx +279 -33
  112. package/src/components/form/engine/CompactToolbar.tsx +105 -98
  113. package/src/components/form/engine/FormEngine.stories.tsx +995 -12
  114. package/src/components/form/engine/FormEngine.tsx +377 -94
  115. package/src/components/form/engine/_structuredData/SchemaDataView.stories.tsx +104 -0
  116. package/src/components/form/engine/_structuredData/SchemaDataView.tsx +158 -101
  117. package/src/components/form/engine/_structuredData/structuredData.ts +20 -0
  118. package/src/components/form/engine/compactRowStyles.ts +55 -1
  119. package/src/components/form/engine/compactToolbarContext.ts +8 -0
  120. package/src/components/form/engine/readFirst.ts +125 -35
  121. package/src/components/form/fields/Field.tsx +3 -1
  122. package/src/components/form/fields/allowed-values/AllowedValues.tsx +24 -2
  123. package/src/components/form/fields/array/ArrayAutoField.stories.tsx +81 -0
  124. package/src/components/form/fields/auto/AutoFormField.stories.tsx +47 -1
  125. package/src/components/form/fields/auto/AutoFormField.tsx +73 -11
  126. package/src/components/form/fields/long-string/LongString.tsx +46 -5
  127. package/src/components/form/fields/schema-definition/SchemaDefinitionField.stories.tsx +5 -0
  128. package/src/components/form/fields/template/ExampleValueModal.stories.tsx +114 -0
  129. package/src/components/form/fields/template/ExampleValueModal.tsx +99 -0
  130. package/src/components/form/fields/template/ReadOnlyTemplateTag.tsx +8 -4
  131. package/src/components/form/fields/template/TemplateField.stories.tsx +389 -1
  132. package/src/components/form/fields/template/TemplateField.tsx +100 -35
  133. package/src/components/form/fields/template/__fixtures__/longExampleValue.ts +7 -0
  134. package/src/components/form/index.tsx +1 -0
  135. package/src/components/searchFilterBar/SearchFilterBar.stories.tsx +62 -0
  136. package/src/components/searchFilterBar/SearchFilterBar.tsx +13 -0
  137. package/src/components/ticketThread/TicketThread.tsx +7 -0
  138. package/src/helpers/common.ts +11 -1
  139. package/src/helpers/expressions.ts +16 -2
  140. package/src/helpers/optionUiTypes.ts +161 -0
  141. package/src/helpers/options.ts +23 -0
  142. package/src/helpers/providerValue.ts +125 -0
  143. package/src/helpers/singleLineString.ts +61 -0
  144. package/src/helpers/templates.ts +272 -3
  145. package/src/helpers/validations.ts +1177 -109
  146. package/src/hooks/useWebSocket/useWebsocket.stories.tsx +23 -2
  147. package/src/index.tsx +1 -0
@@ -93,7 +93,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
93
93
  return (mod && mod.__esModule) ? mod : { "default": mod };
94
94
  };
95
95
  Object.defineProperty(exports, "__esModule", { value: true });
96
- exports.CompactRow = void 0;
96
+ exports.CompactRow = exports.richtextItemText = void 0;
97
97
  var jsx_runtime_1 = require("react/jsx-runtime");
98
98
  var reqore_1 = require("@qoretechnologies/reqore");
99
99
  var optionActions_1 = require("./optionActions");
@@ -178,6 +178,25 @@ var MAX_INLINE_OPTION_ACTIONS = 2;
178
178
  // One read-first row: label | value | action collapsed; the real editor (the
179
179
  // classic renderOption) expanded. `hidden` = search-surfaced optional —
180
180
  // activating the row adds the field first.
181
+ /**
182
+ * The text inside a rich-text envelope, when a list item is one.
183
+ *
184
+ * An option like Gmail's `to` is `type: "list"`, `element_type: "string"`,
185
+ * `supports_templates: true`: each element is a plain string that may carry
186
+ * template tags, so its editor is a rich-text one and the element value arrives
187
+ * wrapped as `{type: "richtext", value: [{type: "paragraph", …}]}`.
188
+ *
189
+ * That envelope is a string in a coat, not structured data. The hash-list test
190
+ * unwraps `item.value`, found the Slate document — an object — and classed a
191
+ * list of email addresses as a list of hashes, so the row drew an expandable
192
+ * `type / children / text` tree instead of the address the operator typed.
193
+ */
194
+ var richtextItemText = function (item) {
195
+ return item && typeof item === 'object' && item.type === 'richtext' ?
196
+ (0, common_1.richtextToString)(item.value)
197
+ : undefined;
198
+ };
199
+ exports.richtextItemText = richtextItemText;
181
200
  exports.CompactRow = (0, react_1.memo)(function (_a) {
182
201
  var _b;
183
202
  var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
@@ -239,6 +258,26 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
239
258
  // renderer when it supplied one, reqraft's own otherwise.
240
259
  // Value-cell content: colour adds a swatch, file an icon + size; hash keeps
241
260
  // its "N fields" summary (sub-fields reveal beneath the row).
261
+ /**
262
+ * Flattens the line breaks in one prose segment of a richtext SUMMARY.
263
+ *
264
+ * The read-first row is a single line: every other value type reaches it
265
+ * through `whiteSpace: 'nowrap'`, which collapses newlines for free. The
266
+ * richtext branch is the only one that opts into `'pre'` — it has to, or the
267
+ * spaces that separate a word from the chip beside it are dropped — and `pre`
268
+ * also honours the newlines, which `nowrap` would have eaten.
269
+ *
270
+ * So a genuinely multi-line value (an alert rule's Gmail message body is five
271
+ * `\n`-separated lines) gave each segment after the first a blank first line.
272
+ * The wrapper centres its items, so a two-line-tall box centred against
273
+ * one-line chips put every word 12px below the chip beside it, and the row
274
+ * read as a staircase. Measured on supah: prose boxes 30px against 14px chips.
275
+ *
276
+ * A space, not nothing: consecutive prose segments are merged before they get
277
+ * here, so a value with a break and no chip between its lines would otherwise
278
+ * lose the word boundary entirely.
279
+ */
280
+ var collapseSummaryBreaks = function (text) { return text.replace(/\s*\r?\n\s*/g, ' '); };
242
281
  var renderReadFirstValue = function (field, schema, formatted) {
243
282
  var valueType = (0, readFirst_1.getValueType)(field, schema);
244
283
  var wrapStyle = {
@@ -281,14 +320,14 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
281
320
  // carry its value or it disappears from the form entirely when closed.
282
321
  // It reads as a chip beside the size chip — "Qore · 62 lines" — which
283
322
  // is the same summary the read-only interface pages already show.
284
- return ((0, jsx_runtime_1.jsxs)(reqore_1.ReqoreControlGroup, { gapSize: 'tiny', verticalAlign: 'center', wrap: true, children: [(absorbedFields !== null && absorbedFields !== void 0 ? absorbedFields : []).map(function (absorbedName) {
285
- var _a;
286
- var absorbedValue = (_a = availableOptions === null || availableOptions === void 0 ? void 0 : availableOptions[absorbedName]) === null || _a === void 0 ? void 0 : _a.value;
287
- if (absorbedValue === undefined || absorbedValue === null || absorbedValue === '') {
288
- return null;
289
- }
290
- return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { className: 'options-readfirst-absorbed-tag', size: 'small', minimal: true, label: String(absorbedValue), tooltip: getAbsorbedLabel(absorbedName) }, absorbedName));
291
- }), (0, jsx_runtime_1.jsx)(codeSize_1.ReqraftCodeSizeTag, { code: field.value })] }));
323
+ return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreControlGroup, { gapSize: 'tiny', verticalAlign: 'center', wrap: true, children: (absorbedFields !== null && absorbedFields !== void 0 ? absorbedFields : []).map(function (absorbedName) {
324
+ var _a;
325
+ var absorbedValue = (_a = availableOptions === null || availableOptions === void 0 ? void 0 : availableOptions[absorbedName]) === null || _a === void 0 ? void 0 : _a.value;
326
+ if (absorbedValue === undefined || absorbedValue === null || absorbedValue === '') {
327
+ return null;
328
+ }
329
+ return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { className: 'options-readfirst-absorbed-tag', size: 'small', minimal: true, label: String(absorbedValue), tooltip: getAbsorbedLabel(absorbedName) }, absorbedName));
330
+ }) }));
292
331
  }
293
332
  // Markdown read summary: the row prints the value's prose (the markdown
294
333
  // markers are stripped by `formatOptionValue`), so a multi-line document
@@ -322,6 +361,14 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
322
361
  (0, templates_1.isValueTemplate)(field.value)) {
323
362
  return (0, jsx_runtime_1.jsx)(ReadOnlyTemplateTag_1.ReadOnlyTemplateTag, { value: field.value, templates: templates, size: 'small' });
324
363
  }
364
+ // A LIST whose elements are rich-text envelopes is a list of strings, so it
365
+ // reads as those strings. Without this the row fell through to the generic
366
+ // list summary and printed a bare count ("1 item") above the structured
367
+ // tree, never the address itself.
368
+ if (Array.isArray(field === null || field === void 0 ? void 0 : field.value) && field.value.some(function (item) { return (0, exports.richtextItemText)(item) !== undefined; })) {
369
+ var texts = field.value.map(function (item) { var _a; return (_a = (0, exports.richtextItemText)(item)) !== null && _a !== void 0 ? _a : String(item !== null && item !== void 0 ? item : ''); });
370
+ return (0, jsx_runtime_1.jsx)("span", { style: textStyle, children: texts.filter(function (text) { return text !== ''; }).join(', ') });
371
+ }
325
372
  // Richtext read-first summary: inline $-chips for embedded template tags
326
373
  // with the prose around them (the IDE intent scheme via getTemplateTagStyle),
327
374
  // kept lightweight instead of mounting the full editor — that lives in the
@@ -341,6 +388,33 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
341
388
  // size makes centring align the baselines too, at whatever font
342
389
  // size the consuming app uses.
343
390
  style: { fontSize: 'inherit' }, icon: 'ExchangeDollarLine', label: segment.text || segment.value, tooltip: segment.value }, (0, templates_1.getTemplateTagStyle)((_a = (templates ? (0, templates_1.findTemplate)(templates, segment.value || '') : undefined)) === null || _a === void 0 ? void 0 : _a.metadata)), index)
391
+ : (0, jsx_runtime_1.jsx)("span", { style: { whiteSpace: 'pre' }, children: collapseSummaryBreaks(segment.text) }, index);
392
+ }) }));
393
+ }
394
+ }
395
+ // An expression summarises to one line of text, and a template reference
396
+ // inside it printed as its own raw token — `$data:{…}` renders a value as
397
+ // code where a name belongs. Chip every reference here, on the richtext
398
+ // branch's pattern above, so the wrapper (`trim(`…`)`) still reads as the
399
+ // text it is while the reference reads as a name.
400
+ //
401
+ // Unconditionally: a surface with no catalogue (the Automation Hub
402
+ // template preview never fetches one) still shows the reference's own
403
+ // path, which is the point — a conditional chip is no chip at all
404
+ // exactly where the raw token looks worst.
405
+ if ((field === null || field === void 0 ? void 0 : field.is_expression) && formatted) {
406
+ var segments = (0, templates_1.splitTemplateTokens)(formatted);
407
+ var named = segments.map(function (segment) {
408
+ return segment.kind === 'token' ? __assign(__assign({}, segment), (0, templates_1.describeTemplateReference)(templates, segment.text)) : segment;
409
+ });
410
+ if (named.some(function (segment) { return segment.kind === 'token'; })) {
411
+ return ((0, jsx_runtime_1.jsx)("span", { style: __assign(__assign({}, wrapStyle), { gap: 4, overflow: 'hidden' }), children: named.map(function (segment, index) {
412
+ var _a;
413
+ return segment.kind === 'token' ?
414
+ (0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, __assign({ size: 'tiny',
415
+ // Inherit the row's font size so the chip shares a baseline
416
+ // with the text around it — see the richtext branch above.
417
+ style: { fontSize: 'inherit' }, icon: 'ExchangeDollarLine', label: segment.label, tooltip: segment.text }, (0, templates_1.getTemplateTagStyle)((_a = segment.item) === null || _a === void 0 ? void 0 : _a.metadata)), index)
344
418
  : (0, jsx_runtime_1.jsx)("span", { style: { whiteSpace: 'pre' }, children: segment.text }, index);
345
419
  }) }));
346
420
  }
@@ -635,7 +709,7 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
635
709
  // Not offered when the close action is passive (read-only, or a fixed
636
710
  // choice) — nothing can have been typed, so there is nothing to cancel.
637
711
  var cancelEditButton = !isPassiveCloseAction && editedSinceOpened ?
638
- (0, jsx_runtime_1.jsx)(reqore_1.ReqoreButton, { className: 'options-readfirst-cancel', size: 'small', flat: true, fixed: true, icon: 'CloseLine', intent: 'warning', "aria-label": 'Cancel edit', tooltip: 'Cancel edit \u2014 discard the changes made since this field was opened', onClick: function (event) {
712
+ (0, jsx_runtime_1.jsx)(reqore_1.ReqoreButton, { className: 'options-readfirst-cancel', size: 'small', flat: true, minimal: true, fixed: true, icon: 'CloseLine', intent: 'warning', "aria-label": 'Cancel edit', tooltip: 'Cancel edit \u2014 discard the changes made since this field was opened', onClick: function (event) {
639
713
  event.stopPropagation();
640
714
  cancelEdit();
641
715
  } })
@@ -702,7 +776,12 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
702
776
  handleOptionLabelClick(optionName);
703
777
  } })
704
778
  : null;
705
- var renderInfoStrip = function (m, index) { return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreMessage, { size: 'small', opaque: false, flat: true, intent: m.intent, title: m.title, children: m.content }, "".concat(m.content, "-").concat(index))); };
779
+ // The gap rides on the message itself rather than on the panel around it:
780
+ // the panel is a vertical ReqoreControlGroup, which owns its own layout and
781
+ // stacks children flush, and the class rule that used to carry a 4px gap
782
+ // never reached this element at all — which is why two messages read as one
783
+ // two-tone block with no space between them.
784
+ var renderInfoStrip = function (m, index) { return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreMessage, { size: 'small', opaque: false, flat: true, intent: m.intent, title: m.title, style: { marginBottom: 8 }, children: m.content }, "".concat(m.content, "-").concat(index))); };
706
785
  var reasonColor = function (intent) {
707
786
  var _a;
708
787
  return intent === 'danger' ? cDanger
@@ -770,7 +849,11 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
770
849
  var absorbedField = availableOptions === null || availableOptions === void 0 ? void 0 : availableOptions[absorbedName];
771
850
  if (!absorbedField)
772
851
  return null;
773
- return ((0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledAbsorbedField, { className: 'options-readfirst-absorbed', children: [(0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledAbsorbedLabel, { size: 'small', effect: { opacity: 0.6 }, children: getAbsorbedLabel(absorbedName) }), (0, jsx_runtime_1.jsx)("div", { style: { minWidth: 0, flex: 1 }, children: renderOption(absorbedName, absorbedField, 'small', true) })] }, absorbedName));
852
+ return (
853
+ // No label element of its own: the editor now heads itself with
854
+ // the field's name (see FieldAllowedValuesCheckGroup), so a label
855
+ // beside it printed the same word twice.
856
+ (0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledAbsorbedField, { className: 'options-readfirst-absorbed', children: (0, jsx_runtime_1.jsx)("div", { style: { minWidth: 0, flex: 1 }, children: renderOption(absorbedName, absorbedField, 'small', true) }) }, absorbedName));
774
857
  })
775
858
  .filter(Boolean)
776
859
  : null;
@@ -778,12 +861,31 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
778
861
  // branch returns before that point, and its editor needs to know whether it is
779
862
  // holding code.
780
863
  var valueType = (0, readFirst_1.getValueType)(optionField, schema);
864
+ // How much source there is describes the FIELD, not its value, so the count
865
+ // sits under the field's name — the same rule `lineCountNote` already
866
+ // follows for a multi-line markdown value, and the same reason: the value
867
+ // column carries the value and nothing else. It renders on the read row and
868
+ // the open one alike, because "how much code is here?" is a question that
869
+ // outlives opening the editor.
870
+ //
871
+ // It is a plain monospaced note rather than a tag, and deliberately the same
872
+ // one `lineCountNote` renders: both answer "how big is this field's value?"
873
+ // in the same corner of the same column, so stating one as a chip and the
874
+ // other as text made two spellings of one idea.
875
+ var codeSizeNode = valueType === 'code-editor' &&
876
+ typeof (optionField === null || optionField === void 0 ? void 0 : optionField.value) === 'string' &&
877
+ optionField.value !== '' ?
878
+ (function () {
879
+ var _a = (0, codeSize_1.describeCodeSize)(optionField.value), lines = _a.lines, chars = _a.chars;
880
+ return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreP, { className: 'options-readfirst-label-code-size', size: 'tiny', effect: { opacity: 0.45, textAlign: 'left' }, style: { fontFamily: 'monospace' }, children: "".concat((0, codeSize_1.formatCodeChars)(chars), " ").concat((0, codeSize_1.formatCodeLines)(lines)) }));
881
+ })()
882
+ : null;
781
883
  if (isExpanded) {
782
884
  if (inlineEditable) {
783
885
  var collapse_1 = function () { return toggleExpandedOption(optionName); };
784
886
  var editingRow = ((0, jsx_runtime_1.jsxs)("div", __assign({ "data-field": optionName, className: 'readfirst-row readfirst-row-editing options-readfirst-inline options-readfirst-value', style: readRowHeights.current[optionName] ?
785
887
  { minHeight: readRowHeights.current[optionName] }
786
- : undefined }, clusterHoverProps, { children: [(0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledLabelBlock, { children: [(0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledRowLabel, { role: 'button', tabIndex: 0, "aria-label": "Collapse ".concat(label), title: (schema === null || schema === void 0 ? void 0 : schema.short_desc) || undefined, "$color": cKey, "$pointer": true, onClick: collapse_1, onKeyDown: function (event) {
888
+ : undefined }, clusterHoverProps, { children: [(0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledLabelBlock, { className: 'options-readfirst-label-block', children: [(0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledRowLabel, { role: 'button', tabIndex: 0, "aria-label": "Collapse ".concat(label), title: (schema === null || schema === void 0 ? void 0 : schema.short_desc) || undefined, "$color": cKey, "$pointer": true, onClick: collapse_1, onKeyDown: function (event) {
787
889
  if (event.key === 'Enter' || event.key === ' ') {
788
890
  event.preventDefault();
789
891
  collapse_1();
@@ -792,7 +894,7 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
792
894
  (0, jsx_runtime_1.jsx)(reqore_1.ReqoreIcon, { icon: 'Asterisk', color: 'danger', size: '10px' })
793
895
  : null, helpIcon] }), labelShortDesc ?
794
896
  (0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledLabelDesc, { className: 'options-readfirst-label-desc', size: 'small', effect: { opacity: 0.55 }, children: labelShortDesc })
795
- : null] }), (0, jsx_runtime_1.jsxs)("div", { ref: editorRef, style: { minWidth: 0 }, onKeyDown: function (event) {
897
+ : null, codeSizeNode] }), (0, jsx_runtime_1.jsxs)("div", { ref: editorRef, style: { minWidth: 0 }, onKeyDown: function (event) {
796
898
  if (event.key === 'Escape') {
797
899
  event.stopPropagation();
798
900
  // Escape discards. It used to call `collapse()`, which closed
@@ -801,9 +903,9 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
801
903
  // without saving" was the quietest way to commit.
802
904
  cancelEdit();
803
905
  }
804
- }, children: [absorbedNodes, valueType === 'code-editor' && typeof (optionField === null || optionField === void 0 ? void 0 : optionField.value) === 'string' ?
805
- (0, jsx_runtime_1.jsx)("div", { className: 'options-readfirst-editing-summary', children: (0, jsx_runtime_1.jsx)(codeSize_1.ReqraftCodeSizeTag, { code: optionField.value }) })
806
- : null, renderOption(optionName, optionField, 'small', true)] }), (0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledRowActions, { children: [draftChip, editRowRevertButton, cancelEditButton, clearValueButton, inlineOptionActions.map(function (action, index) {
906
+ }, children: [panelMessages.length ?
907
+ (0, jsx_runtime_1.jsx)(reqore_1.ReqoreControlGroup, { className: 'options-readfirst-info-panel', vertical: true, fluid: true, gapSize: 'normal', children: panelMessages.map(renderInfoStrip) })
908
+ : null, absorbedNodes, renderOption(optionName, optionField, 'small', true)] }), (0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledRowActions, { children: [draftChip, editRowRevertButton, cancelEditButton, clearValueButton, inlineOptionActions.map(function (action, index) {
807
909
  return renderInjectedOptionAction(action, index);
808
910
  }), moreMenu, closeExpandedFieldButton] }), clusterNode] }), optionName));
809
911
  // ALWAYS wrap the editing row in the same StyledColumn so its parent stays
@@ -852,14 +954,38 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
852
954
  return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreButton, __assign({ size: 'small', minimal: true, flat: true, fixed: true, className: 'options-readfirst-card-action' }, actionProps, { children: actionLabel }), index));
853
955
  }), inlineOptionActions.map(function (action, index) {
854
956
  return renderInjectedOptionAction(action, index);
855
- }), hasValue && !readOnly ?
957
+ }), editRowRevertButton, cancelEditButton, hasValue && !readOnly ?
856
958
  (0, jsx_runtime_1.jsx)(reqore_1.ReqoreButton, { size: 'small', icon: 'DeleteBinLine', minimal: true, flat: true, fixed: true, intent: 'danger', className: 'options-readfirst-clear', "aria-label": 'Clear value', tooltip: 'Clear value', onClick: confirmClearValue })
857
- : null, moreMenu, closeExpandedFieldButton] })] }), absorbedNodes, (0, jsx_runtime_1.jsxs)(FocusedEditing_1.FocusedEditing, { isFullscreen: focusedEditing === optionName, onClose: function () { return setFocusedEditing(undefined); }, description: (schema === null || schema === void 0 ? void 0 : schema.display_name) || optionName, children: [focusedEditing === optionName ?
858
- (0, jsx_runtime_1.jsx)(Description_1.Description, { longDescription: schema === null || schema === void 0 ? void 0 : schema.desc, shortDescription: schema === null || schema === void 0 ? void 0 : schema.short_desc, longDescriptionShownByDefault: true })
859
- : null, renderOption(optionName, optionField)] })] }, optionName));
959
+ : null, moreMenu, closeExpandedFieldButton] })] }), absorbedNodes, (0, jsx_runtime_1.jsx)("div", { style: { display: 'contents' }, onKeyDown: function (event) {
960
+ if (event.key === 'Escape') {
961
+ event.stopPropagation();
962
+ cancelEdit();
963
+ }
964
+ }, children: (0, jsx_runtime_1.jsxs)(FocusedEditing_1.FocusedEditing, { isFullscreen: focusedEditing === optionName, onClose: function () { return setFocusedEditing(undefined); }, description: (schema === null || schema === void 0 ? void 0 : schema.display_name) || optionName, children: [focusedEditing === optionName ?
965
+ (0, jsx_runtime_1.jsx)(Description_1.Description, { longDescription: schema === null || schema === void 0 ? void 0 : schema.desc, shortDescription: schema === null || schema === void 0 ? void 0 : schema.short_desc, longDescriptionShownByDefault: true })
966
+ : null, renderOption(optionName, optionField)] }) })] }, optionName));
860
967
  }
861
968
  var formatted = (0, readFirst_1.formatOptionValue)(optionField, schema);
862
969
  var empty = formatted === '';
970
+ // A field with no value of its own but a declared default is not simply
971
+ // unanswered: the default is what the server will use, and an em-dash says
972
+ // the opposite. Render the default in its place, through the same formatter
973
+ // so a list or an enum reads the way a real value would.
974
+ //
975
+ // This does NOT make the field count as answered. `empty` stays true, so the
976
+ // row keeps the dimmed italic treatment that distinguishes a default from an
977
+ // answer, and bucketing — which reads the field's own value, not this — still
978
+ // files it under Optional and leaves it behind the collapse.
979
+ //
980
+ // `hidden` is included deliberately: it marks a field the form has not added
981
+ // yet, which is the case that benefits most — the row is the author's first
982
+ // sight of the field, and the default is what it will contribute if left
983
+ // alone. Both flags only ever route to the em-dash below, so there is no
984
+ // real value being displaced.
985
+ var defaultValue = hidden || empty ? (0, common_1.getDefaultValue)(schema) : undefined;
986
+ var formattedDefault = defaultValue === undefined || defaultValue === null ?
987
+ ''
988
+ : (0, readFirst_1.formatOptionValue)(__assign(__assign({}, optionField), { value: defaultValue }), schema);
863
989
  // Inline reasons shown on the value line: validation / dependency / one-of /
864
990
  // default-value hints, plus a read-only covered-by note (editable covered rows
865
991
  // carry that in their chip instead).
@@ -882,6 +1008,9 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
882
1008
  Array.isArray(optionField === null || optionField === void 0 ? void 0 : optionField.value) &&
883
1009
  optionField.value.length > 0 &&
884
1010
  optionField.value.some(function (item) {
1011
+ if ((0, exports.richtextItemText)(item) !== undefined) {
1012
+ return false;
1013
+ }
885
1014
  var inner = item && typeof item === 'object' && 'value' in item ?
886
1015
  item.value
887
1016
  : item;
@@ -897,6 +1026,18 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
897
1026
  valueType === 'code-editor' &&
898
1027
  typeof (optionField === null || optionField === void 0 ? void 0 : optionField.value) === 'string' &&
899
1028
  optionField.value.length > 0;
1029
+ // A richtext value that renders as CHIPS is drawn in full by the row itself:
1030
+ // the chips are the value, and the reader is looking straight at it. The
1031
+ // native `title` below would then hover the raw source of the very thing the
1032
+ // chips replace ("[$fsminput:severity] $fsminput:alert_code") — and, because
1033
+ // each chip carries its own Reqore tooltip, hovering one fires BOTH: the chip
1034
+ // popover and the row's browser tooltip, in different places, saying almost
1035
+ // the same thing. Only the popover shows up in a screenshot, which is what
1036
+ // made the pair hard to report.
1037
+ var showsTemplateChips = !hidden &&
1038
+ valueType === 'richtext' &&
1039
+ Array.isArray(optionField === null || optionField === void 0 ? void 0 : optionField.value) &&
1040
+ (0, common_1.richtextToSegments)(optionField.value).some(function (segment) { return segment.kind === 'tag'; });
900
1041
  // Markdown reads the same way for the same reason: the row itself can only
901
1042
  // show a line of text, and for markdown that line is the SOURCE — the reader
902
1043
  // gets `## ` and `**` where the point of the value is what it looks like
@@ -930,32 +1071,42 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
930
1071
  var typeLabel = showFieldTypes ?
931
1072
  "<".concat((schema === null || schema === void 0 ? void 0 : schema.ui_type) || (schema === null || schema === void 0 ? void 0 : schema.type) || 'auto').concat((schema === null || schema === void 0 ? void 0 : schema.ui_element_type) ? "[".concat(schema.ui_element_type, "]") : '', ">")
932
1073
  : null;
933
- // Disabled rows (schema flag or unmet deps) can't open a lock + reason
934
- // renders instead. Form-level readOnly still opens in view mode (Close).
1074
+ // A `readonly` field is one the system ownsan assigned id, a recorded
1075
+ // provenance. The server states that on the field itself; only the older
1076
+ // compat projection also mapped it to `disabled`, so on this path the form
1077
+ // was handed `readonly` alone and rendered an editable control for a value
1078
+ // no answer of the user's can change.
1079
+ var fieldReadonly = !!(schema === null || schema === void 0 ? void 0 : schema.readonly);
1080
+ // Disabled rows (schema flag, readonly, or unmet deps) can't open — a lock +
1081
+ // reason renders instead. Form-level readOnly still opens in view mode (Close).
935
1082
  var fieldDisabled = !hidden &&
936
1083
  !readOnly &&
937
1084
  (!!(schema === null || schema === void 0 ? void 0 : schema.disabled) ||
1085
+ fieldReadonly ||
938
1086
  !(0, validations_1.hasAllDependenciesFullfilled)(schema === null || schema === void 0 ? void 0 : schema.depends_on, availableOptions, options || {}));
939
- var fieldDisabledReason = (schema === null || schema === void 0 ? void 0 : schema.disabled) ? 'This field is disabled' : 'Disabled — dependencies are not fulfilled';
1087
+ var fieldDisabledReason = (schema === null || schema === void 0 ? void 0 : schema.disabled) ? 'This field is disabled'
1088
+ : fieldReadonly ? 'Set by Qorus — not editable'
1089
+ : 'Disabled — dependencies are not fulfilled';
940
1090
  // Dependency contract: top-level entries must ALL hold; a nested array
941
- // means ANY of its entries; `name=value` requires that exact value.
942
- var dependencyEntries = fieldDisabled && !(schema === null || schema === void 0 ? void 0 : schema.disabled) ?
1091
+ // means ANY of its entries; `name=value` requires that exact value, and
1092
+ // `name!=value` requires any other answer. Parsed by the same helper the
1093
+ // predicate uses, so the lock cannot describe a rule the form does not apply.
1094
+ var dependencyEntries = fieldDisabled && !(schema === null || schema === void 0 ? void 0 : schema.disabled) && !fieldReadonly ?
943
1095
  ((schema === null || schema === void 0 ? void 0 : schema.depends_on) || [])
944
1096
  : [];
945
1097
  var describeDependency = function (dep) {
946
1098
  var _a, _b;
947
- var eqIndex = dep.indexOf('=');
948
- var depName = eqIndex === -1 ? dep : dep.slice(0, eqIndex);
949
- var expected = eqIndex === -1 ? undefined : dep.slice(eqIndex + 1);
1099
+ var _c = (0, validations_1.parseDependency)(dep), depName = _c.name, op = _c.op, expected = _c.value;
950
1100
  var depLabel = ((_a = options === null || options === void 0 ? void 0 : options[depName]) === null || _a === void 0 ? void 0 : _a.display_name) || depName;
951
1101
  var depValue = (_b = availableOptions === null || availableOptions === void 0 ? void 0 : availableOptions[depName]) === null || _b === void 0 ? void 0 : _b.value;
952
1102
  return {
953
1103
  name: depName,
954
1104
  exists: !!(options === null || options === void 0 ? void 0 : options[depName]),
955
- label: expected === undefined ? depLabel : "".concat(depLabel, " = ").concat(expected),
956
- fulfilled: expected === undefined ?
957
- !(0, readFirst_1.isOptionValueEmpty)(depValue)
958
- : depValue != null && String(depValue) === expected,
1105
+ label: !op ? depLabel : "".concat(depLabel, " ").concat(op === '=' ? '=' : '≠', " ").concat(expected),
1106
+ fulfilled: !op ? !(0, readFirst_1.isOptionValueEmpty)(depValue)
1107
+ : depValue == null ? false
1108
+ : op === '=' ? String(depValue) === expected
1109
+ : String(depValue) !== expected,
959
1110
  };
960
1111
  };
961
1112
  var depHighlightNames = (0, flatten_1.default)(dependencyEntries)
@@ -1038,34 +1189,41 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
1038
1189
  event.preventDefault();
1039
1190
  activate(event);
1040
1191
  }
1041
- } }, clusterHoverProps, { children: [clusterNode, (0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledLabelBlock, { children: [(0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledRowLabel, { title: (schema === null || schema === void 0 ? void 0 : schema.short_desc) || undefined, "$color": cKey, children: [rowChromeIcon, (0, jsx_runtime_1.jsxs)("span", { className: 'options-readfirst-label-text', style: { minWidth: 0 }, children: [label, required ?
1192
+ } }, clusterHoverProps, { children: [clusterNode, (0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledLabelBlock, { className: 'options-readfirst-label-block', children: [(0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledRowLabel, { title: (schema === null || schema === void 0 ? void 0 : schema.short_desc) || undefined, "$color": cKey, children: [rowChromeIcon, (0, jsx_runtime_1.jsxs)("span", { className: 'options-readfirst-label-text', style: { minWidth: 0 }, children: [label, required ?
1042
1193
  (0, jsx_runtime_1.jsx)(reqore_1.ReqoreIcon, { icon: 'Asterisk', color: 'danger', size: '10px', margin: 'left', marginSize: 'tiny' })
1043
1194
  : null, helpIcon] }), typeLabel ?
1044
1195
  (0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { size: 'tiny', minimal: true, label: typeLabel, labelEffect: { opacity: 0.55 } })
1045
1196
  : null] }), showLabelDesc ?
1046
1197
  (0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledLabelDesc, { className: 'options-readfirst-label-desc', size: 'small', effect: { opacity: 0.55 }, children: labelShortDesc })
1047
- : null, lineCountNote ?
1198
+ : null, codeSizeNode, lineCountNote ?
1048
1199
  (0, jsx_runtime_1.jsx)(reqore_1.ReqoreP, { className: 'options-readfirst-label-lines', size: 'tiny', effect: { opacity: 0.45, textAlign: 'left' }, style: { fontFamily: 'monospace' }, children: lineCountNote })
1049
1200
  : null] }), (0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledRowValue
1050
1201
  // A code field draws its whole value in the preview below, with
1051
1202
  // "Show more" for the rest, so a hover carrying the same text is
1052
1203
  // noise -- and a native tooltip holding a few hundred lines is
1053
- // unreadable anyway. Every other value keeps its hover, which is the
1054
- // only way to read one that the row had to truncate.
1204
+ // unreadable anyway. A chipped richtext value is the same case: the row
1205
+ // already draws it in full, and its chips carry their own tooltips.
1206
+ // Every other value keeps its hover, which is the only way to read one
1207
+ // that the row had to truncate.
1055
1208
  , {
1056
1209
  // A code field draws its whole value in the preview below, with
1057
1210
  // "Show more" for the rest, so a hover carrying the same text is
1058
1211
  // noise -- and a native tooltip holding a few hundred lines is
1059
- // unreadable anyway. Every other value keeps its hover, which is the
1060
- // only way to read one that the row had to truncate.
1212
+ // unreadable anyway. A chipped richtext value is the same case: the row
1213
+ // already draws it in full, and its chips carry their own tooltips.
1214
+ // Every other value keeps its hover, which is the only way to read one
1215
+ // that the row had to truncate.
1061
1216
  title: (!empty &&
1062
1217
  !hidden &&
1063
1218
  !showCodePreview &&
1064
1219
  !showMarkdownPreview &&
1220
+ !showsTemplateChips &&
1065
1221
  typeof formatted === 'string') ?
1066
1222
  formatted
1067
- : undefined, "$color": empty || hidden ? "".concat(cMuted, "66") : cKey, "$empty": empty || hidden, children: [showMarkdownPreview || previewWithSchema ? null : ((0, jsx_runtime_1.jsx)("span", { className: 'options-readfirst-valuetext', children: hidden || empty ? '—' : renderReadFirstValue(optionField, schema, formatted) })), valueReasons.map(function (m, i) { return ((0, jsx_runtime_1.jsx)("span", { className: 'options-readfirst-reason', style: { color: reasonColor(m.intent) }, children: m.content }, "".concat(m.content, "-").concat(i))); }), panelMessages.length ?
1068
- (0, jsx_runtime_1.jsx)("div", { className: 'options-readfirst-info-panel', children: panelMessages.map(renderInfoStrip) })
1223
+ : undefined, "$color": empty || hidden ? "".concat(cMuted, "66") : cKey, "$empty": empty || hidden, children: [showMarkdownPreview || (previewWithSchema && showStructuredPreview) ? null : ((0, jsx_runtime_1.jsx)("span", { className: 'options-readfirst-valuetext', children: hidden || empty ?
1224
+ formattedDefault || ''
1225
+ : renderReadFirstValue(optionField, schema, formatted) })), valueReasons.map(function (m, i) { return ((0, jsx_runtime_1.jsx)("span", { className: 'options-readfirst-reason', style: { color: reasonColor(m.intent) }, children: m.content }, "".concat(m.content, "-").concat(i))); }), panelMessages.length ?
1226
+ (0, jsx_runtime_1.jsx)(reqore_1.ReqoreControlGroup, { className: 'options-readfirst-info-panel', vertical: true, fluid: true, gapSize: 'normal', children: panelMessages.map(renderInfoStrip) })
1069
1227
  : null, showStructuredPreview ?
1070
1228
  // The inset lives inside the row now, so a click on a value chip would
1071
1229
  // bubble to the row's onClick and fire activate() a SECOND time (the