@malloy-publisher/sdk 0.12.0 → 0.12.2
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/README.md +79 -6
- package/dist/{RenderedResult-SgDlxzs9.cjs.js → RenderedResult-Cgw4iqev.cjs.js} +1 -1
- package/dist/{RenderedResult-D8bCgThO.es.js → RenderedResult-DEjFM1DL.es.js} +2 -2
- package/dist/ServerProvider-BRQl_cBo.cjs.js +1 -0
- package/dist/{ServerProvider-DBw-thY0.es.js → ServerProvider-RnliA2Ao.es.js} +1084 -723
- package/dist/builder/index.cjs.js +1 -1
- package/dist/builder/index.es.js +3 -3
- package/dist/client/api.d.ts +754 -41
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +120 -110
- package/dist/components/Materializations/MaterializationDetailDialog.d.ts +16 -1
- package/dist/components/Model/ExplorerPage.d.ts +9 -0
- package/dist/components/Model/Model.d.ts +27 -11
- package/dist/components/ModelViewer/AccessChips.d.ts +34 -0
- package/dist/components/ModelViewer/EmptyRow.d.ts +23 -0
- package/dist/components/ModelViewer/Facts.d.ts +15 -0
- package/dist/components/ModelViewer/FieldGroup.d.ts +31 -0
- package/dist/components/ModelViewer/FieldRow.d.ts +69 -0
- package/dist/components/ModelViewer/GivenFacts.d.ts +21 -0
- package/dist/components/ModelViewer/HeaderBar.d.ts +75 -0
- package/dist/components/ModelViewer/InlineDoc.d.ts +13 -0
- package/dist/components/ModelViewer/ModelGivensSection.d.ts +32 -0
- package/dist/components/ModelViewer/ModelSection.d.ts +21 -0
- package/dist/components/ModelViewer/ModelViewer.d.ts +91 -0
- package/dist/components/ModelViewer/QueriesGroup.d.ts +15 -0
- package/dist/components/ModelViewer/RowGlyph.d.ts +27 -0
- package/dist/components/ModelViewer/RunResult.d.ts +46 -0
- package/dist/components/ModelViewer/SampleValues.d.ts +20 -0
- package/dist/components/ModelViewer/SchemaJoin.d.ts +51 -0
- package/dist/components/ModelViewer/SchemaView.d.ts +52 -0
- package/dist/components/ModelViewer/SegmentIcons.d.ts +70 -0
- package/dist/components/ModelViewer/SourcesDropdown.d.ts +53 -0
- package/dist/components/ModelViewer/SourcesNav.d.ts +25 -0
- package/dist/components/ModelViewer/StatusPill.d.ts +56 -0
- package/dist/components/ModelViewer/ValueChip.d.ts +17 -0
- package/dist/components/ModelViewer/ViewRow.d.ts +36 -0
- package/dist/components/ModelViewer/clickableBox.d.ts +29 -0
- package/dist/components/ModelViewer/codeDisplay.d.ts +44 -0
- package/dist/components/ModelViewer/docAnnotations.d.ts +90 -0
- package/dist/components/ModelViewer/explorerModel.d.ts +12 -0
- package/dist/components/ModelViewer/extensions.d.ts +94 -0
- package/dist/components/ModelViewer/fieldCode.d.ts +74 -0
- package/dist/components/ModelViewer/fieldEntities.d.ts +45 -0
- package/dist/components/ModelViewer/fieldExpansion.d.ts +41 -0
- package/dist/components/ModelViewer/givenUsage.d.ts +71 -0
- package/dist/components/ModelViewer/headerCard.d.ts +31 -0
- package/dist/components/ModelViewer/httpStatus.d.ts +4 -0
- package/dist/components/ModelViewer/icons.d.ts +31 -0
- package/dist/components/ModelViewer/index.d.ts +9 -0
- package/dist/components/ModelViewer/joinAccess.d.ts +52 -0
- package/dist/components/ModelViewer/malloyRunText.d.ts +22 -0
- package/dist/components/ModelViewer/malloyText.d.ts +21 -0
- package/dist/components/ModelViewer/modelGivens.d.ts +61 -0
- package/dist/components/ModelViewer/modelGivensContext.d.ts +9 -0
- package/dist/components/ModelViewer/modelHeaderPresentation.d.ts +28 -0
- package/dist/components/ModelViewer/modelTextDeclarations.d.ts +32 -0
- package/dist/components/ModelViewer/modelTextParse.d.ts +27 -0
- package/dist/components/ModelViewer/namedQueryCode.d.ts +12 -0
- package/dist/components/ModelViewer/offSurface.d.ts +54 -0
- package/dist/components/ModelViewer/rowLayers.d.ts +30 -0
- package/dist/components/ModelViewer/runGate.d.ts +49 -0
- package/dist/components/ModelViewer/schemaModel.d.ts +109 -0
- package/dist/components/ModelViewer/sectionOpenCommand.d.ts +45 -0
- package/dist/components/ModelViewer/sourceAccess.d.ts +67 -0
- package/dist/components/ModelViewer/sourceLineage.d.ts +14 -0
- package/dist/components/ModelViewer/sourcePicker.d.ts +66 -0
- package/dist/components/ModelViewer/surface.d.ts +47 -0
- package/dist/components/ModelViewer/text.d.ts +6 -0
- package/dist/components/ModelViewer/theme.d.ts +63 -0
- package/dist/components/ModelViewer/tokens.d.ts +52 -0
- package/dist/components/ModelViewer/ui.d.ts +48 -0
- package/dist/components/ModelViewer/useDimensionSamples.d.ts +76 -0
- package/dist/components/ModelViewer/useModelSources.d.ts +92 -0
- package/dist/components/ModelViewer/useRunQuery.d.ts +115 -0
- package/dist/components/ReportBuilder/loadMalloy.d.ts +4 -0
- package/dist/components/ServerProvider.d.ts +17 -2
- package/dist/components/filter/utils.d.ts +1 -1
- package/dist/components/given/GivenInput.d.ts +7 -1
- package/dist/components/given/GivensPanel.d.ts +3 -1
- package/dist/components/given/filterSummary.d.ts +6 -0
- package/dist/components/given/useGivenUrlParams.d.ts +11 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/components/modelPage.d.ts +36 -0
- package/dist/hooks/useDimensionalFilterRangeData.d.ts +9 -0
- package/dist/hooks/useSuggestOptions.d.ts +26 -2
- package/dist/index.cjs.js +47 -19
- package/dist/index.es.js +14137 -9697
- package/dist/useCompiledDocument-D88_2cGS.cjs.js +143 -0
- package/dist/{useCompiledDocument-CXMPtJkJ.es.js → useCompiledDocument-Dmm6xkom.es.js} +6975 -6893
- package/dist/utils/filterCondition.d.ts +14 -0
- package/dist/utils/malloyLiteral.d.ts +20 -1
- package/package.json +2 -2
- package/src/components/Materializations/MaterializationDetailDialog.tsx +33 -7
- package/src/components/Materializations/Materializations.tsx +47 -4
- package/src/components/Materializations/Materializations.versions.spec.tsx +140 -1
- package/src/components/Model/ExplorerPage.tsx +269 -0
- package/src/components/Model/Model.tsx +66 -250
- package/src/components/Model/ModelExplorer.spec.tsx +64 -1
- package/src/components/ModelViewer/AccessChips.tsx +149 -0
- package/src/components/ModelViewer/EmptyRow.tsx +71 -0
- package/src/components/ModelViewer/Facts.tsx +46 -0
- package/src/components/ModelViewer/FieldGroup.tsx +137 -0
- package/src/components/ModelViewer/FieldRow.tsx +566 -0
- package/src/components/ModelViewer/GivenFacts.tsx +89 -0
- package/src/components/ModelViewer/HeaderBar.tsx +362 -0
- package/src/components/ModelViewer/InlineDoc.tsx +50 -0
- package/src/components/ModelViewer/ModelGivensSection.tsx +142 -0
- package/src/components/ModelViewer/ModelSection.tsx +98 -0
- package/src/components/ModelViewer/ModelViewer.spec.tsx +937 -0
- package/src/components/ModelViewer/ModelViewer.tsx +777 -0
- package/src/components/ModelViewer/QueriesGroup.tsx +107 -0
- package/src/components/ModelViewer/RowGlyph.tsx +138 -0
- package/src/components/ModelViewer/RunResult.tsx +298 -0
- package/src/components/ModelViewer/SampleValues.tsx +97 -0
- package/src/components/ModelViewer/SchemaJoin.tsx +258 -0
- package/src/components/ModelViewer/SchemaView.tsx +222 -0
- package/src/components/ModelViewer/SegmentIcons.tsx +129 -0
- package/src/components/ModelViewer/SourcesDropdown.tsx +265 -0
- package/src/components/ModelViewer/SourcesNav.tsx +75 -0
- package/src/components/ModelViewer/StatusPill.tsx +145 -0
- package/src/components/ModelViewer/ValueChip.tsx +39 -0
- package/src/components/ModelViewer/ViewRow.tsx +274 -0
- package/src/components/ModelViewer/clickableBox.ts +59 -0
- package/src/components/ModelViewer/codeDisplay.spec.ts +176 -0
- package/src/components/ModelViewer/codeDisplay.ts +118 -0
- package/src/components/ModelViewer/docAnnotations.spec.ts +181 -0
- package/src/components/ModelViewer/docAnnotations.ts +244 -0
- package/src/components/ModelViewer/docAnnotations.typeDetail.spec.ts +114 -0
- package/src/components/ModelViewer/explorerModel.spec.ts +43 -0
- package/src/components/ModelViewer/explorerModel.ts +31 -0
- package/src/components/ModelViewer/extensions.tsx +112 -0
- package/src/components/ModelViewer/fieldCode.spec.ts +168 -0
- package/src/components/ModelViewer/fieldCode.ts +118 -0
- package/src/components/ModelViewer/fieldEntities.ts +63 -0
- package/src/components/ModelViewer/fieldExpansion.spec.ts +116 -0
- package/src/components/ModelViewer/fieldExpansion.ts +95 -0
- package/src/components/ModelViewer/givenUsage.spec.ts +304 -0
- package/src/components/ModelViewer/givenUsage.ts +325 -0
- package/src/components/ModelViewer/headerCard.tsx +102 -0
- package/src/components/ModelViewer/httpStatus.ts +15 -0
- package/src/components/ModelViewer/icons.tsx +67 -0
- package/src/components/ModelViewer/index.ts +26 -0
- package/src/components/ModelViewer/joinAccess.spec.ts +95 -0
- package/src/components/ModelViewer/joinAccess.ts +54 -0
- package/src/components/ModelViewer/malloyRunText.spec.ts +48 -0
- package/src/components/ModelViewer/malloyRunText.ts +51 -0
- package/src/components/ModelViewer/malloyText.spec.ts +47 -0
- package/src/components/ModelViewer/malloyText.ts +77 -0
- package/src/components/ModelViewer/modelGivens.ts +228 -0
- package/src/components/ModelViewer/modelGivensContext.ts +13 -0
- package/src/components/ModelViewer/modelHeaderPresentation.spec.ts +31 -0
- package/src/components/ModelViewer/modelHeaderPresentation.ts +41 -0
- package/src/components/ModelViewer/modelTextDeclarations.spec.ts +336 -0
- package/src/components/ModelViewer/modelTextDeclarations.ts +228 -0
- package/src/components/ModelViewer/modelTextParse.ts +112 -0
- package/src/components/ModelViewer/namedQueryCode.spec.ts +58 -0
- package/src/components/ModelViewer/namedQueryCode.ts +26 -0
- package/src/components/ModelViewer/offSurface.tsx +124 -0
- package/src/components/ModelViewer/rowLayers.tsx +104 -0
- package/src/components/ModelViewer/runGate.spec.ts +219 -0
- package/src/components/ModelViewer/runGate.ts +145 -0
- package/src/components/ModelViewer/schemaModel.defaultSource.spec.ts +126 -0
- package/src/components/ModelViewer/schemaModel.queries.spec.ts +37 -0
- package/src/components/ModelViewer/schemaModel.ts +300 -0
- package/src/components/ModelViewer/sectionOpenCommand.tsx +125 -0
- package/src/components/ModelViewer/sourceAccess.spec.ts +130 -0
- package/src/components/ModelViewer/sourceAccess.ts +194 -0
- package/src/components/ModelViewer/sourceLineage.spec.ts +73 -0
- package/src/components/ModelViewer/sourceLineage.ts +38 -0
- package/src/components/ModelViewer/sourcePicker.spec.ts +294 -0
- package/src/components/ModelViewer/sourcePicker.ts +162 -0
- package/src/components/ModelViewer/surface.ts +51 -0
- package/src/components/ModelViewer/text.tsx +33 -0
- package/src/components/ModelViewer/theme.spec.ts +38 -0
- package/src/components/ModelViewer/theme.ts +58 -0
- package/src/components/ModelViewer/tokens.ts +87 -0
- package/src/components/ModelViewer/ui.tsx +201 -0
- package/src/components/ModelViewer/useDimensionSamples.spec.tsx +139 -0
- package/src/components/ModelViewer/useDimensionSamples.ts +220 -0
- package/src/components/ModelViewer/useModelSources.spec.ts +110 -0
- package/src/components/ModelViewer/useModelSources.ts +238 -0
- package/src/components/ModelViewer/useRunQuery.spec.ts +50 -0
- package/src/components/ModelViewer/useRunQuery.ts +223 -0
- package/src/components/Package/Package.agents.spec.tsx +5 -4
- package/src/components/Package/Package.tsx +8 -1
- package/src/components/ReportBuilder/emptyStart.spec.ts +8 -0
- package/src/components/ReportBuilder/loadMalloy.ts +8 -1
- package/src/components/ServerProvider.tsx +29 -3
- package/src/components/filter/utils.ts +4 -60
- package/src/components/given/FilterButton.tsx +4 -1
- package/src/components/given/GivenInput.tsx +8 -0
- package/src/components/given/GivensPanel.tsx +6 -1
- package/src/components/given/filterSummary.spec.ts +31 -1
- package/src/components/given/filterSummary.ts +41 -19
- package/src/components/given/useGivenUrlParams.spec.tsx +32 -0
- package/src/components/given/useGivenUrlParams.ts +49 -14
- package/src/components/index.ts +6 -1
- package/src/components/legacy/malloynb/Notebook.spec.tsx +38 -4
- package/src/components/legacy/malloynb/NotebookCell.tsx +8 -2
- package/src/components/modelPage.spec.ts +79 -0
- package/src/components/modelPage.ts +48 -0
- package/src/hooks/useDimensionFilters.ts +3 -58
- package/src/hooks/useDimensionFiltersQuery.ts +3 -58
- package/src/hooks/useDimensionalFilterRangeData.spec.ts +57 -0
- package/src/hooks/useDimensionalFilterRangeData.ts +8 -63
- package/src/hooks/useSuggestOptions.dom.spec.ts +54 -1
- package/src/hooks/useSuggestOptions.spec.ts +71 -0
- package/src/hooks/useSuggestOptions.ts +102 -12
- package/src/utils/filterCondition.spec.ts +87 -0
- package/src/utils/filterCondition.ts +66 -0
- package/src/utils/malloyLiteral.spec.ts +53 -1
- package/src/utils/malloyLiteral.ts +47 -12
- package/dist/ServerProvider-BHfg1Ed6.cjs.js +0 -1
- package/dist/useCompiledDocument-D7X_K6YU.cjs.js +0 -142
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import { Box, CircularProgress, Collapse, Tooltip } from "@mui/material";
|
|
5
|
+
import {
|
|
6
|
+
useContext,
|
|
7
|
+
useId,
|
|
8
|
+
useMemo,
|
|
9
|
+
type MouseEvent,
|
|
10
|
+
type ReactNode,
|
|
11
|
+
} from "react";
|
|
12
|
+
import { focusRingSx } from "./clickableBox";
|
|
13
|
+
import { stripDefinitionWrapper } from "./codeDisplay";
|
|
14
|
+
import { useModelViewerExtensions } from "./extensions";
|
|
15
|
+
import type { FieldCodeLookup } from "./fieldCode";
|
|
16
|
+
import { hasDefinitionToShow, isIndexedDimension } from "./fieldExpansion";
|
|
17
|
+
import { GivenFacts, GivenPill } from "./GivenFacts";
|
|
18
|
+
import { givensReadBy } from "./givenUsage";
|
|
19
|
+
import { isDocCut } from "./InlineDoc";
|
|
20
|
+
import { ModelGivensContext } from "./modelGivensContext";
|
|
21
|
+
import { RowGlyph } from "./RowGlyph";
|
|
22
|
+
import type { RowLayer } from "./rowLayers";
|
|
23
|
+
import { SampleValues } from "./SampleValues";
|
|
24
|
+
import type { ExplorerField } from "./schemaModel";
|
|
25
|
+
import { useSectionOpen } from "./sectionOpenCommand";
|
|
26
|
+
import { StatusPill } from "./StatusPill";
|
|
27
|
+
import { PANE_CARD_SX, PANE_INSET } from "./surface";
|
|
28
|
+
import { fontSizes, roles, TEXT_TERTIARY } from "./theme";
|
|
29
|
+
import { ENTITY_NAME_SX, ROW_META_SX } from "./tokens";
|
|
30
|
+
import { LoadErrorAlert, QueryCode } from "./ui";
|
|
31
|
+
import type { RunContext } from "./useRunQuery";
|
|
32
|
+
|
|
33
|
+
export type { FieldCodeLookup } from "./fieldCode";
|
|
34
|
+
|
|
35
|
+
/** The row line's own horizontal inset; what the row opens to hangs under the
|
|
36
|
+
* name, this far in. */
|
|
37
|
+
const ROW_PAD_X = 10;
|
|
38
|
+
/**
|
|
39
|
+
* The name column's width on a wide page, so descriptions start in one column.
|
|
40
|
+
* A share of the row rather than a fixed size, so a wider page gives long names
|
|
41
|
+
* the room (every row of a page is the same width, so the column still lines up),
|
|
42
|
+
* between a floor that keeps short pages as they were and a cap that leaves the
|
|
43
|
+
* description most of the line.
|
|
44
|
+
*/
|
|
45
|
+
const NAME_COLUMN_WIDTH = "clamp(340px, 40%, 520px)";
|
|
46
|
+
|
|
47
|
+
interface FieldRowProps {
|
|
48
|
+
/** A dimension, measure or calculation; a view or named query is a ViewRow. */
|
|
49
|
+
field: ExplorerField;
|
|
50
|
+
/** Where a dimension's sample values are read; absent, the row offers none. */
|
|
51
|
+
run?: RunContext;
|
|
52
|
+
modelPath: string;
|
|
53
|
+
/** The source that declares the field (a joined source's, for a join's field). */
|
|
54
|
+
sourceName: string;
|
|
55
|
+
/** Where the field's Malloy definition comes from, when the source's
|
|
56
|
+
* definitions are available at all. A lookup that resolves to no code
|
|
57
|
+
* leaves the row with nothing to open. */
|
|
58
|
+
fieldCode?: FieldCodeLookup;
|
|
59
|
+
/** A joined source's field, shown inside a join on another source's page:
|
|
60
|
+
* it offers no Values card, since its values are that source's. */
|
|
61
|
+
joined?: boolean;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Compact field row: mono name in a fixed column, then its type and
|
|
66
|
+
* annotations, then what the field MEANS on the rest of the line. What it's
|
|
67
|
+
* MADE OF opens in place under it: its Malloy, a dimension's sample values, the
|
|
68
|
+
* givens it reads, and whatever a host adds. A row with nothing to open is plain
|
|
69
|
+
* text; one with something is a button (Enter or Space opens it too) whose
|
|
70
|
+
* `aria-expanded` says which.
|
|
71
|
+
*/
|
|
72
|
+
export function FieldRow({
|
|
73
|
+
field,
|
|
74
|
+
run,
|
|
75
|
+
modelPath,
|
|
76
|
+
sourceName,
|
|
77
|
+
fieldCode,
|
|
78
|
+
joined = false,
|
|
79
|
+
}: FieldRowProps) {
|
|
80
|
+
// Open or shut by the reader, and by its section's Expand / Collapse.
|
|
81
|
+
const [open, setOpen] = useSectionOpen();
|
|
82
|
+
const {
|
|
83
|
+
fetchSamples,
|
|
84
|
+
samplesGeneration,
|
|
85
|
+
renderFieldStatus,
|
|
86
|
+
renderFieldAction,
|
|
87
|
+
renderFieldDetail,
|
|
88
|
+
} = useModelViewerExtensions();
|
|
89
|
+
const context = { modelPath, sourceName, field, joined };
|
|
90
|
+
const hostStatus = renderFieldStatus?.(context);
|
|
91
|
+
const hostAction = renderFieldAction?.(context);
|
|
92
|
+
|
|
93
|
+
// What the row explains. An authored `#(doc)` always wins: it is the
|
|
94
|
+
// modeler's own words about this field. Only where there are none does a
|
|
95
|
+
// host's description of the column it passes through stand in.
|
|
96
|
+
const generatedDoc = field.doc ? undefined : fieldCode?.columnDoc;
|
|
97
|
+
const doc = field.doc ?? generatedDoc;
|
|
98
|
+
|
|
99
|
+
// Whether there is a definition to show: its own code, or, for an inherited
|
|
100
|
+
// column, where it comes from.
|
|
101
|
+
const showDefinition = hasDefinitionToShow(fieldCode);
|
|
102
|
+
// The givens its definition reads: a "Given" pill on the line, and what each
|
|
103
|
+
// is in the card it opens to.
|
|
104
|
+
const modelGivens = useContext(ModelGivensContext);
|
|
105
|
+
const givensRead = useMemo(
|
|
106
|
+
() => givensReadBy(fieldCode?.code, modelGivens),
|
|
107
|
+
[fieldCode?.code, modelGivens],
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
// Sample values for a dimension the model tags `#(index)`, on the source
|
|
111
|
+
// that declares it: a joined field's values are its own source's.
|
|
112
|
+
const offersValues = isIndexedDimension(field) && !joined && !!run;
|
|
113
|
+
const layers: RowLayer[] = [
|
|
114
|
+
...(showDefinition ? (["code"] as const) : []),
|
|
115
|
+
...(offersValues ? (["values"] as const) : []),
|
|
116
|
+
...(givensRead.length > 0 ? (["givens"] as const) : []),
|
|
117
|
+
];
|
|
118
|
+
const shows = (l: RowLayer) => layers.includes(l);
|
|
119
|
+
const glyphKind =
|
|
120
|
+
field.kind === "measure"
|
|
121
|
+
? "measure"
|
|
122
|
+
: field.kind === "calculate"
|
|
123
|
+
? "calculate"
|
|
124
|
+
: "dimension";
|
|
125
|
+
|
|
126
|
+
// The row's own card: its code, then its values and the givens it reads,
|
|
127
|
+
// each parted from the one above by a hairline. A host may keep it, add to
|
|
128
|
+
// it, or show its own in its place (`renderFieldDetail`).
|
|
129
|
+
const builtIn =
|
|
130
|
+
layers.length > 0 ? (
|
|
131
|
+
<Box
|
|
132
|
+
data-testid="model-viewer-field-card"
|
|
133
|
+
sx={{
|
|
134
|
+
...PANE_CARD_SX,
|
|
135
|
+
"& > * + *": {
|
|
136
|
+
borderTop: 1,
|
|
137
|
+
borderColor: "divider",
|
|
138
|
+
},
|
|
139
|
+
}}
|
|
140
|
+
>
|
|
141
|
+
{shows("code") &&
|
|
142
|
+
(fieldCode?.loading ? (
|
|
143
|
+
<Box sx={{ p: PANE_INSET, display: "flex" }}>
|
|
144
|
+
<CircularProgress
|
|
145
|
+
size={12}
|
|
146
|
+
sx={{ color: "text.secondary" }}
|
|
147
|
+
/>
|
|
148
|
+
</Box>
|
|
149
|
+
) : fieldCode?.code ? (
|
|
150
|
+
// The `name is` wrapper dropped, since the row already names it.
|
|
151
|
+
<QueryCode
|
|
152
|
+
testId="model-viewer-definition"
|
|
153
|
+
code={stripDefinitionWrapper(field.name, fieldCode.code)}
|
|
154
|
+
framed={false}
|
|
155
|
+
/>
|
|
156
|
+
) : fieldCode?.inheritedFrom ? (
|
|
157
|
+
// An inherited column has no definition of its own; its
|
|
158
|
+
// Code is where it comes from, said in a comment over the
|
|
159
|
+
// line so the row stays one card.
|
|
160
|
+
<QueryCode
|
|
161
|
+
testId="model-viewer-definition"
|
|
162
|
+
code={`${
|
|
163
|
+
fieldCode.inheritedFrom.fromTable
|
|
164
|
+
? "// A column of the table this source reads, as it is"
|
|
165
|
+
: "// Passed through from the query this source is built on"
|
|
166
|
+
}\n${fieldCode.inheritedFrom.code}`}
|
|
167
|
+
framed={false}
|
|
168
|
+
/>
|
|
169
|
+
) : (
|
|
170
|
+
// The read failed: about the pane rather than the field.
|
|
171
|
+
<Box sx={{ p: 1 }}>
|
|
172
|
+
<LoadErrorAlert message="Couldn't load this model's code right now." />
|
|
173
|
+
</Box>
|
|
174
|
+
))}
|
|
175
|
+
{shows("values") && run && (
|
|
176
|
+
<Box sx={{ p: PANE_INSET }}>
|
|
177
|
+
<SampleValues
|
|
178
|
+
run={run}
|
|
179
|
+
fetchSamples={fetchSamples}
|
|
180
|
+
generation={samplesGeneration}
|
|
181
|
+
modelPath={modelPath}
|
|
182
|
+
sourceName={sourceName}
|
|
183
|
+
field={field}
|
|
184
|
+
/>
|
|
185
|
+
</Box>
|
|
186
|
+
)}
|
|
187
|
+
{shows("givens") && (
|
|
188
|
+
<GivenFacts givens={givensRead} framed={false} />
|
|
189
|
+
)}
|
|
190
|
+
</Box>
|
|
191
|
+
) : undefined;
|
|
192
|
+
const detail = renderFieldDetail
|
|
193
|
+
? renderFieldDetail(context, builtIn)
|
|
194
|
+
: builtIn;
|
|
195
|
+
const opens = detail !== undefined && detail !== null && detail !== false;
|
|
196
|
+
|
|
197
|
+
return (
|
|
198
|
+
<Box
|
|
199
|
+
data-testid="model-viewer-field-row"
|
|
200
|
+
data-name={field.name}
|
|
201
|
+
// No fill of its own: an open field's code is its own card (QueryCode), so
|
|
202
|
+
// a little air below is all that sets it apart from the next row.
|
|
203
|
+
sx={open && opens ? { pb: 1.25 } : undefined}
|
|
204
|
+
>
|
|
205
|
+
<RowLine
|
|
206
|
+
glyph={<RowGlyph kind={glyphKind} dataType={field.dataType} />}
|
|
207
|
+
name={field.name}
|
|
208
|
+
typeLabel={field.dataType}
|
|
209
|
+
typeTip={field.typeTip}
|
|
210
|
+
typeAsChip
|
|
211
|
+
stackPills
|
|
212
|
+
doc={doc}
|
|
213
|
+
generatedDoc={!!generatedDoc}
|
|
214
|
+
open={open}
|
|
215
|
+
expandable={opens}
|
|
216
|
+
onToggle={() => setOpen((o) => !o)}
|
|
217
|
+
descriptors={
|
|
218
|
+
// What the field IS, beside its type on its own line: whether it
|
|
219
|
+
// reads a given. Its display tags (`label="…"`, `currency`) show
|
|
220
|
+
// in its code when opened.
|
|
221
|
+
<GivenPill givens={givensRead} />
|
|
222
|
+
}
|
|
223
|
+
pills={hostStatus}
|
|
224
|
+
action={hostAction}
|
|
225
|
+
/>
|
|
226
|
+
{opens && (
|
|
227
|
+
<Collapse in={open} timeout="auto" unmountOnExit>
|
|
228
|
+
{/* Hangs under the field name: the row's card, or what a host
|
|
229
|
+
shows in its place. */}
|
|
230
|
+
<Box
|
|
231
|
+
data-testid="model-viewer-field-detail"
|
|
232
|
+
sx={{
|
|
233
|
+
mx: `${ROW_PAD_X}px`,
|
|
234
|
+
mt: "2px",
|
|
235
|
+
display: "flex",
|
|
236
|
+
flexDirection: "column",
|
|
237
|
+
gap: 1.5,
|
|
238
|
+
}}
|
|
239
|
+
>
|
|
240
|
+
{detail}
|
|
241
|
+
</Box>
|
|
242
|
+
</Collapse>
|
|
243
|
+
)}
|
|
244
|
+
</Box>
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* THE line of a model page's row — a view, a named query, a measure or a
|
|
250
|
+
* dimension alike, so the page reads as one list: the name in a fixed column
|
|
251
|
+
* (with its type, marks, pills and one action), then what it means on the rest of
|
|
252
|
+
* the line. A row with something to open is a button on its name (Enter or Space
|
|
253
|
+
* opens it, `aria-expanded` says whether it is) and toggles from anywhere on the
|
|
254
|
+
* line; one with nothing to open is plain text.
|
|
255
|
+
*/
|
|
256
|
+
export function RowLine({
|
|
257
|
+
glyph,
|
|
258
|
+
name,
|
|
259
|
+
typeLabel,
|
|
260
|
+
typeAsChip = false,
|
|
261
|
+
stackPills = false,
|
|
262
|
+
typeTip,
|
|
263
|
+
descriptors,
|
|
264
|
+
pills,
|
|
265
|
+
action,
|
|
266
|
+
trailing,
|
|
267
|
+
doc,
|
|
268
|
+
generatedDoc = false,
|
|
269
|
+
open,
|
|
270
|
+
expandable,
|
|
271
|
+
onToggle,
|
|
272
|
+
}: {
|
|
273
|
+
/** The row's kind glyph (`RowGlyph`), before its name. */
|
|
274
|
+
glyph?: ReactNode;
|
|
275
|
+
name: string;
|
|
276
|
+
typeLabel?: string;
|
|
277
|
+
/** A field's type as a chip, apart from the name; a
|
|
278
|
+
* join's "N fields" count stays text. */
|
|
279
|
+
typeAsChip?: boolean;
|
|
280
|
+
/** A field's layout: its name and type on the first line, always together,
|
|
281
|
+
* and its pills and action on a second line under them (only when there are
|
|
282
|
+
* any) — so its state never squeezes the name, and the rebuild sits beside
|
|
283
|
+
* the pill it rebuilds. */
|
|
284
|
+
stackPills?: boolean;
|
|
285
|
+
/** The type chip's tooltip, where its label can't say it all (a record's fields). */
|
|
286
|
+
typeTip?: string;
|
|
287
|
+
/** Descriptor chips after the type, on the name's own line (a field's
|
|
288
|
+
* display tags, its "given"). */
|
|
289
|
+
descriptors?: ReactNode;
|
|
290
|
+
/** Status and declaration pills after the name. */
|
|
291
|
+
pills?: ReactNode;
|
|
292
|
+
/** The row's one action, beside its pills (Rebuild / Build). */
|
|
293
|
+
action?: ReactNode;
|
|
294
|
+
/** Controls at the line's right edge — an open view's Result | Code | Download. */
|
|
295
|
+
trailing?: ReactNode;
|
|
296
|
+
doc?: string;
|
|
297
|
+
/** `doc` is a host's description, not the modeler's: marked as generated. */
|
|
298
|
+
generatedDoc?: boolean;
|
|
299
|
+
open: boolean;
|
|
300
|
+
expandable: boolean;
|
|
301
|
+
onToggle: () => void;
|
|
302
|
+
}) {
|
|
303
|
+
// The whole line toggles, not only the name: a click on the description
|
|
304
|
+
// opens the row too. A click on another control on the line (Rebuild) is that
|
|
305
|
+
// control's own. The name is the row's button, so a keyboard's Enter or Space
|
|
306
|
+
// reaches here as its click.
|
|
307
|
+
const pillsId = useId();
|
|
308
|
+
const onRowClick = (e: MouseEvent<HTMLElement>) => {
|
|
309
|
+
if (!expandable) return;
|
|
310
|
+
// A click in the action slot is the action's, even on a disabled one: a
|
|
311
|
+
// disabled button takes no pointer events, so its click lands on the
|
|
312
|
+
// tooltip's wrapper, which is no control at all.
|
|
313
|
+
if ((e.target as Element).closest("[data-row-action]")) return;
|
|
314
|
+
const control = (e.target as Element).closest(
|
|
315
|
+
"button, a, [role='button']",
|
|
316
|
+
);
|
|
317
|
+
if (control && !control.hasAttribute("data-field-toggle")) return;
|
|
318
|
+
onToggle();
|
|
319
|
+
};
|
|
320
|
+
return (
|
|
321
|
+
<Box
|
|
322
|
+
onClick={onRowClick}
|
|
323
|
+
sx={{
|
|
324
|
+
display: "flex",
|
|
325
|
+
// Top-aligned while open, where the description may wrap to
|
|
326
|
+
// several lines: the name stays on the first one.
|
|
327
|
+
alignItems: open ? "flex-start" : "center",
|
|
328
|
+
borderRadius: 1.5,
|
|
329
|
+
transition: "background 0.1s",
|
|
330
|
+
cursor: expandable ? "pointer" : "default",
|
|
331
|
+
// A read-only row takes neither the tint nor the pointer, so it
|
|
332
|
+
// never reads as an editable cell.
|
|
333
|
+
...(expandable
|
|
334
|
+
? {
|
|
335
|
+
"&:hover": { bgcolor: roles.background.muted },
|
|
336
|
+
// A quiet chip's fill is the hover's grey; lift it a step so it
|
|
337
|
+
// doesn't vanish into the row.
|
|
338
|
+
"&:hover [data-pill-tone='quiet']": {
|
|
339
|
+
bgcolor: roles.background.strong,
|
|
340
|
+
},
|
|
341
|
+
}
|
|
342
|
+
: {}),
|
|
343
|
+
}}
|
|
344
|
+
>
|
|
345
|
+
{/* The name column: the row's identity and its one action (Rebuild,
|
|
346
|
+
beside the pill it rebuilds). Exactly NAME_COLUMN_WIDTH on a wide page —
|
|
347
|
+
a long name truncates rather than widening it — so the descriptions
|
|
348
|
+
after it start in one column down the section. */}
|
|
349
|
+
<Box
|
|
350
|
+
sx={{
|
|
351
|
+
display: "flex",
|
|
352
|
+
flexDirection: stackPills ? "column" : "row",
|
|
353
|
+
alignItems: stackPills ? "stretch" : "center",
|
|
354
|
+
minWidth: 0,
|
|
355
|
+
flexShrink: 0,
|
|
356
|
+
width: { md: NAME_COLUMN_WIDTH },
|
|
357
|
+
overflow: { md: "hidden" },
|
|
358
|
+
}}
|
|
359
|
+
>
|
|
360
|
+
<Box
|
|
361
|
+
component={expandable ? "button" : "div"}
|
|
362
|
+
type={expandable ? "button" : undefined}
|
|
363
|
+
aria-expanded={expandable ? open : undefined}
|
|
364
|
+
// Stacked, the pills sit outside the button, so it names them as
|
|
365
|
+
// its description: they are still read with the row.
|
|
366
|
+
aria-describedby={stackPills ? pillsId : undefined}
|
|
367
|
+
data-field-toggle={expandable ? "" : undefined}
|
|
368
|
+
sx={{
|
|
369
|
+
appearance: "none",
|
|
370
|
+
border: "none",
|
|
371
|
+
background: "none",
|
|
372
|
+
font: "inherit",
|
|
373
|
+
color: "inherit",
|
|
374
|
+
textAlign: "left",
|
|
375
|
+
// Hugs its content so the Rebuild that follows sits right
|
|
376
|
+
// beside the pill; `minWidth: 0` lets a long name truncate.
|
|
377
|
+
minWidth: 0,
|
|
378
|
+
px: `${ROW_PAD_X}px`,
|
|
379
|
+
py: "6px",
|
|
380
|
+
borderRadius: 1.5,
|
|
381
|
+
// Inset: the name column clips its overflow, which would cut
|
|
382
|
+
// the browser's outside ring.
|
|
383
|
+
...focusRingSx,
|
|
384
|
+
display: "flex",
|
|
385
|
+
alignItems: "baseline",
|
|
386
|
+
gap: "8px",
|
|
387
|
+
// Stacked: the name and its type on one line, never split (a name
|
|
388
|
+
// too long for both truncates). Otherwise the chips wrap under
|
|
389
|
+
// the name rather than squeezing it into an ellipsis.
|
|
390
|
+
flexWrap: stackPills ? "nowrap" : "wrap",
|
|
391
|
+
rowGap: "4px",
|
|
392
|
+
cursor: expandable ? "pointer" : "default",
|
|
393
|
+
}}
|
|
394
|
+
>
|
|
395
|
+
{glyph}
|
|
396
|
+
{/* Identity (Base): name + type. */}
|
|
397
|
+
<Box
|
|
398
|
+
component="span"
|
|
399
|
+
// Its own box only for grouping: its name and chips flow in the
|
|
400
|
+
// row's one wrapping line with the pills after them, so chips
|
|
401
|
+
// fill the name's line first and only what doesn't fit drops below.
|
|
402
|
+
sx={{
|
|
403
|
+
display: "contents",
|
|
404
|
+
"& > *": { flexShrink: 0 },
|
|
405
|
+
// Stacked, the name is what gives way on the one line.
|
|
406
|
+
...(stackPills
|
|
407
|
+
? {
|
|
408
|
+
"& > *:first-of-type": {
|
|
409
|
+
flexShrink: 1,
|
|
410
|
+
minWidth: 0,
|
|
411
|
+
},
|
|
412
|
+
}
|
|
413
|
+
: {}),
|
|
414
|
+
}}
|
|
415
|
+
>
|
|
416
|
+
<Box
|
|
417
|
+
component="span"
|
|
418
|
+
// The full name on hover when the column cut it.
|
|
419
|
+
title={name}
|
|
420
|
+
sx={{
|
|
421
|
+
...ENTITY_NAME_SX,
|
|
422
|
+
// Truncates only when the name alone is wider than the column.
|
|
423
|
+
maxWidth: "100%",
|
|
424
|
+
overflow: "hidden",
|
|
425
|
+
textOverflow: "ellipsis",
|
|
426
|
+
whiteSpace: "nowrap",
|
|
427
|
+
}}
|
|
428
|
+
>
|
|
429
|
+
{name}
|
|
430
|
+
</Box>
|
|
431
|
+
{typeLabel &&
|
|
432
|
+
(typeAsChip ? (
|
|
433
|
+
// The type is Malloy's word, so the token voice.
|
|
434
|
+
<Tooltip
|
|
435
|
+
title={
|
|
436
|
+
typeTip ? (
|
|
437
|
+
<Box sx={{ whiteSpace: "pre-line" }}>
|
|
438
|
+
{typeTip}
|
|
439
|
+
</Box>
|
|
440
|
+
) : (
|
|
441
|
+
""
|
|
442
|
+
)
|
|
443
|
+
}
|
|
444
|
+
>
|
|
445
|
+
<StatusPill
|
|
446
|
+
voice="token"
|
|
447
|
+
tone="quiet"
|
|
448
|
+
sx={{ alignSelf: "center" }}
|
|
449
|
+
>
|
|
450
|
+
{typeLabel}
|
|
451
|
+
</StatusPill>
|
|
452
|
+
</Tooltip>
|
|
453
|
+
) : (
|
|
454
|
+
<Box component="span" sx={ROW_META_SX}>
|
|
455
|
+
{typeLabel}
|
|
456
|
+
</Box>
|
|
457
|
+
))}
|
|
458
|
+
{descriptors}
|
|
459
|
+
</Box>
|
|
460
|
+
{!stackPills && pills}
|
|
461
|
+
</Box>
|
|
462
|
+
{stackPills ? (
|
|
463
|
+
// The second line: the field's states and its one action, together.
|
|
464
|
+
// Hidden when empty, so a row with no state stays one line.
|
|
465
|
+
<Box
|
|
466
|
+
id={pillsId}
|
|
467
|
+
sx={{
|
|
468
|
+
display: "flex",
|
|
469
|
+
alignItems: "center",
|
|
470
|
+
flexWrap: "wrap",
|
|
471
|
+
gap: "8px",
|
|
472
|
+
px: `${ROW_PAD_X}px`,
|
|
473
|
+
pb: "6px",
|
|
474
|
+
mt: "-2px",
|
|
475
|
+
"&:empty": { display: "none" },
|
|
476
|
+
}}
|
|
477
|
+
>
|
|
478
|
+
{pills}
|
|
479
|
+
{action && (
|
|
480
|
+
<Box
|
|
481
|
+
component="span"
|
|
482
|
+
data-row-action=""
|
|
483
|
+
sx={{ display: "inline-flex" }}
|
|
484
|
+
>
|
|
485
|
+
{action}
|
|
486
|
+
</Box>
|
|
487
|
+
)}
|
|
488
|
+
</Box>
|
|
489
|
+
) : (
|
|
490
|
+
// A sibling of the name button, never inside it (a button in a
|
|
491
|
+
// button is invalid and reads as one target).
|
|
492
|
+
action && (
|
|
493
|
+
<Box
|
|
494
|
+
component="span"
|
|
495
|
+
data-row-action=""
|
|
496
|
+
sx={{ display: "inline-flex" }}
|
|
497
|
+
>
|
|
498
|
+
{action}
|
|
499
|
+
</Box>
|
|
500
|
+
)
|
|
501
|
+
)}
|
|
502
|
+
</Box>
|
|
503
|
+
{/* What the field means, on the line's spare width: the list is read by
|
|
504
|
+
scanning names, so the description never goes UNDER the name. Cut to
|
|
505
|
+
one line while shut, carrying the whole of it as a plain title when
|
|
506
|
+
cut; an open row wraps it to its full text. */}
|
|
507
|
+
{doc && (
|
|
508
|
+
<Box
|
|
509
|
+
component="span"
|
|
510
|
+
data-testid="model-viewer-field-doc"
|
|
511
|
+
onMouseEnter={(e: MouseEvent<HTMLElement>) => {
|
|
512
|
+
const el = e.currentTarget;
|
|
513
|
+
el.title = !open && isDocCut(el, doc) ? doc : "";
|
|
514
|
+
}}
|
|
515
|
+
sx={{
|
|
516
|
+
flex: 1,
|
|
517
|
+
minWidth: 0,
|
|
518
|
+
ml: 1,
|
|
519
|
+
pr: `${ROW_PAD_X}px`,
|
|
520
|
+
py: open ? "6px" : 0,
|
|
521
|
+
fontSize: fontSizes.small,
|
|
522
|
+
color: TEXT_TERTIARY,
|
|
523
|
+
...(open
|
|
524
|
+
? { whiteSpace: "pre-line" }
|
|
525
|
+
: {
|
|
526
|
+
whiteSpace: "nowrap",
|
|
527
|
+
overflow: "hidden",
|
|
528
|
+
textOverflow: "ellipsis",
|
|
529
|
+
}),
|
|
530
|
+
}}
|
|
531
|
+
>
|
|
532
|
+
{generatedDoc && (
|
|
533
|
+
// Written by the host, not the modeler: marked, so the two never
|
|
534
|
+
// read as one voice.
|
|
535
|
+
<StatusPill
|
|
536
|
+
voice="state"
|
|
537
|
+
tone="quiet"
|
|
538
|
+
data-testid="model-viewer-field-doc-generated"
|
|
539
|
+
sx={{ mr: 0.75, verticalAlign: "baseline" }}
|
|
540
|
+
>
|
|
541
|
+
Generated
|
|
542
|
+
</StatusPill>
|
|
543
|
+
)}
|
|
544
|
+
{open ? doc : doc.split("\n")[0]}
|
|
545
|
+
</Box>
|
|
546
|
+
)}
|
|
547
|
+
{trailing && (
|
|
548
|
+
<Box
|
|
549
|
+
sx={{
|
|
550
|
+
ml: "auto",
|
|
551
|
+
flexShrink: 0,
|
|
552
|
+
pl: 1,
|
|
553
|
+
pr: `${ROW_PAD_X}px`,
|
|
554
|
+
display: "inline-flex",
|
|
555
|
+
alignItems: "center",
|
|
556
|
+
// The name line's height, so the icons center on the name even
|
|
557
|
+
// when an open row's description wraps.
|
|
558
|
+
height: 32,
|
|
559
|
+
}}
|
|
560
|
+
>
|
|
561
|
+
{trailing}
|
|
562
|
+
</Box>
|
|
563
|
+
)}
|
|
564
|
+
</Box>
|
|
565
|
+
);
|
|
566
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import { Box, Tooltip } from "@mui/material";
|
|
5
|
+
import { SANS_FONT_FAMILY, fontSizes } from "./theme";
|
|
6
|
+
import { StatusPill } from "./StatusPill";
|
|
7
|
+
import { PANE_CARD_SX, PANE_INSET } from "./surface";
|
|
8
|
+
import { renderGivenDefault } from "../given/utils";
|
|
9
|
+
import type { GivenInfo } from "./modelGivens";
|
|
10
|
+
import { Fact } from "./Facts";
|
|
11
|
+
|
|
12
|
+
/** What a "Given" pill's tooltip says: which givens the row reads. */
|
|
13
|
+
export function givenPillMeaning(givens: ReadonlyArray<GivenInfo>): string {
|
|
14
|
+
const names = givens.map((g) => g.name).join(", ");
|
|
15
|
+
return `Reads the ${givens.length === 1 ? "given" : "givens"} ${names}, set in the Givens section above`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The Declarations-layer pill on a field, view or query whose definition reads a
|
|
20
|
+
* given (`$NAME`): its result depends on a value the reader sets. Not a tab stop
|
|
21
|
+
* of its own — it sits inside the row's button, whose accessible name carries
|
|
22
|
+
* the word, and what it reads is in the row's opened card.
|
|
23
|
+
*/
|
|
24
|
+
export function GivenPill({ givens }: { givens: ReadonlyArray<GivenInfo> }) {
|
|
25
|
+
if (givens.length === 0) return null;
|
|
26
|
+
return (
|
|
27
|
+
<Tooltip title={givenPillMeaning(givens)}>
|
|
28
|
+
{/* A descriptor of the field, like its type: same voice and tone. */}
|
|
29
|
+
<StatusPill
|
|
30
|
+
voice="token"
|
|
31
|
+
tone="quiet"
|
|
32
|
+
sx={{ alignSelf: "center", flexShrink: 0 }}
|
|
33
|
+
>
|
|
34
|
+
given
|
|
35
|
+
</StatusPill>
|
|
36
|
+
</Tooltip>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** A given's default as a reader reads it, or that it has none. */
|
|
41
|
+
function defaultWords(g: GivenInfo): string {
|
|
42
|
+
const rendered = renderGivenDefault(g.type, g.default);
|
|
43
|
+
if (rendered === undefined) return "none — a value is required";
|
|
44
|
+
return rendered === "" ? "(empty)" : rendered;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The givens a row reads, in the card an open row's content takes: each one's
|
|
49
|
+
* name, type, default, and the label and description its declaration gives it.
|
|
50
|
+
*/
|
|
51
|
+
export function GivenFacts({
|
|
52
|
+
givens,
|
|
53
|
+
framed = true,
|
|
54
|
+
}: {
|
|
55
|
+
givens: ReadonlyArray<GivenInfo>;
|
|
56
|
+
/** False: one section of a card someone else frames (an open field row's). */
|
|
57
|
+
framed?: boolean;
|
|
58
|
+
}) {
|
|
59
|
+
if (givens.length === 0) return null;
|
|
60
|
+
return (
|
|
61
|
+
<Box
|
|
62
|
+
data-testid="model-viewer-given-card"
|
|
63
|
+
sx={{
|
|
64
|
+
...(framed ? PANE_CARD_SX : {}),
|
|
65
|
+
p: PANE_INSET,
|
|
66
|
+
display: "grid",
|
|
67
|
+
gridTemplateColumns: "max-content 1fr",
|
|
68
|
+
columnGap: "16px",
|
|
69
|
+
rowGap: "6px",
|
|
70
|
+
alignItems: "baseline",
|
|
71
|
+
fontFamily: SANS_FONT_FAMILY,
|
|
72
|
+
fontSize: fontSizes.small,
|
|
73
|
+
color: "text.primary",
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
{givens.map((g) => (
|
|
77
|
+
<Box key={g.name} sx={{ display: "contents" }}>
|
|
78
|
+
<Fact label="Given" value={g.name} mono />
|
|
79
|
+
{g.label && <Fact label="Label" value={g.label} />}
|
|
80
|
+
<Fact label="Type" value={g.type} mono />
|
|
81
|
+
<Fact label="Default" value={defaultWords(g)} />
|
|
82
|
+
{g.description && (
|
|
83
|
+
<Fact label="Description" value={g.description} />
|
|
84
|
+
)}
|
|
85
|
+
</Box>
|
|
86
|
+
))}
|
|
87
|
+
</Box>
|
|
88
|
+
);
|
|
89
|
+
}
|