@astra-spec/ui 0.0.6 → 0.0.7
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/insight-trigger.js +2 -2
- package/dist/components/insight-trigger.js.map +1 -1
- package/dist/components/paper-detail.d.ts.map +1 -1
- package/dist/components/paper-detail.js +11 -15
- package/dist/components/paper-detail.js.map +1 -1
- package/package.json +1 -1
- package/src/components/insight-trigger.tsx +2 -2
- package/src/components/paper-detail.tsx +52 -54
- package/styles/components/evidence.css +1 -18
- package/styles/components/insight-list.css +0 -4
- package/styles/components/insight-trigger.css +8 -6
- package/styles/components/paper-detail.css +112 -59
|
@@ -5,7 +5,7 @@ import { recordTitle } from '../model/records.js';
|
|
|
5
5
|
import { cn } from '../lib/cn.js';
|
|
6
6
|
import { Prose } from '../primitives/prose.js';
|
|
7
7
|
export function InsightEvidenceTitle({ name, tag }) {
|
|
8
|
-
return (_jsxs("span", { className: "astra-evidence__title", children: [_jsx(KindGlyph, {
|
|
8
|
+
return (_jsxs("span", { className: "astra-evidence__title", children: [_jsx(KindGlyph, { kind: "prior_insight" }), _jsx("span", { className: "astra-evidence__name", children: name }), tag ? _jsx("span", { className: "astra-evidence__tag", children: tag }) : null] }));
|
|
9
9
|
}
|
|
10
10
|
/** A clickable reference to an insight, as a title or as its claim. */
|
|
11
11
|
export const InsightTrigger = forwardRef(function InsightTrigger({ insight, onOpen, tag = 'prior insight', variant = 'title', renderText, className, onClick, onKeyDown, ...props }, ref) {
|
|
@@ -26,7 +26,7 @@ export const InsightTrigger = forwardRef(function InsightTrigger({ insight, onOp
|
|
|
26
26
|
if (variant === 'claim') {
|
|
27
27
|
// A div rather than a <button>: block prose inside a button would inherit
|
|
28
28
|
// UA control fonts and shift the layout.
|
|
29
|
-
return (_jsxs("div", { ...props, ref: ref, "data-slot": "insight-trigger", className: cn('astra-insight-trigger', className), "data-variant": "claim", role: "button", tabIndex: 0, "aria-label": props['aria-label'] ?? `Open insight details: ${title}`, onClick: open, onKeyDown: keyOpen, children: [_jsx(KindGlyph, { className: "astra-
|
|
29
|
+
return (_jsxs("div", { ...props, ref: ref, "data-slot": "insight-trigger", className: cn('astra-insight-trigger', className), "data-variant": "claim", role: "button", tabIndex: 0, "aria-label": props['aria-label'] ?? `Open insight details: ${title}`, onClick: open, onKeyDown: keyOpen, children: [_jsx(KindGlyph, { className: "astra-insight-trigger__glyph", kind: "prior_insight" }), _jsx("div", { className: "astra-insight-trigger__claim", children: _jsx(Prose, { text: insight.claim, field: "claim", renderText: renderText }) })] }));
|
|
30
30
|
}
|
|
31
31
|
return (_jsx("button", { ...props, ref: ref, type: "button", "data-slot": "insight-trigger", className: cn('astra-insight-trigger', className), "data-variant": "title", "aria-label": props['aria-label'] ?? `Open insight details: ${title}`, onClick: open, onKeyDown: onKeyDown, children: _jsx(InsightEvidenceTitle, { name: title, tag: tag ?? undefined }) }));
|
|
32
32
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insight-trigger.js","sourceRoot":"","sources":["../../src/components/insight-trigger.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,EACL,UAAU,GAMX,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAQ/C,MAAM,UAAU,oBAAoB,CAAC,EAAE,IAAI,EAAE,GAAG,EAA6B;IAC3E,OAAO,CACL,gBAAM,SAAS,EAAC,uBAAuB,aACrC,KAAC,SAAS,IAAC,
|
|
1
|
+
{"version":3,"file":"insight-trigger.js","sourceRoot":"","sources":["../../src/components/insight-trigger.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,EACL,UAAU,G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,CAAC,GAAG,SAAS,CAAC;CACrE;AAWD,uEAAuE;AACvE,eAAO,MAAM,WAAW,6GAgKtB,CAAC;AAEH,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC;IAC9J,eAAe,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;CACpD;AAED,6FAA6F;AAC7F,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,cAAc,CAAC;IACvB,eAAe,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;CACpD;AAED,wBAAgB,kBAAkB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,EAAE,uBAAuB,+BAgB7F;AAED,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EAAE,KAAK,EACb,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,SAAS,EACT,YAAY,EACZ,aAAa,EACb,cAAc,EACd,eAAe,EACf,GAAG,MAAM,EACV,EAAE,gBAAgB,+BAwBlB"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { KindGlyph } from '../primitives/kind-glyph.js';
|
|
3
|
-
import { forwardRef, useCallback, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { forwardRef, useCallback, useId, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { doiHref } from '../model/doi.js';
|
|
5
|
-
import {
|
|
5
|
+
import { recordTitle } from '../model/records.js';
|
|
6
6
|
import { decisionInsightPaths } from '../model/relations.js';
|
|
7
7
|
import { paperEvidence } from '../model/papers.js';
|
|
8
8
|
import { cn } from '../lib/cn.js';
|
|
9
9
|
import { useLabels } from '../lib/labels.js';
|
|
10
10
|
import { CountHeading } from '../primitives/detail-layout.js';
|
|
11
|
+
import { Prose } from '../primitives/prose.js';
|
|
11
12
|
import { DetailDialog, DialogAction } from '../primitives/dialog.js';
|
|
12
|
-
import { InsightTrigger } from './insight-trigger.js';
|
|
13
13
|
import { PaperPdfViewer } from './paper-pdf-viewer.js';
|
|
14
14
|
function passageFor(key, evidence) {
|
|
15
15
|
return { key, quote: evidence.quote?.exact, page: evidence.location?.page };
|
|
@@ -24,6 +24,7 @@ export const PaperDetail = forwardRef(function PaperDetail({ record: paper, meta
|
|
|
24
24
|
const [focusKey, setFocusKey] = useState(undefined);
|
|
25
25
|
const [override, setOverride] = useState(undefined);
|
|
26
26
|
const [decisionFilter, setDecisionFilter] = useState(undefined);
|
|
27
|
+
const pickerId = useId();
|
|
27
28
|
// Keyed by URL so a failure for one paper never outlives it inside a persistent dialog.
|
|
28
29
|
const [failedPdfUrl, setFailedPdfUrl] = useState(undefined);
|
|
29
30
|
const key = `${paper.doi}|${focusInsight?.canonicalPath ?? ''}`;
|
|
@@ -54,18 +55,13 @@ export const PaperDetail = forwardRef(function PaperDetail({ record: paper, meta
|
|
|
54
55
|
? (metadata.error ?? 'The paper could not be fetched.')
|
|
55
56
|
: 'No paper content is available from this host.' }), _jsx("button", { type: "button", disabled: fetching, onClick: () => { onFetchPaper(paper.doi); }, children: labels.actions.fetchPaper })] })) : (_jsx("p", { children: paper.pdfUrl
|
|
56
57
|
? labels.pdf.unavailable
|
|
57
|
-
: _jsxs(_Fragment, { children: ["Follow the ", _jsx("a", { href: doiHref(paper.doi), target: "_blank", rel: "noreferrer", children: "DOI" }), " for the published version."] }) })) })) }),
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return (_jsxs("li", { className: "astra-evidence__item astra-paper-insight", children: [_jsx(InsightTrigger, { insight: insight, variant: "claim", renderText: renderText, onOpen: () => onOpenInsight?.(insight) }), evidence.length ? (_jsxs("div", { className: "astra-paper-insight__sources", children: [_jsx("span", { children: countLabel(evidence.length, 'passage') }), paper.pdfUrl && loadPdfJs ? (_jsx("div", { children: evidence.map((source, index) => (
|
|
65
|
-
// Kept focusable after a load failure so keyboard focus never drops out of the dialog.
|
|
66
|
-
_jsxs("button", { type: "button", className: "astra-paper-insight__locate", "aria-disabled": canLocate ? undefined : true, onClick: () => { if (canLocate)
|
|
67
|
-
locate(insight, source); }, "aria-label": labels.pdf.locatePassage(index + 1), children: [labels.actions.locate, evidence.length > 1 ? ` ${index + 1}` : ''] }, `${insight.canonicalPath}-${index}`))) })) : null] })) : null] }, insight.canonicalPath));
|
|
68
|
-
}) })] })] })] }));
|
|
58
|
+
: _jsxs(_Fragment, { children: ["Follow the ", _jsx("a", { href: doiHref(paper.doi), target: "_blank", rel: "noreferrer", children: "DOI" }), " for the published version."] }) })) })) }), _jsx("aside", { className: "astra-paper-detail__rail", "aria-label": "Paper insights and decisions", children: _jsxs("section", { className: "astra-insight-list", children: [_jsxs("div", { className: "astra-paper-detail__rail-head", children: [_jsx(CountHeading, { title: "Insights from this paper", count: visibleInsights.length }), paper.decisions.length ? (_jsxs("div", { className: "astra-paper-decisions__picker", children: [_jsx("label", { className: "astra-paper-decisions__picker-label", htmlFor: pickerId, children: "Informs decision:" }), _jsxs("div", { className: "astra-paper-decisions__picker-row", children: [_jsx(KindGlyph, { kind: "decision" }), _jsxs("select", { id: pickerId, value: decisionFilter ?? '', onChange: (event) => { setDecisionFilter(event.target.value || undefined); }, children: [_jsx("option", { value: "", children: "Any decision" }), paper.decisions.map((decision) => (_jsx("option", { value: decision.canonicalPath, children: recordTitle(decision) }, decision.canonicalPath)))] }), filterDecision && onOpenDecision ? (_jsxs("button", { type: "button", className: "astra-paper-decisions__open", "aria-label": `Open decision: ${recordTitle(filterDecision)}`, onClick: () => { onOpenDecision(filterDecision); }, children: ["Open ", _jsx("span", { "aria-hidden": "true", children: "\u2192" })] })) : null] })] })) : null] }), _jsx("ul", { className: "astra-evidence astra-paper-detail__insights", children: visibleInsights.map((insight) => {
|
|
59
|
+
const evidence = paperEvidence(insight, paper.doi);
|
|
60
|
+
return (_jsxs("li", { className: "astra-evidence__item astra-paper-insight", children: [_jsx(KindGlyph, { className: "astra-paper-insight__glyph", kind: "prior_insight" }), _jsx("div", { className: "astra-paper-insight__claim", children: _jsx(Prose, { text: insight.claim, field: "claim", renderText: renderText }) }), evidence.length || onOpenInsight ? (_jsxs("div", { className: "astra-paper-insight__sources", children: [onOpenInsight ? (_jsxs("button", { type: "button", className: "astra-paper-insight__open", "aria-label": `Open insight details: ${recordTitle(insight)}`, onClick: () => { onOpenInsight(insight); }, children: [recordTitle(insight), " ", _jsx("span", { "aria-hidden": "true", children: "\u2192" })] })) : null, paper.pdfUrl && loadPdfJs ? (_jsx("div", { children: evidence.map((source, index) => (
|
|
61
|
+
// Kept focusable after a load failure so keyboard focus never drops out of the dialog.
|
|
62
|
+
_jsxs("button", { type: "button", className: "astra-paper-insight__locate", "aria-disabled": canLocate ? undefined : true, onClick: () => { if (canLocate)
|
|
63
|
+
locate(insight, source); }, "aria-label": labels.pdf.locatePassage(index + 1), children: [labels.actions.locate, evidence.length > 1 ? ` ${index + 1}` : ''] }, `${insight.canonicalPath}-${index}`))) })) : null] })) : null] }, insight.canonicalPath));
|
|
64
|
+
}) })] }) })] }));
|
|
69
65
|
});
|
|
70
66
|
export function PaperDialogActions({ record: paper, onOpenPaperFile }) {
|
|
71
67
|
const labels = useLabels();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paper-detail.js","sourceRoot":"","sources":["../../src/components/paper-detail.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAuB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"paper-detail.js","sourceRoot":"","sources":["../../src/components/paper-detail.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE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3B,OAAO,CACL,KAAC,YAAY,OACP,MAAM,EACV,IAAI,EAAC,OAAO,EACZ,MAAM,EAAC,QAAQ,EACf,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,EAC7B,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAClD,OAAO,EAAE,KAAC,kBAAkB,IAAC,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,GAAI,YAEhF,KAAC,WAAW,IACV,MAAM,EAAE,KAAK,EACb,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,GAC9B,GACW,CAChB,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@ export interface InsightEvidenceTitleProps {
|
|
|
21
21
|
export function InsightEvidenceTitle({ name, tag }: InsightEvidenceTitleProps) {
|
|
22
22
|
return (
|
|
23
23
|
<span className="astra-evidence__title">
|
|
24
|
-
<KindGlyph
|
|
24
|
+
<KindGlyph kind="prior_insight" />
|
|
25
25
|
<span className="astra-evidence__name">{name}</span>
|
|
26
26
|
{tag ? <span className="astra-evidence__tag">{tag}</span> : null}
|
|
27
27
|
</span>
|
|
@@ -79,7 +79,7 @@ export const InsightTrigger = forwardRef<HTMLElement, InsightTriggerProps>(funct
|
|
|
79
79
|
onClick={open}
|
|
80
80
|
onKeyDown={keyOpen}
|
|
81
81
|
>
|
|
82
|
-
<KindGlyph className="astra-
|
|
82
|
+
<KindGlyph className="astra-insight-trigger__glyph" kind="prior_insight" />
|
|
83
83
|
<div className="astra-insight-trigger__claim">
|
|
84
84
|
<Prose text={insight.claim} field="claim" renderText={renderText} />
|
|
85
85
|
</div>
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { KindGlyph } from '../primitives/kind-glyph.js';
|
|
2
2
|
import type { ResolvedDecision, ResolvedEvidence, ResolvedInsight } from '@astra-spec/sdk';
|
|
3
|
-
import { forwardRef, useCallback, useMemo, useRef, useState, type HTMLAttributes } from 'react';
|
|
3
|
+
import { forwardRef, useCallback, useId, useMemo, useRef, useState, type HTMLAttributes } from 'react';
|
|
4
4
|
import { doiHref } from '../model/doi.js';
|
|
5
|
-
import {
|
|
5
|
+
import { recordTitle } from '../model/records.js';
|
|
6
6
|
import { decisionInsightPaths } from '../model/relations.js';
|
|
7
7
|
import { paperEvidence, type InventoryPaper, type InventoryPaperMetadata } from '../model/papers.js';
|
|
8
8
|
import { cn } from '../lib/cn.js';
|
|
9
9
|
import { useLabels } from '../lib/labels.js';
|
|
10
10
|
import { CountHeading } from '../primitives/detail-layout.js';
|
|
11
|
+
import { Prose } from '../primitives/prose.js';
|
|
11
12
|
import { DetailDialog, DialogAction, type DetailDialogProps } from '../primitives/dialog.js';
|
|
12
13
|
import type { TextRenderer } from '../lib/prose.js';
|
|
13
|
-
import { InsightTrigger } from './insight-trigger.js';
|
|
14
14
|
import { PaperPdfViewer, type PdfPassage } from './paper-pdf-viewer.js';
|
|
15
15
|
import type { PdfJsLoader } from '../lib/pdf-runtime.js';
|
|
16
16
|
|
|
@@ -57,6 +57,7 @@ export const PaperDetail = forwardRef<HTMLDivElement, PaperDetailProps>(function
|
|
|
57
57
|
const [focusKey, setFocusKey] = useState<string | undefined>(undefined);
|
|
58
58
|
const [override, setOverride] = useState<PdfPassage | undefined>(undefined);
|
|
59
59
|
const [decisionFilter, setDecisionFilter] = useState<string | undefined>(undefined);
|
|
60
|
+
const pickerId = useId();
|
|
60
61
|
// Keyed by URL so a failure for one paper never outlives it inside a persistent dialog.
|
|
61
62
|
const [failedPdfUrl, setFailedPdfUrl] = useState<string | undefined>(undefined);
|
|
62
63
|
const key = `${paper.doi}|${focusInsight?.canonicalPath ?? ''}`;
|
|
@@ -118,64 +119,61 @@ export const PaperDetail = forwardRef<HTMLDivElement, PaperDetailProps>(function
|
|
|
118
119
|
)}
|
|
119
120
|
</div>
|
|
120
121
|
<aside className="astra-paper-detail__rail" aria-label="Paper insights and decisions">
|
|
121
|
-
<section className="astra-paper-decisions">
|
|
122
|
-
<CountHeading title="Informs decisions" count={paper.decisions.length} />
|
|
123
|
-
{paper.decisions.length ? (
|
|
124
|
-
<div
|
|
125
|
-
className="astra-paper-decisions__filters"
|
|
126
|
-
role="group"
|
|
127
|
-
aria-label="Filter insights by decision"
|
|
128
|
-
>
|
|
129
|
-
{paper.decisions.map((decision) => {
|
|
130
|
-
const active = decision.canonicalPath === decisionFilter;
|
|
131
|
-
return (
|
|
132
|
-
<button
|
|
133
|
-
key={decision.canonicalPath}
|
|
134
|
-
type="button"
|
|
135
|
-
className="astra-paper-decisions__filter"
|
|
136
|
-
aria-pressed={active}
|
|
137
|
-
onClick={() => {
|
|
138
|
-
setDecisionFilter(active ? undefined : decision.canonicalPath);
|
|
139
|
-
}}
|
|
140
|
-
>
|
|
141
|
-
<KindGlyph kind="decision" />
|
|
142
|
-
<span>{recordTitle(decision)}</span>
|
|
143
|
-
</button>
|
|
144
|
-
);
|
|
145
|
-
})}
|
|
146
|
-
</div>
|
|
147
|
-
) : (
|
|
148
|
-
<p className="astra-paper-decisions__empty">No decisions cite insights from this paper.</p>
|
|
149
|
-
)}
|
|
150
|
-
{filterDecision && onOpenDecision ? (
|
|
151
|
-
<button
|
|
152
|
-
type="button"
|
|
153
|
-
className="astra-paper-decisions__open"
|
|
154
|
-
onClick={() => { onOpenDecision(filterDecision); }}
|
|
155
|
-
>
|
|
156
|
-
Open {recordTitle(filterDecision)} →
|
|
157
|
-
</button>
|
|
158
|
-
) : null}
|
|
159
|
-
</section>
|
|
160
122
|
<section className="astra-insight-list">
|
|
161
|
-
<
|
|
162
|
-
title=
|
|
163
|
-
|
|
164
|
-
|
|
123
|
+
<div className="astra-paper-detail__rail-head">
|
|
124
|
+
<CountHeading title="Insights from this paper" count={visibleInsights.length} />
|
|
125
|
+
{paper.decisions.length ? (
|
|
126
|
+
<div className="astra-paper-decisions__picker">
|
|
127
|
+
<label className="astra-paper-decisions__picker-label" htmlFor={pickerId}>Informs decision:</label>
|
|
128
|
+
<div className="astra-paper-decisions__picker-row">
|
|
129
|
+
<KindGlyph kind="decision" />
|
|
130
|
+
<select
|
|
131
|
+
id={pickerId}
|
|
132
|
+
value={decisionFilter ?? ''}
|
|
133
|
+
onChange={(event) => { setDecisionFilter(event.target.value || undefined); }}
|
|
134
|
+
>
|
|
135
|
+
<option value="">Any decision</option>
|
|
136
|
+
{paper.decisions.map((decision) => (
|
|
137
|
+
<option key={decision.canonicalPath} value={decision.canonicalPath}>
|
|
138
|
+
{recordTitle(decision)}
|
|
139
|
+
</option>
|
|
140
|
+
))}
|
|
141
|
+
</select>
|
|
142
|
+
{filterDecision && onOpenDecision ? (
|
|
143
|
+
<button
|
|
144
|
+
type="button"
|
|
145
|
+
className="astra-paper-decisions__open"
|
|
146
|
+
aria-label={`Open decision: ${recordTitle(filterDecision)}`}
|
|
147
|
+
onClick={() => { onOpenDecision(filterDecision); }}
|
|
148
|
+
>
|
|
149
|
+
Open <span aria-hidden="true">→</span>
|
|
150
|
+
</button>
|
|
151
|
+
) : null}
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
) : null}
|
|
155
|
+
</div>
|
|
165
156
|
<ul className="astra-evidence astra-paper-detail__insights">
|
|
166
157
|
{visibleInsights.map((insight) => {
|
|
167
158
|
const evidence = paperEvidence(insight, paper.doi);
|
|
168
159
|
return (
|
|
169
160
|
<li key={insight.canonicalPath} className="astra-evidence__item astra-paper-insight">
|
|
170
|
-
<
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
/>
|
|
176
|
-
{evidence.length ? (
|
|
161
|
+
<KindGlyph className="astra-paper-insight__glyph" kind="prior_insight" />
|
|
162
|
+
<div className="astra-paper-insight__claim">
|
|
163
|
+
<Prose text={insight.claim} field="claim" renderText={renderText} />
|
|
164
|
+
</div>
|
|
165
|
+
{evidence.length || onOpenInsight ? (
|
|
177
166
|
<div className="astra-paper-insight__sources">
|
|
178
|
-
|
|
167
|
+
{onOpenInsight ? (
|
|
168
|
+
<button
|
|
169
|
+
type="button"
|
|
170
|
+
className="astra-paper-insight__open"
|
|
171
|
+
aria-label={`Open insight details: ${recordTitle(insight)}`}
|
|
172
|
+
onClick={() => { onOpenInsight(insight); }}
|
|
173
|
+
>
|
|
174
|
+
{recordTitle(insight)} <span aria-hidden="true">→</span>
|
|
175
|
+
</button>
|
|
176
|
+
) : null}
|
|
179
177
|
{paper.pdfUrl && loadPdfJs ? (
|
|
180
178
|
<div>
|
|
181
179
|
{evidence.map((source, index) => (
|
|
@@ -1,23 +1,6 @@
|
|
|
1
|
-
/* evidence — emitted by src/components/insight-trigger.tsx
|
|
1
|
+
/* evidence — emitted by src/components/insight-trigger.tsx */
|
|
2
2
|
@layer astra.tokens, astra.base, astra.components, astra.views;
|
|
3
3
|
@layer astra.components {
|
|
4
|
-
:where(.astra-ui) .astra-paper-detail__insights .astra-evidence__title {
|
|
5
|
-
display: grid;
|
|
6
|
-
grid-template-columns: auto minmax(0, 1fr);
|
|
7
|
-
align-items: start;
|
|
8
|
-
width: 100%;
|
|
9
|
-
min-width: 0;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
:where(.astra-ui) .astra-paper-detail__insights .astra-evidence__name {
|
|
13
|
-
min-width: 0;
|
|
14
|
-
overflow-wrap: anywhere;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
:where(.astra-ui) .astra-insight-trigger:where([data-variant="claim"]) .astra-evidence__glyph--insight {
|
|
18
|
-
margin-top: 3.52px;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
4
|
:where(.astra-ui) .astra-evidence {
|
|
22
5
|
list-style: none;
|
|
23
6
|
margin: 2.4px 0 0;
|
|
@@ -20,10 +20,17 @@
|
|
|
20
20
|
|
|
21
21
|
:where(.astra-ui) .astra-insight-trigger:where([data-variant="claim"]) {
|
|
22
22
|
display: grid;
|
|
23
|
-
grid-template-columns:
|
|
23
|
+
grid-template-columns: 22px minmax(0, 1fr);
|
|
24
24
|
gap: 8.8px;
|
|
25
25
|
align-items: start;
|
|
26
26
|
color: var(--astra-color-text-muted);
|
|
27
|
+
padding: 10px 4px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* On the claim's first line, not the padding box: the mark reads as part of
|
|
31
|
+
the sentence it stands for. */
|
|
32
|
+
:where(.astra-ui) .astra-insight-trigger__glyph {
|
|
33
|
+
margin-top: 3.52px;
|
|
27
34
|
}
|
|
28
35
|
|
|
29
36
|
:where(.astra-ui) .astra-insight-trigger:where([data-variant="claim"]):hover {
|
|
@@ -38,11 +45,6 @@
|
|
|
38
45
|
margin-bottom: 0;
|
|
39
46
|
}
|
|
40
47
|
|
|
41
|
-
:where(.astra-ui) .astra-insight-trigger:where([data-variant="claim"]) {
|
|
42
|
-
grid-template-columns: 22px minmax(0, 1fr);
|
|
43
|
-
padding: 10px 4px;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
48
|
:where(.astra-ui) .astra-insight-trigger__claim {
|
|
47
49
|
color: var(--astra-color-text);
|
|
48
50
|
font: 400 var(--astra-font-size)/1.4 var(--astra-font-ui);
|
|
@@ -47,11 +47,14 @@
|
|
|
47
47
|
font-size: var(--astra-font-size-xs);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/* Pushed right on its own, so the row needs no spacer element when the
|
|
51
|
+
insight has no name to open. */
|
|
50
52
|
:where(.astra-ui) .astra-paper-insight__sources > div {
|
|
51
53
|
display: flex;
|
|
52
54
|
flex-wrap: wrap;
|
|
53
55
|
gap: 4.48px;
|
|
54
56
|
justify-content: flex-end;
|
|
57
|
+
margin-inline-start: auto;
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
:where(.astra-ui) .astra-paper-insight__locate {
|
|
@@ -102,7 +105,7 @@
|
|
|
102
105
|
height: 100%;
|
|
103
106
|
max-height: none;
|
|
104
107
|
min-height: 0;
|
|
105
|
-
grid-template-columns: minmax(0, 1fr) clamp(
|
|
108
|
+
grid-template-columns: minmax(0, 1fr) clamp(320px, 29%, 380px);
|
|
106
109
|
overflow: hidden;
|
|
107
110
|
}
|
|
108
111
|
|
|
@@ -133,98 +136,148 @@
|
|
|
133
136
|
border: 0;
|
|
134
137
|
}
|
|
135
138
|
|
|
139
|
+
/* The mark leads the row, as it does wherever else a record is listed; the
|
|
140
|
+
claim and the actions under it share the column beside it. */
|
|
136
141
|
:where(.astra-ui) .astra-paper-detail__insights > .astra-paper-insight {
|
|
142
|
+
display: grid;
|
|
143
|
+
grid-template-columns: 22px minmax(0, 1fr);
|
|
144
|
+
gap: 0 8.8px;
|
|
145
|
+
align-items: start;
|
|
137
146
|
border: 0;
|
|
138
147
|
border-radius: 0;
|
|
139
148
|
background: transparent;
|
|
140
149
|
padding: 12px 6px;
|
|
141
150
|
}
|
|
142
151
|
|
|
143
|
-
|
|
144
|
-
|
|
152
|
+
/* Spans the row so one mark covers the whole insight, and sits on the
|
|
153
|
+
claim's first line rather than the padding box. */
|
|
154
|
+
:where(.astra-ui) .astra-paper-insight__glyph {
|
|
155
|
+
grid-row: 1 / -1;
|
|
156
|
+
margin-top: 3.52px;
|
|
145
157
|
}
|
|
146
158
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
grid-template-columns: auto minmax(0, 1fr);
|
|
151
|
-
gap: 6.4px;
|
|
152
|
-
padding: 0;
|
|
159
|
+
:where(.astra-ui) .astra-paper-insight__claim,
|
|
160
|
+
:where(.astra-ui) .astra-paper-insight__sources {
|
|
161
|
+
grid-column: 2;
|
|
153
162
|
}
|
|
154
163
|
|
|
155
|
-
|
|
156
|
-
:
|
|
157
|
-
|
|
158
|
-
height: auto;
|
|
159
|
-
overflow-y: auto;
|
|
160
|
-
}
|
|
164
|
+
:where(.astra-ui) .astra-paper-detail__insights > .astra-paper-insight + .astra-paper-insight {
|
|
165
|
+
border-top: 1px solid var(--astra-color-border);
|
|
166
|
+
}
|
|
161
167
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
168
|
+
/* The insights are the first thing in the rail now, so the gap that
|
|
169
|
+
separated them from the decisions above is a gap above nothing. */
|
|
170
|
+
:where(.astra-ui) .astra-paper-detail__rail .astra-insight-list {
|
|
171
|
+
margin-top: 0;
|
|
172
|
+
}
|
|
167
173
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
174
|
+
:where(.astra-ui) .astra-paper-detail__rail-head {
|
|
175
|
+
display: grid;
|
|
176
|
+
gap: 8px;
|
|
177
|
+
/* The same rule that divides one insight from the next, so the head reads
|
|
178
|
+
as the first band of the list rather than a separate block. */
|
|
179
|
+
padding-bottom: 12px;
|
|
180
|
+
border-bottom: 1px solid var(--astra-color-border);
|
|
181
|
+
}
|
|
171
182
|
|
|
183
|
+
:where(.astra-ui) .astra-paper-decisions__picker {
|
|
184
|
+
display: grid;
|
|
185
|
+
min-width: 0;
|
|
186
|
+
gap: 4px;
|
|
172
187
|
}
|
|
173
188
|
|
|
174
|
-
:where(.astra-ui) .astra-paper-
|
|
189
|
+
:where(.astra-ui) .astra-paper-decisions__picker-row {
|
|
175
190
|
display: flex;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
191
|
+
min-width: 0;
|
|
192
|
+
align-items: center;
|
|
193
|
+
gap: 8px;
|
|
179
194
|
}
|
|
180
195
|
|
|
181
|
-
:where(.astra-ui) .astra-paper-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
196
|
+
:where(.astra-ui) .astra-paper-decisions__open {
|
|
197
|
+
padding: 0;
|
|
198
|
+
border: 0;
|
|
199
|
+
background: none;
|
|
200
|
+
color: var(--astra-color-kind-decision);
|
|
185
201
|
cursor: pointer;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
202
|
+
font: 500 var(--astra-font-size-xs)/1.3 var(--astra-font-ui);
|
|
203
|
+
white-space: nowrap;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
:where(.astra-ui) .astra-paper-decisions__open:hover,
|
|
207
|
+
:where(.astra-ui) .astra-paper-decisions__open:focus-visible {
|
|
208
|
+
text-decoration: underline;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
:where(.astra-ui) .astra-paper-decisions__picker-label {
|
|
212
|
+
color: var(--astra-color-text-subtle);
|
|
213
|
+
font: 500 var(--astra-font-size-xs)/1.3 var(--astra-font-ui);
|
|
214
|
+
white-space: nowrap;
|
|
195
215
|
}
|
|
196
216
|
|
|
197
|
-
:where(.astra-ui) .astra-paper-
|
|
198
|
-
|
|
217
|
+
:where(.astra-ui) .astra-paper-decisions__picker-row select {
|
|
218
|
+
max-width: 100%;
|
|
219
|
+
min-width: 0;
|
|
220
|
+
flex: 0 1 auto;
|
|
221
|
+
padding: 2px 4px;
|
|
222
|
+
border: 1px solid var(--astra-color-border);
|
|
223
|
+
border-radius: var(--astra-radius-control);
|
|
224
|
+
background: var(--astra-color-surface-raised);
|
|
199
225
|
color: var(--astra-color-text);
|
|
226
|
+
font: 400 var(--astra-font-size-xs)/1.3 var(--astra-font-ui);
|
|
200
227
|
}
|
|
201
228
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
229
|
+
/* The claim is prose here, not a control: the insight's name opens it, so a
|
|
230
|
+
reader is not asked to click a paragraph. */
|
|
231
|
+
:where(.astra-ui) .astra-paper-insight__claim {
|
|
205
232
|
color: var(--astra-color-text);
|
|
233
|
+
font: 400 var(--astra-font-size-sm)/1.45 var(--astra-font-body);
|
|
206
234
|
}
|
|
207
235
|
|
|
208
|
-
:where(.astra-ui) .astra-paper-
|
|
209
|
-
margin:
|
|
210
|
-
color: var(--astra-color-text-subtle);
|
|
211
|
-
font-family: var(--astra-font-ui);
|
|
212
|
-
font-size: var(--astra-font-size-xs);
|
|
236
|
+
:where(.astra-ui) .astra-paper-insight__claim > :first-child {
|
|
237
|
+
margin-top: 0;
|
|
213
238
|
}
|
|
214
239
|
|
|
215
|
-
:where(.astra-ui) .astra-paper-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
240
|
+
:where(.astra-ui) .astra-paper-insight__claim > :last-child {
|
|
241
|
+
margin-bottom: 0;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
:where(.astra-ui) .astra-paper-insight__open {
|
|
245
|
+
display: inline-flex;
|
|
246
|
+
min-width: 0;
|
|
247
|
+
align-items: baseline;
|
|
248
|
+
gap: 4px;
|
|
221
249
|
padding: 0;
|
|
222
|
-
|
|
223
|
-
|
|
250
|
+
border: 0;
|
|
251
|
+
background: none;
|
|
252
|
+
color: var(--astra-color-kind-insight);
|
|
253
|
+
cursor: pointer;
|
|
254
|
+
font: 500 var(--astra-font-size-2xs)/1.3 var(--astra-font-mono);
|
|
255
|
+
text-align: start;
|
|
256
|
+
overflow-wrap: anywhere;
|
|
224
257
|
}
|
|
225
258
|
|
|
226
|
-
:where(.astra-ui) .astra-paper-
|
|
259
|
+
:where(.astra-ui) .astra-paper-insight__open:hover,
|
|
260
|
+
:where(.astra-ui) .astra-paper-insight__open:focus-visible {
|
|
227
261
|
text-decoration: underline;
|
|
228
262
|
}
|
|
229
263
|
|
|
264
|
+
@media (max-width: 760px) {
|
|
265
|
+
:where(.astra-ui) .astra-paper-detail__layout {
|
|
266
|
+
display: block;
|
|
267
|
+
height: auto;
|
|
268
|
+
overflow-y: auto;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
:where(.astra-ui) .astra-paper-detail__artifact {
|
|
272
|
+
height: 58dvh;
|
|
273
|
+
border-right: 0;
|
|
274
|
+
border-bottom: 1px solid var(--astra-color-border);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
:where(.astra-ui) .astra-paper-detail__rail {
|
|
278
|
+
overflow: visible;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
}
|
|
282
|
+
|
|
230
283
|
}
|