@qoretechnologies/reqraft 0.10.30-pr.92.gb117ecd → 0.10.31-pr.92.g2abe73e
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.
- package/dist/components/Description/index.d.ts +8 -1
- package/dist/components/Description/index.d.ts.map +1 -1
- package/dist/components/Description/index.js +50 -13
- package/dist/components/Description/index.js.map +1 -1
- package/dist/components/Description/markdownRendererContext.d.ts +29 -0
- package/dist/components/Description/markdownRendererContext.d.ts.map +1 -0
- package/dist/components/Description/markdownRendererContext.js +24 -0
- package/dist/components/Description/markdownRendererContext.js.map +1 -0
- package/dist/components/form/engine/CompactRow.d.ts.map +1 -1
- package/dist/components/form/engine/CompactRow.js +78 -16
- package/dist/components/form/engine/CompactRow.js.map +1 -1
- package/dist/components/form/engine/FormEngine.d.ts +22 -1
- package/dist/components/form/engine/FormEngine.d.ts.map +1 -1
- package/dist/components/form/engine/FormEngine.js +18 -2
- package/dist/components/form/engine/FormEngine.js.map +1 -1
- package/dist/components/form/engine/readFirst.d.ts +35 -0
- package/dist/components/form/engine/readFirst.d.ts.map +1 -1
- package/dist/components/form/engine/readFirst.js +118 -11
- package/dist/components/form/engine/readFirst.js.map +1 -1
- package/dist/components/form/engine/rendererTypes.d.ts +7 -0
- package/dist/components/form/engine/rendererTypes.d.ts.map +1 -1
- package/dist/components/form/engine/rendererTypes.js +8 -0
- package/dist/components/form/engine/rendererTypes.js.map +1 -1
- package/dist/components/form/fields/markdown/Markdown.d.ts +8 -4
- package/dist/components/form/fields/markdown/Markdown.d.ts.map +1 -1
- package/dist/components/form/fields/markdown/Markdown.js +23 -8
- package/dist/components/form/fields/markdown/Markdown.js.map +1 -1
- package/dist/components/form/fields/markdown/MarkdownView.d.ts +24 -0
- package/dist/components/form/fields/markdown/MarkdownView.d.ts.map +1 -0
- package/dist/components/form/fields/markdown/MarkdownView.js +100 -0
- package/dist/components/form/fields/markdown/MarkdownView.js.map +1 -0
- package/package.json +1 -1
- package/src/components/Description/index.tsx +157 -49
- package/src/components/Description/markdownRendererContext.tsx +29 -0
- package/src/components/form/engine/CompactRow.tsx +142 -46
- package/src/components/form/engine/FormEngine.stories.tsx +66 -0
- package/src/components/form/engine/FormEngine.tsx +35 -1
- package/src/components/form/engine/readFirst.ts +132 -28
- package/src/components/form/engine/rendererTypes.ts +8 -0
- package/src/components/form/fields/markdown/Markdown.stories.tsx +22 -1
- package/src/components/form/fields/markdown/Markdown.tsx +41 -66
- package/src/components/form/fields/markdown/MarkdownView.tsx +222 -0
|
@@ -9,7 +9,14 @@ export interface IDescriptionProps extends IReqoreParagraphProps {
|
|
|
9
9
|
maxShortDescriptionLength?: number;
|
|
10
10
|
margin?: 'top' | 'bottom' | 'both' | 'none';
|
|
11
11
|
type?: TQorusType;
|
|
12
|
+
/**
|
|
13
|
+
* Render for a constrained container — a row inset, a callout, a hover card.
|
|
14
|
+
*
|
|
15
|
+
* Forwarded to the host's markdown renderer and applied to the built-in
|
|
16
|
+
* heading scale.
|
|
17
|
+
*/
|
|
18
|
+
compact?: boolean;
|
|
12
19
|
}
|
|
13
20
|
export declare const MarkdownLink: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export declare const Description: import("react").MemoExoticComponent<({ shortDescription, longDescription, longDescriptionOnly, longDescriptionShownByDefault, maxShortDescriptionLength, margin, type: _type, ...rest }: IDescriptionProps) => import("react/jsx-runtime").JSX.Element>;
|
|
21
|
+
export declare const Description: import("react").MemoExoticComponent<({ shortDescription, longDescription, longDescriptionOnly, longDescriptionShownByDefault, maxShortDescriptionLength, margin, type: _type, compact, ...rest }: IDescriptionProps) => import("react/jsx-runtime").JSX.Element>;
|
|
15
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Description/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Description/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,qBAAqB,EAAW,MAAM,oDAAoD,CAAC;AACpG,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAM1D,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;IAC9D,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,6BAA6B,CAAC,EAAE,OAAO,CAAC;IACxC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,MAAM,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;IAC5C,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAoHD,eAAO,MAAM,YAAY,UAAW,GAAG,4CAQtC,CAAC;AAEF,eAAO,MAAM,WAAW,oMAWnB,iBAAiB,6CA6FrB,CAAC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
2
6
|
var __assign = (this && this.__assign) || function () {
|
|
3
7
|
__assign = Object.assign || function(t) {
|
|
4
8
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -31,14 +35,44 @@ var reqore_1 = require("@qoretechnologies/reqore");
|
|
|
31
35
|
var Paragraph_1 = require("@qoretechnologies/reqore/dist/components/Paragraph");
|
|
32
36
|
var react_1 = require("react");
|
|
33
37
|
var react_markdown_1 = __importDefault(require("react-markdown"));
|
|
38
|
+
var styled_components_1 = __importDefault(require("styled-components"));
|
|
39
|
+
var markdownRendererContext_1 = require("./markdownRendererContext");
|
|
40
|
+
/**
|
|
41
|
+
* System monospace, spelled out rather than imported from
|
|
42
|
+
* `@qoretechnologies/reqore`'s font shorthands: that export postdates the
|
|
43
|
+
* `>=0.71.16` peer range this package supports, and a description must not be
|
|
44
|
+
* the reason a consumer has to move its Reqore version.
|
|
45
|
+
*/
|
|
46
|
+
var MONO_FONT = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace";
|
|
47
|
+
/**
|
|
48
|
+
* The built-in markdown surface, used when no host renderer is supplied.
|
|
49
|
+
*
|
|
50
|
+
* `react-markdown` 9 dropped its `className` prop, so the styles cannot hang off
|
|
51
|
+
* `styled(ReactMarkdown)` — hence a wrapper element rather than a styled
|
|
52
|
+
* component around the renderer itself.
|
|
53
|
+
*/
|
|
54
|
+
var StyledDescriptionMarkdown = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n /*\n * Inline code. A backtick span marks an identifier \u2014 an option key, a header\n * name, a path \u2014 so it has to be monospace, and it has to sit quietly inside\n * the sentence around it.\n *\n * This used to map the code element to a ReqoreTag with an explicit near-white\n * colour, which auto-contrasted to near-black text: on a dark form a description\n * full of option names read as a row of glaring labels rather than as prose with\n * identifiers in it. Keeping the reading colour and tinting the background\n * behind it says \"literal\" without shouting it.\n */\n code {\n font-family: ", ";\n font-size: 0.92em;\n background: rgba(255, 255, 255, 0.09);\n border: 1px solid rgba(255, 255, 255, 0.08);\n border-radius: 3px;\n padding: 0.05em 0.35em;\n color: inherit;\n white-space: pre-wrap;\n word-break: break-word;\n overflow-wrap: anywhere;\n }\n\n /* Block code owns the whole pre surface; it must not also be chipped. */\n pre {\n white-space: pre-wrap;\n word-break: break-word;\n overflow-wrap: anywhere;\n max-width: 100%;\n }\n pre code {\n background: none;\n border: 0;\n padding: 0;\n font-size: 1em;\n }\n\n /*\n * Headings. These used to map to ReqoreH1\u2026ReqoreH6, which render at page-title\n * scale \u2014 an option description opening with a level-two heading came out\n * larger than the dialog title above it. A description is never a page, so the\n * scale here is relative to the text it interrupts.\n */\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin: ", ";\n line-height: 1.3;\n font-weight: 600;\n }\n\n > h1:first-child,\n > h2:first-child,\n > h3:first-child,\n > h4:first-child,\n > h5:first-child,\n > h6:first-child {\n margin-top: 0;\n }\n\n h1 {\n font-size: ", ";\n }\n h2 {\n font-size: ", ";\n }\n h3 {\n font-size: ", ";\n }\n h4,\n h5,\n h6 {\n font-size: 1em;\n opacity: 0.85;\n }\n\n p:first-child {\n margin-top: 0;\n }\n p:last-child {\n margin-bottom: 0;\n }\n\n ul,\n ol {\n margin: 4px 0;\n padding-left: 20px;\n }\n li {\n margin: 2px 0;\n }\n"], ["\n /*\n * Inline code. A backtick span marks an identifier \u2014 an option key, a header\n * name, a path \u2014 so it has to be monospace, and it has to sit quietly inside\n * the sentence around it.\n *\n * This used to map the code element to a ReqoreTag with an explicit near-white\n * colour, which auto-contrasted to near-black text: on a dark form a description\n * full of option names read as a row of glaring labels rather than as prose with\n * identifiers in it. Keeping the reading colour and tinting the background\n * behind it says \"literal\" without shouting it.\n */\n code {\n font-family: ", ";\n font-size: 0.92em;\n background: rgba(255, 255, 255, 0.09);\n border: 1px solid rgba(255, 255, 255, 0.08);\n border-radius: 3px;\n padding: 0.05em 0.35em;\n color: inherit;\n white-space: pre-wrap;\n word-break: break-word;\n overflow-wrap: anywhere;\n }\n\n /* Block code owns the whole pre surface; it must not also be chipped. */\n pre {\n white-space: pre-wrap;\n word-break: break-word;\n overflow-wrap: anywhere;\n max-width: 100%;\n }\n pre code {\n background: none;\n border: 0;\n padding: 0;\n font-size: 1em;\n }\n\n /*\n * Headings. These used to map to ReqoreH1\u2026ReqoreH6, which render at page-title\n * scale \u2014 an option description opening with a level-two heading came out\n * larger than the dialog title above it. A description is never a page, so the\n * scale here is relative to the text it interrupts.\n */\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin: ", ";\n line-height: 1.3;\n font-weight: 600;\n }\n\n > h1:first-child,\n > h2:first-child,\n > h3:first-child,\n > h4:first-child,\n > h5:first-child,\n > h6:first-child {\n margin-top: 0;\n }\n\n h1 {\n font-size: ", ";\n }\n h2 {\n font-size: ", ";\n }\n h3 {\n font-size: ", ";\n }\n h4,\n h5,\n h6 {\n font-size: 1em;\n opacity: 0.85;\n }\n\n p:first-child {\n margin-top: 0;\n }\n p:last-child {\n margin-bottom: 0;\n }\n\n ul,\n ol {\n margin: 4px 0;\n padding-left: 20px;\n }\n li {\n margin: 2px 0;\n }\n"])), MONO_FONT, function (_a) {
|
|
55
|
+
var $compact = _a.$compact;
|
|
56
|
+
return ($compact ? '10px 0 4px' : '16px 0 8px');
|
|
57
|
+
}, function (_a) {
|
|
58
|
+
var $compact = _a.$compact;
|
|
59
|
+
return ($compact ? '1.08em' : '1.5em');
|
|
60
|
+
}, function (_a) {
|
|
61
|
+
var $compact = _a.$compact;
|
|
62
|
+
return ($compact ? '1.04em' : '1.3em');
|
|
63
|
+
}, function (_a) {
|
|
64
|
+
var $compact = _a.$compact;
|
|
65
|
+
return ($compact ? '1em' : '1.15em');
|
|
66
|
+
});
|
|
34
67
|
var MarkdownLink = function (props) {
|
|
35
68
|
return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreTextEffect, __assign({ as: 'a', effect: { interactive: true, color: 'info', underline: true } }, props)));
|
|
36
69
|
};
|
|
37
70
|
exports.MarkdownLink = MarkdownLink;
|
|
38
71
|
exports.Description = (0, react_1.memo)(function (_a) {
|
|
39
72
|
var shortDescription = _a.shortDescription, longDescription = _a.longDescription, longDescriptionOnly = _a.longDescriptionOnly, longDescriptionShownByDefault = _a.longDescriptionShownByDefault, _b = _a.maxShortDescriptionLength, maxShortDescriptionLength = _b === void 0 ? 1000 : _b, _c = _a.margin, margin = _c === void 0 ? 'bottom' : _c, _type = _a.type, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
40
|
-
rest = __rest(_a, ["shortDescription", "longDescription", "longDescriptionOnly", "longDescriptionShownByDefault", "maxShortDescriptionLength", "margin", "type"]);
|
|
73
|
+
compact = _a.compact, rest = __rest(_a, ["shortDescription", "longDescription", "longDescriptionOnly", "longDescriptionShownByDefault", "maxShortDescriptionLength", "margin", "type", "compact"]);
|
|
41
74
|
var _d = (0, react_1.useState)(longDescriptionOnly || (longDescriptionShownByDefault && longDescription ? true : false)), showLongDescription = _d[0], setShowLongDescription = _d[1];
|
|
75
|
+
var markdownRenderer = (0, markdownRendererContext_1.useMarkdownRenderer)();
|
|
42
76
|
var actualShortDescription = shortDescription || longDescription;
|
|
43
77
|
var isShortDescriptionTooLong = (actualShortDescription === null || actualShortDescription === void 0 ? void 0 : actualShortDescription.length) > maxShortDescriptionLength;
|
|
44
78
|
var finalShownDescription = isShortDescriptionTooLong
|
|
@@ -50,6 +84,14 @@ exports.Description = (0, react_1.memo)(function (_a) {
|
|
|
50
84
|
setShowLongDescription(function (prev) { return !prev; });
|
|
51
85
|
}, []);
|
|
52
86
|
var effect = (0, react_1.useMemo)(function () { return ({ italic: true, opacity: 0.7 }); }, []);
|
|
87
|
+
var components = (0, react_1.useMemo)(function () { return ({
|
|
88
|
+
p: function (options) { return (0, jsx_runtime_1.jsx)(Paragraph_1.ReqoreP, __assign({}, options, { effect: effect, size: 'small' })); },
|
|
89
|
+
span: function (options) { return (0, jsx_runtime_1.jsx)(reqore_1.ReqoreSpan, __assign({}, options, { effect: effect, size: 'small' })); },
|
|
90
|
+
a: exports.MarkdownLink,
|
|
91
|
+
// `code` and `h1`…`h6` are deliberately NOT mapped — the surface above
|
|
92
|
+
// styles them, so an identifier stays readable and a heading stays
|
|
93
|
+
// smaller than the title it sits under.
|
|
94
|
+
}); }, [effect]);
|
|
53
95
|
var renderToggle = (0, react_1.useCallback)(function () {
|
|
54
96
|
if (finalShownDescription === longDescription || longDescriptionOnly) {
|
|
55
97
|
return null;
|
|
@@ -64,17 +106,12 @@ exports.Description = (0, react_1.memo)(function (_a) {
|
|
|
64
106
|
if (!shortDescription && !longDescription) {
|
|
65
107
|
return null;
|
|
66
108
|
}
|
|
67
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [margin === 'both' || margin === 'top' ? (0, jsx_runtime_1.jsx)(reqore_1.ReqoreVerticalSpacer, { height: 10 }) : null,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
h4: reqore_1.ReqoreH4,
|
|
74
|
-
h5: reqore_1.ReqoreH5,
|
|
75
|
-
h6: reqore_1.ReqoreH6,
|
|
76
|
-
a: exports.MarkdownLink,
|
|
77
|
-
code: function (options) { return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreErrorBoundary, { children: (0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, __assign({}, options, { label: options.children, color: '#d7d7d7', size: 'tiny', wrap: true })) })); },
|
|
78
|
-
}, children: finalLongDescription }), renderToggle()] })) : ((0, jsx_runtime_1.jsxs)(reqore_1.ReqoreSpan, { effect: effect, children: [finalShownDescription, " ", finalLongDescription ? renderToggle() : null] })) })), margin === 'both' || margin === 'bottom' ? (0, jsx_runtime_1.jsx)(reqore_1.ReqoreVerticalSpacer, { height: 10 }) : null] }));
|
|
109
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [margin === 'both' || margin === 'top' ? (0, jsx_runtime_1.jsx)(reqore_1.ReqoreVerticalSpacer, { height: 10 }) : null, showLongDescription ? (
|
|
110
|
+
// Markdown is rendered outside `ReqoreP`: it emits block content —
|
|
111
|
+
// its own paragraphs, lists, headings — and a `<p>` may not contain
|
|
112
|
+
// any of them, so the browser closed the outer paragraph early and
|
|
113
|
+
// the rest of the description escaped its own styling.
|
|
114
|
+
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [markdownRenderer ? (markdownRenderer({ value: finalLongDescription, compact: compact })) : ((0, jsx_runtime_1.jsx)(StyledDescriptionMarkdown, { "$compact": compact, children: (0, jsx_runtime_1.jsx)(react_markdown_1.default, { components: components, children: finalLongDescription }) })), renderToggle()] })) : ((0, jsx_runtime_1.jsx)(Paragraph_1.ReqoreP, __assign({}, rest, { children: (0, jsx_runtime_1.jsxs)(reqore_1.ReqoreSpan, { effect: effect, children: [finalShownDescription, " ", finalLongDescription ? renderToggle() : null] }) }))), margin === 'both' || margin === 'bottom' ? (0, jsx_runtime_1.jsx)(reqore_1.ReqoreVerticalSpacer, { height: 10 }) : null] }));
|
|
79
115
|
});
|
|
116
|
+
var templateObject_1;
|
|
80
117
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Description/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Description/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAA8F;AAC9F,gFAAoG;AAEpG,+BAA6D;AAC7D,kEAA2C;AAC3C,wEAAuC;AACvC,qEAAgE;AAmBhE;;;;;GAKG;AACH,IAAM,SAAS,GACb,qFAAqF,CAAC;AAExF;;;;;;GAMG;AACH,IAAM,yBAAyB,GAAG,2BAAM,CAAC,GAAG,8sEAAwB,8nBAajD,EAAS,w8BAsCd,EAA0D,2OAevD,EAAiD,iCAGjD,EAAiD,iCAGjD,EAA+C,8QAwB/D,KAnFkB,SAAS,EAsCd,UAAC,EAAY;QAAV,QAAQ,cAAA;IAAO,OAAA,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC;AAAxC,CAAwC,EAevD,UAAC,EAAY;QAAV,QAAQ,cAAA;IAAO,OAAA,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;AAA/B,CAA+B,EAGjD,UAAC,EAAY;QAAV,QAAQ,cAAA;IAAO,OAAA,CAAC,QAAQ,CAAC,CA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C,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,IAAI,IAC1D,IACL,CACX,EACA,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,uBAAC,6BAAoB,IAAC,MAAM,EAAE,EAAE,GAAI,CAAC,CAAC,CAAC,IAAI,IACtF,CACJ,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Draws a markdown string.
|
|
4
|
+
*
|
|
5
|
+
* `compact` asks for a constrained container — a row inset, a callout, a hover
|
|
6
|
+
* card — rather than a page: markdown authored as a document routinely opens
|
|
7
|
+
* with `##`, and at document scale that heading outgrows the title above it.
|
|
8
|
+
*/
|
|
9
|
+
export type TMarkdownRenderer = (args: {
|
|
10
|
+
value: string;
|
|
11
|
+
compact?: boolean;
|
|
12
|
+
}) => ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* The renderer `Description` draws markdown with, when a host supplies one.
|
|
15
|
+
*
|
|
16
|
+
* This package renders markdown in exactly one place — a field's description —
|
|
17
|
+
* but an application that has field descriptions has markdown everywhere else
|
|
18
|
+
* too: on its object pages, in its catalogues, in its chat transcripts. When
|
|
19
|
+
* reqraft draws descriptions with its own dialect and the host draws everything
|
|
20
|
+
* else with its own, the same text renders two different ways depending on which
|
|
21
|
+
* surface it landed on, and neither side can tell which one the reader saw.
|
|
22
|
+
*
|
|
23
|
+
* So the host's renderer wins where there is one. The built-in is a fallback for
|
|
24
|
+
* hosts that have no renderer of their own, not a second opinion.
|
|
25
|
+
*/
|
|
26
|
+
export declare const MarkdownRendererContext: import("react").Context<TMarkdownRenderer>;
|
|
27
|
+
/** Returns the host-supplied markdown renderer, or `undefined` for the built-in. */
|
|
28
|
+
export declare const useMarkdownRenderer: () => TMarkdownRenderer | undefined;
|
|
29
|
+
//# sourceMappingURL=markdownRendererContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdownRendererContext.d.ts","sourceRoot":"","sources":["../../../src/components/Description/markdownRendererContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAc,MAAM,OAAO,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,KAAK,SAAS,CAAC;AAE1F;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,4CAA0D,CAAC;AAE/F,oFAAoF;AACpF,eAAO,MAAM,mBAAmB,QAAO,iBAAiB,GAAG,SACtB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useMarkdownRenderer = exports.MarkdownRendererContext = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
/**
|
|
6
|
+
* The renderer `Description` draws markdown with, when a host supplies one.
|
|
7
|
+
*
|
|
8
|
+
* This package renders markdown in exactly one place — a field's description —
|
|
9
|
+
* but an application that has field descriptions has markdown everywhere else
|
|
10
|
+
* too: on its object pages, in its catalogues, in its chat transcripts. When
|
|
11
|
+
* reqraft draws descriptions with its own dialect and the host draws everything
|
|
12
|
+
* else with its own, the same text renders two different ways depending on which
|
|
13
|
+
* surface it landed on, and neither side can tell which one the reader saw.
|
|
14
|
+
*
|
|
15
|
+
* So the host's renderer wins where there is one. The built-in is a fallback for
|
|
16
|
+
* hosts that have no renderer of their own, not a second opinion.
|
|
17
|
+
*/
|
|
18
|
+
exports.MarkdownRendererContext = (0, react_1.createContext)(undefined);
|
|
19
|
+
/** Returns the host-supplied markdown renderer, or `undefined` for the built-in. */
|
|
20
|
+
var useMarkdownRenderer = function () {
|
|
21
|
+
return (0, react_1.useContext)(exports.MarkdownRendererContext);
|
|
22
|
+
};
|
|
23
|
+
exports.useMarkdownRenderer = useMarkdownRenderer;
|
|
24
|
+
//# sourceMappingURL=markdownRendererContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdownRendererContext.js","sourceRoot":"","sources":["../../../src/components/Description/markdownRendererContext.tsx"],"names":[],"mappings":";;;AAAA,+BAA6D;AAW7D;;;;;;;;;;;;GAYG;AACU,QAAA,uBAAuB,GAAG,IAAA,qBAAa,EAAgC,SAAS,CAAC,CAAC;AAE/F,oFAAoF;AAC7E,IAAM,mBAAmB,GAAG;IACjC,OAAA,IAAA,kBAAU,EAAC,+BAAuB,CAAC;AAAnC,CAAmC,CAAC;AADzB,QAAA,mBAAmB,uBACM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompactRow.d.ts","sourceRoot":"","sources":["../../../../src/components/form/engine/CompactRow.tsx"],"names":[],"mappings":"AAcA,OAAO,
|
|
1
|
+
{"version":3,"file":"CompactRow.d.ts","sourceRoot":"","sources":["../../../../src/components/form/engine/CompactRow.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAqC,MAAM,8BAA8B,CAAC;AAGlG,OAAO,KAAe,MAAM,OAAO,CAAC;AA8GpC,eAAO,MAAM,UAAU,yGAQlB;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,eAAe,CAAC;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IAIjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,6CAk8CF,CAAC"}
|
|
@@ -70,12 +70,21 @@ var templates_1 = require("../../../helpers/templates");
|
|
|
70
70
|
var common_1 = require("../../../helpers/common");
|
|
71
71
|
var ReadOnlyTemplateTag_1 = require("../fields/template/ReadOnlyTemplateTag");
|
|
72
72
|
var Description_1 = require("../../Description");
|
|
73
|
+
var markdownRendererContext_1 = require("../../Description/markdownRendererContext");
|
|
73
74
|
var FocusedEditing_1 = require("../../FocusedEditing");
|
|
74
75
|
var compactRowContext_1 = require("./compactRowContext");
|
|
75
76
|
var compactRowStyles_1 = require("./compactRowStyles");
|
|
76
77
|
var OptionFieldMessages_1 = require("./OptionFieldMessages");
|
|
77
78
|
var readFirst_1 = require("./readFirst");
|
|
78
79
|
var StructuredDataView_1 = require("./_structuredData/StructuredDataView");
|
|
80
|
+
/**
|
|
81
|
+
* Does this markdown value have more document in it than one row can show?
|
|
82
|
+
*
|
|
83
|
+
* Blank trailing lines do not count: a textarea leaves them behind constantly,
|
|
84
|
+
* and a one-line description that gained a stray newline must not suddenly
|
|
85
|
+
* grow an inset.
|
|
86
|
+
*/
|
|
87
|
+
var isMultilineMarkdown = function (value) { return value.trim().includes('\n'); };
|
|
79
88
|
// Types whose editors are too tall/nested to edit in-row — these keep the edit
|
|
80
89
|
// card; `arg_schema` and operator fields are excluded separately.
|
|
81
90
|
var COMPACT_COMPLEX_TYPES = new Set([
|
|
@@ -135,6 +144,7 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
135
144
|
var commitMode = (0, use_context_selector_1.useContextSelector)(compactRowContext_1.CompactRowContext, function (v) { return v.commitMode; });
|
|
136
145
|
var options = (0, use_context_selector_1.useContextSelector)(compactRowContext_1.CompactRowContext, function (v) { return v.options; });
|
|
137
146
|
var codePreviewRenderer = (0, use_context_selector_1.useContextSelector)(compactRowContext_1.CompactRowContext, function (v) { return v.codePreviewRenderer; });
|
|
147
|
+
var markdownRenderer = (0, markdownRendererContext_1.useMarkdownRenderer)();
|
|
138
148
|
var operators = (0, use_context_selector_1.useContextSelector)(compactRowContext_1.CompactRowContext, function (v) { return v.operators; });
|
|
139
149
|
var focusedEditing = (0, use_context_selector_1.useContextSelector)(compactRowContext_1.CompactRowContext, function (v) { return v.focusedEditing; });
|
|
140
150
|
var showFieldTypes = (0, use_context_selector_1.useContextSelector)(compactRowContext_1.CompactRowContext, function (v) { return v.showFieldTypes; });
|
|
@@ -175,6 +185,8 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
175
185
|
var cDanger = (0, use_context_selector_1.useContextSelector)(compactRowContext_1.CompactRowContext, function (v) { return v.cDanger; });
|
|
176
186
|
var cWarning = (0, use_context_selector_1.useContextSelector)(compactRowContext_1.CompactRowContext, function (v) { return v.cWarning; });
|
|
177
187
|
var cInfo = (0, use_context_selector_1.useContextSelector)(compactRowContext_1.CompactRowContext, function (v) { return v.cInfo; });
|
|
188
|
+
// A markdown value renders as a document in the row's inset; the host's
|
|
189
|
+
// renderer when it supplied one, reqraft's own otherwise.
|
|
178
190
|
// Value-cell content: colour adds a swatch, file an icon + size; hash keeps
|
|
179
191
|
// its "N fields" summary (sub-fields reveal beneath the row).
|
|
180
192
|
var renderReadFirstValue = function (field, schema, formatted) {
|
|
@@ -195,7 +207,9 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
195
207
|
var swatch = (0, readFirst_1.colorToCss)(field === null || field === void 0 ? void 0 : field.value);
|
|
196
208
|
return ((0, jsx_runtime_1.jsxs)("span", { style: swatch ? __assign(__assign({}, wrapStyle), {
|
|
197
209
|
// a slight wash of the chosen colour behind the swatch + hex
|
|
198
|
-
background: "color-mix(in srgb, ".concat(swatch, " 14%, transparent)"), padding: '1px 8px', borderRadius: 4 }) : wrapStyle, children: [swatch ?
|
|
210
|
+
background: "color-mix(in srgb, ".concat(swatch, " 14%, transparent)"), padding: '1px 8px', borderRadius: 4 }) : wrapStyle, children: [swatch ?
|
|
211
|
+
(0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledColorSwatch, { "aria-hidden": true, "$color": swatch, "$border": cDivider })
|
|
212
|
+
: null, (0, jsx_runtime_1.jsx)("span", { style: textStyle, children: formatted })] }));
|
|
199
213
|
}
|
|
200
214
|
if (valueType === 'file') {
|
|
201
215
|
var fileSize = (0, readFirst_1.getFileSize)(field === null || field === void 0 ? void 0 : field.value);
|
|
@@ -217,6 +231,22 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
217
231
|
var chars = field.value.length;
|
|
218
232
|
return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { size: 'small', minimal: true, intent: 'info', icon: 'CodeLine', label: "".concat(lines, " ").concat(lines === 1 ? 'line' : 'lines'), labelKey: "".concat(chars, " ").concat(chars === 1 ? 'char' : 'chars') }));
|
|
219
233
|
}
|
|
234
|
+
// Markdown read summary: the row prints the value's prose (the markdown
|
|
235
|
+
// markers are stripped by `formatOptionValue`), so a multi-line document
|
|
236
|
+
// gets a chip carrying what the one truncated line cannot -- how much
|
|
237
|
+
// more there is -- and renders in full in the inset below, exactly as a
|
|
238
|
+
// code value does. A single-line value needs neither: its one line IS
|
|
239
|
+
// the whole document, already rendered as prose.
|
|
240
|
+
if (valueType === 'markdown' &&
|
|
241
|
+
typeof (field === null || field === void 0 ? void 0 : field.value) === 'string' &&
|
|
242
|
+
isMultilineMarkdown(field.value)) {
|
|
243
|
+
// Only the count is chipped. Putting the prose inside the tag as well
|
|
244
|
+
// tints the whole row width, and a description then reads as one giant
|
|
245
|
+
// label rather than as the text it is. The guard above means the count
|
|
246
|
+
// is never 1.
|
|
247
|
+
var lines = field.value.trim().split('\n').length;
|
|
248
|
+
return ((0, jsx_runtime_1.jsxs)("span", { style: wrapStyle, children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { size: 'small', minimal: true, intent: 'info', icon: 'MarkdownLine', label: "".concat(lines, " lines") }), (0, jsx_runtime_1.jsx)("span", { style: textStyle, children: formatted })] }));
|
|
249
|
+
}
|
|
220
250
|
// Selected allowed-value / enum item with a logo (e.g. language images):
|
|
221
251
|
// render it beside the value, where it belongs — not as the field's icon.
|
|
222
252
|
var allowedImage = (0, readFirst_1.getAllowedValueImage)(field === null || field === void 0 ? void 0 : field.value, schema);
|
|
@@ -321,9 +351,7 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
321
351
|
var changed = !hidden && !readOnly && hasOptionChanged(optionField === null || optionField === void 0 ? void 0 : optionField.value, optionName);
|
|
322
352
|
// "Has a value" = set to anything non-empty. Drives the edit-row Clear
|
|
323
353
|
// button and the cluster node's filled state (see `memberSet`).
|
|
324
|
-
var hasValue = (optionField === null || optionField === void 0 ? void 0 : optionField.value) !== undefined &&
|
|
325
|
-
(optionField === null || optionField === void 0 ? void 0 : optionField.value) !== null &&
|
|
326
|
-
(optionField === null || optionField === void 0 ? void 0 : optionField.value) !== '';
|
|
354
|
+
var hasValue = (optionField === null || optionField === void 0 ? void 0 : optionField.value) !== undefined && (optionField === null || optionField === void 0 ? void 0 : optionField.value) !== null && (optionField === null || optionField === void 0 ? void 0 : optionField.value) !== '';
|
|
327
355
|
// Required-group membership shows a PERSISTENT chip on every member: amber
|
|
328
356
|
// "One of" while the group is unmet (tap → flash siblings), then a muted-green
|
|
329
357
|
// resolution once satisfied — "Covers" on the field that satisfied it,
|
|
@@ -344,8 +372,11 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
344
372
|
var chipGroups = unmetGroups.length ? unmetGroups : memberGroups;
|
|
345
373
|
var groupResolved = !!memberGroups.length && !unmetGroups.length;
|
|
346
374
|
var requiredGroupChip = !hidden && !readOnly && memberGroups.length && !(schema === null || schema === void 0 ? void 0 : schema.required) ?
|
|
347
|
-
(0, jsx_runtime_1.jsx)("span", { style: { display: 'inline-flex' }, role: 'presentation', onClick: function (e) { return e.stopPropagation(); }, onKeyDown: function (e) { return e.stopPropagation(); }, onMouseEnter: function () {
|
|
348
|
-
|
|
375
|
+
(0, jsx_runtime_1.jsx)("span", { style: { display: 'inline-flex' }, role: 'presentation', onClick: function (e) { return e.stopPropagation(); }, onKeyDown: function (e) { return e.stopPropagation(); }, onMouseEnter: function () {
|
|
376
|
+
return setHighlightedOptions(requiredGroupsInfo.members[chipGroups[0]] || []);
|
|
377
|
+
}, onMouseLeave: function () { return setHighlightedOptions([]); }, children: (0, jsx_runtime_1.jsx)(reqore_1.ReqoreDropdown, { className: 'options-readfirst-required-group', size: 'tiny', minimal: true, flat: true, compact: true, effect: { uppercase: true, spaced: 1 }, intent: groupResolved ? 'success' : 'warning', icon: groupResolved ? 'CheckLine' : 'LinkM', label: !groupResolved ? 'One of'
|
|
378
|
+
: coveredByLabel ?
|
|
379
|
+
"Covered by \u201C".concat(coveredByLabel, "\u201D")
|
|
349
380
|
: 'Covers', filterable: chipGroups.reduce(function (n, g) { return n + requiredGroupsInfo.members[g].length; }, 0) > 6, items: chipGroups.flatMap(function (groupName) { return __spreadArray(__spreadArray([], (chipGroups.length > 1 ?
|
|
350
381
|
[{ divider: true, label: groupName, dividerAlign: 'left' }]
|
|
351
382
|
: []), true), requiredGroupsInfo.members[groupName].map(function (member) {
|
|
@@ -360,8 +391,8 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
360
391
|
}), true); }) }) })
|
|
361
392
|
: null;
|
|
362
393
|
var fixedAllowedValueOption = (0, readFirst_1.isFixedCompactAllowedValueOption)(schema);
|
|
363
|
-
var editType = (_d = (fixedAllowedValueOption
|
|
364
|
-
|
|
394
|
+
var editType = (_d = (fixedAllowedValueOption ?
|
|
395
|
+
(schema === null || schema === void 0 ? void 0 : schema.type) || (schema === null || schema === void 0 ? void 0 : schema.ui_type)
|
|
365
396
|
: (schema === null || schema === void 0 ? void 0 : schema.ui_type) || (schema === null || schema === void 0 ? void 0 : schema.type))) !== null && _d !== void 0 ? _d : '';
|
|
366
397
|
// Scalars edit in place inside the row; complex fields (tall or nested
|
|
367
398
|
// editors) still open the expanded card below.
|
|
@@ -557,7 +588,9 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
557
588
|
event.preventDefault();
|
|
558
589
|
collapse_1();
|
|
559
590
|
}
|
|
560
|
-
}, children: [label, required ?
|
|
591
|
+
}, children: [label, required ?
|
|
592
|
+
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreIcon, { icon: 'Asterisk', color: 'danger', size: '10px' })
|
|
593
|
+
: null, helpIcon] }), labelShortDesc ?
|
|
561
594
|
(0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledLabelDesc, { className: 'options-readfirst-label-desc', size: 'small', effect: { opacity: 0.55 }, children: labelShortDesc })
|
|
562
595
|
: null] }), (0, jsx_runtime_1.jsx)("div", { ref: editorRef, style: { minWidth: 0 }, onKeyDown: function (event) {
|
|
563
596
|
if (event.key === 'Escape') {
|
|
@@ -595,9 +628,12 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
595
628
|
alignItems: 'flex-start',
|
|
596
629
|
justifyContent: 'space-between',
|
|
597
630
|
gap: 12,
|
|
598
|
-
}, children: [(0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledCardHeading, { children: [(0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledCardLabel, { "$color": cKey, children: [(schema === null || schema === void 0 ? void 0 : schema.icon) ||
|
|
631
|
+
}, children: [(0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledCardHeading, { children: [(0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledCardLabel, { "$color": cKey, children: [((schema === null || schema === void 0 ? void 0 : schema.icon) ||
|
|
632
|
+
(schema === null || schema === void 0 ? void 0 : schema.image)) ?
|
|
599
633
|
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreIcon, { icon: schema === null || schema === void 0 ? void 0 : schema.icon, image: schema === null || schema === void 0 ? void 0 : schema.image, size: '14px' })
|
|
600
|
-
: null, (0, jsx_runtime_1.jsxs)("span", { children: [label, required ?
|
|
634
|
+
: null, (0, jsx_runtime_1.jsxs)("span", { children: [label, required ?
|
|
635
|
+
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreIcon, { icon: 'Asterisk', color: 'danger', size: '10px' })
|
|
636
|
+
: null] }), cardBadges.map(function (badge, index) {
|
|
601
637
|
return typeof badge === 'object' ?
|
|
602
638
|
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, __assign({ size: 'small', minimal: true, className: 'options-readfirst-card-badge' }, badge), index)
|
|
603
639
|
: (0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { size: 'small', minimal: true, className: 'options-readfirst-card-badge', label: badge }, index);
|
|
@@ -627,9 +663,9 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
627
663
|
// A hash row reveals its sub-fields as read-only sub-rows under a "view
|
|
628
664
|
// more" disclosure; the row itself still expands the real editor on click.
|
|
629
665
|
var valueType = (0, readFirst_1.getValueType)(optionField, schema);
|
|
630
|
-
var hashEntries = !hidden &&
|
|
666
|
+
var hashEntries = (!hidden &&
|
|
631
667
|
(valueType === 'hash' || valueType === 'free-hash') &&
|
|
632
|
-
(schema === null || schema === void 0 ? void 0 : schema.ui_type) !== 'schema-definition' ?
|
|
668
|
+
(schema === null || schema === void 0 ? void 0 : schema.ui_type) !== 'schema-definition') ?
|
|
633
669
|
(0, readFirst_1.getHashEntries)(optionField, schema)
|
|
634
670
|
: [];
|
|
635
671
|
// A LIST OF HASHES/objects gets the same expandable structured preview a hash
|
|
@@ -656,6 +692,25 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
656
692
|
valueType === 'code-editor' &&
|
|
657
693
|
typeof (optionField === null || optionField === void 0 ? void 0 : optionField.value) === 'string' &&
|
|
658
694
|
optionField.value.length > 0;
|
|
695
|
+
// Markdown reads the same way for the same reason: the row itself can only
|
|
696
|
+
// show a line of text, and for markdown that line is the SOURCE — the reader
|
|
697
|
+
// gets `## ` and `**` where the point of the value is what it looks like
|
|
698
|
+
// rendered. The document renders in the same inset the code preview uses,
|
|
699
|
+
// through the host's renderer, so the row shows the description the way the
|
|
700
|
+
// page it describes will.
|
|
701
|
+
//
|
|
702
|
+
// Only a MULTI-LINE document earns the inset. A one-liner is already fully
|
|
703
|
+
// rendered as the row's own text, and a second copy of it below would make
|
|
704
|
+
// every description row tall for nothing.
|
|
705
|
+
var showMarkdownPreview = !hidden &&
|
|
706
|
+
!showCodePreview &&
|
|
707
|
+
!!markdownRenderer &&
|
|
708
|
+
// keyed on the schema's ui_type, not on getValueType(): a markdown value
|
|
709
|
+
// IS a string and the value type says so, which is the whole distinction
|
|
710
|
+
// between how a value is stored and which editor draws it
|
|
711
|
+
(schema === null || schema === void 0 ? void 0 : schema.ui_type) === 'markdown' &&
|
|
712
|
+
typeof (optionField === null || optionField === void 0 ? void 0 : optionField.value) === 'string' &&
|
|
713
|
+
isMultilineMarkdown(optionField.value);
|
|
659
714
|
var typeLabel = showFieldTypes ?
|
|
660
715
|
"<".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, "]") : '', ">")
|
|
661
716
|
: null;
|
|
@@ -729,7 +784,8 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
729
784
|
};
|
|
730
785
|
// Row chrome: icon/image before the label; schema `intent` as the edge
|
|
731
786
|
// stripe (message-severity stripes win when both apply).
|
|
732
|
-
var rowChromeIcon = (schema === null || schema === void 0 ? void 0 : schema.icon) ||
|
|
787
|
+
var rowChromeIcon = ((schema === null || schema === void 0 ? void 0 : schema.icon) ||
|
|
788
|
+
(schema === null || schema === void 0 ? void 0 : schema.image)) ?
|
|
733
789
|
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreIcon, { icon: schema === null || schema === void 0 ? void 0 : schema.icon, image: schema === null || schema === void 0 ? void 0 : schema.image, size: '14px', className: 'options-readfirst-row-icon' })
|
|
734
790
|
: null;
|
|
735
791
|
var rowSchemaIntentColor = (schema === null || schema === void 0 ? void 0 : schema.intent) ?
|
|
@@ -761,7 +817,7 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
761
817
|
: dotStatus === 'todo' ? cWarning
|
|
762
818
|
: dotStatus === 'set' ? cSuccess || cInfo
|
|
763
819
|
: undefined;
|
|
764
|
-
var row = ((0, jsx_runtime_1.jsxs)("div", __assign({ "data-field": optionName, role: 'button', tabIndex: 0, "aria-label": label, className: "readfirst-row options-readfirst-value".concat(hidden ? ' readfirst-row-hidden' : '').concat(fieldDisabled ? ' readfirst-row-disabled' : '').concat(isHighlighted ? ' readfirst-row-group-highlight' : '').concat(isFlashed ? ' readfirst-row-flash' : '').concat(showLabelDesc ? ' readfirst-row-info-open' : '').concat(panelMessages.length || showStructuredPreview || showCodePreview ? ' readfirst-row-tall' : '').concat(clusterBlockClass ? ' ' + clusterBlockClass : ''), "aria-disabled": fieldDisabled || undefined, style: stripeStyle, onClick: activate, onKeyDown: function (event) {
|
|
820
|
+
var row = ((0, jsx_runtime_1.jsxs)("div", __assign({ "data-field": optionName, role: 'button', tabIndex: 0, "aria-label": label, className: "readfirst-row options-readfirst-value".concat(hidden ? ' readfirst-row-hidden' : '').concat(fieldDisabled ? ' readfirst-row-disabled' : '').concat(isHighlighted ? ' readfirst-row-group-highlight' : '').concat(isFlashed ? ' readfirst-row-flash' : '').concat(showLabelDesc ? ' readfirst-row-info-open' : '').concat(panelMessages.length || showStructuredPreview || showCodePreview || showMarkdownPreview ? ' readfirst-row-tall' : '').concat(clusterBlockClass ? ' ' + clusterBlockClass : ''), "aria-disabled": fieldDisabled || undefined, style: stripeStyle, onClick: activate, onKeyDown: function (event) {
|
|
765
821
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
766
822
|
event.preventDefault();
|
|
767
823
|
activate(event);
|
|
@@ -784,7 +840,11 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
784
840
|
// noise -- and a native tooltip holding a few hundred lines is
|
|
785
841
|
// unreadable anyway. Every other value keeps its hover, which is the
|
|
786
842
|
// only way to read one that the row had to truncate.
|
|
787
|
-
title: !empty &&
|
|
843
|
+
title: (!empty &&
|
|
844
|
+
!hidden &&
|
|
845
|
+
!showCodePreview &&
|
|
846
|
+
!showMarkdownPreview &&
|
|
847
|
+
typeof formatted === 'string') ?
|
|
788
848
|
formatted
|
|
789
849
|
: undefined, "$color": empty || hidden ? "".concat(cMuted, "66") : cKey, "$empty": empty || hidden, children: [(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 ?
|
|
790
850
|
(0, jsx_runtime_1.jsx)("div", { className: 'options-readfirst-info-panel', children: panelMessages.map(renderInfoStrip) })
|
|
@@ -804,6 +864,8 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
804
864
|
values: availableOptions,
|
|
805
865
|
})
|
|
806
866
|
: (0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledCodePreview, { className: 'options-readfirst-code', "$bg": cHover, "$border": "".concat(cDivider, "88"), "$fg": cKey, children: optionField.value }) }) })
|
|
867
|
+
: null, showMarkdownPreview ?
|
|
868
|
+
(0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledRowInset, { className: 'options-readfirst-inset options-readfirst-markdown-inset', onClick: function (e) { return e.stopPropagation(); }, children: (0, jsx_runtime_1.jsx)(reqore_1.ReqoreCollapsibleContent, { maxCollapsedHeight: 96, buttonProps: { className: 'options-readfirst-viewmore' }, children: (0, jsx_runtime_1.jsx)("div", { className: 'options-readfirst-markdown', children: markdownRenderer({ value: optionField.value, compact: true }) }) }) })
|
|
807
869
|
: null] }), (0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledRowActions, { children: [!hidden && !fieldDisabled && !clustered && !coveredByLabel ? requiredGroupChip : null, !hidden ? dependsOnChip : null, draftChip, fieldDisabled && !dependencyEntries.length ?
|
|
808
870
|
(0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledActionSlot, { className: 'options-readfirst-trailing-slot', "$width": 18, children: (0, jsx_runtime_1.jsx)("span", { title: fieldDisabledReason, style: { display: 'inline-flex', opacity: 0.45 }, children: (0, jsx_runtime_1.jsx)(reqore_1.ReqoreIcon, { className: 'options-readfirst-locked', icon: 'LockLine', size: '14px' }) }) })
|
|
809
871
|
: null, infoToggle ?
|