@astra-spec/ui 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/README.md +47 -4
  2. package/blocks.css +1 -0
  3. package/components.css +6 -0
  4. package/dist/blocks/analysis-tree.d.ts.map +1 -1
  5. package/dist/blocks/analysis-tree.js +4 -7
  6. package/dist/blocks/analysis-tree.js.map +1 -1
  7. package/dist/blocks/decisions-list.d.ts.map +1 -1
  8. package/dist/blocks/decisions-list.js +1 -1
  9. package/dist/blocks/decisions-list.js.map +1 -1
  10. package/dist/blocks/findings-list.d.ts.map +1 -1
  11. package/dist/blocks/findings-list.js +2 -4
  12. package/dist/blocks/findings-list.js.map +1 -1
  13. package/dist/blocks/index.d.ts +2 -4
  14. package/dist/blocks/index.d.ts.map +1 -1
  15. package/dist/blocks/index.js +1 -2
  16. package/dist/blocks/index.js.map +1 -1
  17. package/dist/blocks/outputs-list.d.ts +2 -7
  18. package/dist/blocks/outputs-list.d.ts.map +1 -1
  19. package/dist/blocks/outputs-list.js +11 -21
  20. package/dist/blocks/outputs-list.js.map +1 -1
  21. package/dist/blocks/papers-list.d.ts.map +1 -1
  22. package/dist/blocks/papers-list.js +3 -3
  23. package/dist/blocks/papers-list.js.map +1 -1
  24. package/dist/components/figure-zoom.d.ts +6 -0
  25. package/dist/components/figure-zoom.d.ts.map +1 -0
  26. package/dist/components/figure-zoom.js +28 -0
  27. package/dist/components/figure-zoom.js.map +1 -0
  28. package/dist/components/finding-detail.d.ts +4 -2
  29. package/dist/components/finding-detail.d.ts.map +1 -1
  30. package/dist/components/finding-detail.js +41 -25
  31. package/dist/components/finding-detail.js.map +1 -1
  32. package/dist/components/index.d.ts +9 -0
  33. package/dist/components/index.d.ts.map +1 -1
  34. package/dist/components/index.js +5 -0
  35. package/dist/components/index.js.map +1 -1
  36. package/dist/components/output-card.d.ts +13 -0
  37. package/dist/components/output-card.d.ts.map +1 -0
  38. package/dist/components/output-card.js +12 -0
  39. package/dist/components/output-card.js.map +1 -0
  40. package/dist/components/output-detail.d.ts +6 -2
  41. package/dist/components/output-detail.d.ts.map +1 -1
  42. package/dist/components/output-detail.js +49 -13
  43. package/dist/components/output-detail.js.map +1 -1
  44. package/dist/components/output-dialog.d.ts +6 -1
  45. package/dist/components/output-dialog.d.ts.map +1 -1
  46. package/dist/components/output-dialog.js +2 -2
  47. package/dist/components/output-dialog.js.map +1 -1
  48. package/dist/components/output-entry.d.ts +17 -0
  49. package/dist/components/output-entry.d.ts.map +1 -0
  50. package/dist/components/output-entry.js +21 -0
  51. package/dist/components/output-entry.js.map +1 -0
  52. package/dist/components/output-provenance.d.ts +6 -0
  53. package/dist/components/output-provenance.d.ts.map +1 -0
  54. package/dist/components/output-provenance.js +16 -0
  55. package/dist/components/output-provenance.js.map +1 -0
  56. package/dist/components/output-status.d.ts +8 -0
  57. package/dist/components/output-status.d.ts.map +1 -0
  58. package/dist/components/output-status.js +17 -0
  59. package/dist/components/output-status.js.map +1 -0
  60. package/dist/components/paper-row.d.ts +9 -0
  61. package/dist/components/paper-row.d.ts.map +1 -0
  62. package/dist/components/paper-row.js +11 -0
  63. package/dist/components/paper-row.js.map +1 -0
  64. package/dist/components/record-dialog.d.ts +5 -1
  65. package/dist/components/record-dialog.d.ts.map +1 -1
  66. package/dist/components/record-dialog.js +7 -4
  67. package/dist/components/record-dialog.js.map +1 -1
  68. package/dist/lib/labels.d.ts +34 -2
  69. package/dist/lib/labels.d.ts.map +1 -1
  70. package/dist/lib/labels.js +35 -4
  71. package/dist/lib/labels.js.map +1 -1
  72. package/dist/model/index.d.ts +4 -2
  73. package/dist/model/index.d.ts.map +1 -1
  74. package/dist/model/index.js +1 -1
  75. package/dist/model/index.js.map +1 -1
  76. package/dist/model/kind.d.ts +1 -1
  77. package/dist/model/kind.d.ts.map +1 -1
  78. package/dist/model/kind.js +0 -1
  79. package/dist/model/kind.js.map +1 -1
  80. package/dist/model/output-provenance.d.ts +17 -0
  81. package/dist/model/output-provenance.d.ts.map +1 -0
  82. package/dist/model/output-provenance.js +2 -0
  83. package/dist/model/output-provenance.js.map +1 -0
  84. package/dist/model/output-status.d.ts +17 -0
  85. package/dist/model/output-status.d.ts.map +1 -0
  86. package/dist/model/output-status.js +2 -0
  87. package/dist/model/output-status.js.map +1 -0
  88. package/dist/model/relations.d.ts +37 -12
  89. package/dist/model/relations.d.ts.map +1 -1
  90. package/dist/model/relations.js +76 -23
  91. package/dist/model/relations.js.map +1 -1
  92. package/dist/primitives/dialog.d.ts.map +1 -1
  93. package/dist/primitives/dialog.js +9 -1
  94. package/dist/primitives/dialog.js.map +1 -1
  95. package/dist/primitives/index.d.ts +2 -0
  96. package/dist/primitives/index.d.ts.map +1 -1
  97. package/dist/primitives/index.js +1 -0
  98. package/dist/primitives/index.js.map +1 -1
  99. package/dist/primitives/output-status-glyph.d.ts +8 -0
  100. package/dist/primitives/output-status-glyph.d.ts.map +1 -0
  101. package/dist/primitives/output-status-glyph.js +13 -0
  102. package/dist/primitives/output-status-glyph.js.map +1 -0
  103. package/dist/primitives/tooltip.d.ts +7 -0
  104. package/dist/primitives/tooltip.d.ts.map +1 -0
  105. package/dist/primitives/tooltip.js +31 -0
  106. package/dist/primitives/tooltip.js.map +1 -0
  107. package/dist/views/inventory.d.ts +12 -1
  108. package/dist/views/inventory.d.ts.map +1 -1
  109. package/dist/views/inventory.js +23 -17
  110. package/dist/views/inventory.js.map +1 -1
  111. package/package.json +3 -2
  112. package/primitives.css +1 -0
  113. package/src/blocks/analysis-tree.tsx +4 -30
  114. package/src/blocks/decisions-list.tsx +5 -3
  115. package/src/blocks/findings-list.tsx +8 -7
  116. package/src/blocks/index.ts +2 -4
  117. package/src/blocks/outputs-list.tsx +43 -106
  118. package/src/blocks/papers-list.tsx +2 -18
  119. package/src/components/figure-zoom.tsx +72 -0
  120. package/src/components/finding-detail.tsx +106 -30
  121. package/src/components/index.ts +13 -0
  122. package/src/components/output-card.tsx +51 -0
  123. package/src/components/output-detail.tsx +69 -21
  124. package/src/components/output-dialog.tsx +9 -0
  125. package/src/components/output-entry.tsx +61 -0
  126. package/src/components/output-provenance.tsx +86 -0
  127. package/src/components/output-status.tsx +38 -0
  128. package/src/components/paper-row.tsx +41 -0
  129. package/src/components/record-dialog.tsx +13 -1
  130. package/src/lib/labels.tsx +69 -6
  131. package/src/model/index.ts +6 -2
  132. package/src/model/kind.ts +1 -2
  133. package/src/model/output-provenance.ts +18 -0
  134. package/src/model/output-status.ts +18 -0
  135. package/src/model/relations.ts +92 -26
  136. package/src/primitives/dialog.tsx +7 -1
  137. package/src/primitives/index.ts +2 -0
  138. package/src/primitives/output-status-glyph.tsx +37 -0
  139. package/src/primitives/tooltip.tsx +51 -0
  140. package/src/views/inventory.tsx +54 -22
  141. package/styles/base.css +2 -1
  142. package/styles/blocks/analysis-tree.css +22 -25
  143. package/styles/blocks/findings-list.css +50 -0
  144. package/styles/blocks/outputs-list.css +0 -421
  145. package/styles/blocks/papers-list.css +4 -70
  146. package/styles/components/figure-zoom.css +62 -0
  147. package/styles/components/finding-detail.css +62 -0
  148. package/styles/components/output-card.css +290 -0
  149. package/styles/components/output-detail.css +91 -3
  150. package/styles/components/output-entry.css +141 -0
  151. package/styles/components/output-provenance.css +94 -0
  152. package/styles/components/output-status.css +31 -0
  153. package/styles/components/paper-row.css +72 -0
  154. package/styles/primitives/dialog.css +4 -22
  155. package/styles/primitives/tooltip.css +22 -0
  156. package/styles/views/inventory.css +35 -2
  157. package/dist/blocks/prior-insights-list.d.ts +0 -9
  158. package/dist/blocks/prior-insights-list.d.ts.map +0 -1
  159. package/dist/blocks/prior-insights-list.js +0 -29
  160. package/dist/blocks/prior-insights-list.js.map +0 -1
  161. package/src/blocks/prior-insights-list.tsx +0 -52
@@ -0,0 +1,72 @@
1
+ /* paper-row — emitted by src/components/paper-row.tsx */
2
+ @layer astra.tokens, astra.base, astra.components, astra.views;
3
+ @layer astra.components {
4
+ :where(.astra-ui) .astra-paper-row {
5
+ display: grid;
6
+ grid-template-columns: 58px minmax(0, 1fr) auto 46px;
7
+ align-items: stretch;
8
+ width: 100%;
9
+ min-height: 68px;
10
+ padding: 0;
11
+ border: 1px solid var(--astra-color-border);
12
+ background: var(--astra-color-surface-raised);
13
+ color: var(--astra-color-text);
14
+ cursor: pointer;
15
+ text-align: left;
16
+ }
17
+
18
+ :where(.astra-ui) .astra-paper-row:hover,
19
+ :where(.astra-ui) .astra-paper-row:focus-visible {
20
+ border-color: var(--astra-color-kind-output);
21
+ }
22
+
23
+ :where(.astra-ui) .astra-paper-row__thumbnail {
24
+ display: grid;
25
+ border-right: 1px solid var(--astra-color-border-subtle);
26
+ color: var(--astra-color-text-subtle);
27
+ background: repeating-linear-gradient(
28
+ 0deg,
29
+ color-mix(in srgb, var(--astra-color-canvas) 72%, var(--astra-color-surface-raised)) 0 6px,
30
+ var(--astra-color-canvas) 6px 12px
31
+ );
32
+ font: 400 var(--astra-font-size-2xs)/1 var(--astra-font-mono);
33
+ place-items: center;
34
+ }
35
+
36
+ :where(.astra-ui) .astra-paper-row__copy {
37
+ display: grid;
38
+ min-width: 0;
39
+ align-content: center;
40
+ gap: 3px;
41
+ padding: 11px 14px;
42
+ }
43
+
44
+ :where(.astra-ui) .astra-paper-row__copy strong {
45
+ overflow: hidden;
46
+ font: 600 var(--astra-font-size)/1.25 var(--astra-font-ui);
47
+ text-overflow: ellipsis;
48
+ white-space: nowrap;
49
+ }
50
+
51
+ :where(.astra-ui) .astra-paper-row__copy small,
52
+ :where(.astra-ui) .astra-paper-row__meta {
53
+ overflow: hidden;
54
+ color: var(--astra-color-text-subtle);
55
+ font: 400 11.5px/1.25 var(--astra-font-ui);
56
+ text-overflow: ellipsis;
57
+ white-space: nowrap;
58
+ }
59
+
60
+ :where(.astra-ui) .astra-paper-row__meta {
61
+ display: grid;
62
+ align-items: center;
63
+ padding-inline: 12px;
64
+ }
65
+
66
+ :where(.astra-ui) .astra-paper-row__arrow {
67
+ display: grid;
68
+ color: var(--astra-color-text-faint);
69
+ place-items: center;
70
+ }
71
+
72
+ }
@@ -97,12 +97,6 @@
97
97
  line-height: 1.2;
98
98
  }
99
99
 
100
- :where(.astra-ui) .astra-dialog:where([data-kind="paper"]) > .astra-dialog__panel {
101
- width: min(1472px, 100%);
102
- height: 100%;
103
- max-height: 100%;
104
- }
105
-
106
100
  :where(.astra-ui) .astra-dialog:where([data-kind="paper"]) {
107
101
  align-items: stretch;
108
102
  }
@@ -134,16 +128,6 @@
134
128
  padding: clamp(12px, 2vw, 24px);
135
129
  }
136
130
 
137
- :where(.astra-ui) .astra-dialog > .astra-dialog__panel {
138
- width: min(1184px, 100%);
139
- max-height: calc(100dvh - 32px);
140
- border-color: var(--astra-color-border-strong);
141
- border-radius: 0;
142
- background: var(--astra-color-canvas);
143
- box-shadow: none;
144
- font-family: var(--astra-font-body);
145
- }
146
-
147
131
  :where(.astra-ui) .astra-dialog__header {
148
132
  min-height: 88px;
149
133
  align-items: flex-end;
@@ -315,7 +299,7 @@
315
299
 
316
300
  :where(.astra-ui) .astra-dialog > .astra-dialog__panel {
317
301
  display: flex;
318
- width: min(720px, 100%);
302
+ width: min(800px, 100%);
319
303
  height: min(620px, calc(100dvh - 32px));
320
304
  max-height: calc(100dvh - 32px);
321
305
  flex-direction: column;
@@ -328,13 +312,11 @@
328
312
  font-family: var(--astra-font-body);
329
313
  }
330
314
 
315
+ /* The reader layout is the one with a sidebar — a paper beside its outline,
316
+ an artifact beside its details — and both want the same room for it. */
331
317
  :where(.astra-ui) .astra-dialog:where([data-layout="reader"]) > .astra-dialog__panel {
332
- width: min(1120px, 100%);
333
- height: min(700px, calc(100dvh - 32px));
334
- }
335
-
336
- :where(.astra-ui) .astra-dialog:where([data-layout="reader"][data-kind="output"]) > .astra-dialog__panel {
337
318
  width: min(1248px, 100%);
319
+ height: min(700px, calc(100dvh - 32px));
338
320
  }
339
321
 
340
322
  :where(.astra-ui) .astra-dialog:where([data-kind="input"]) > .astra-dialog__panel,
@@ -0,0 +1,22 @@
1
+ /* tooltip — emitted by src/primitives/tooltip.tsx */
2
+ @layer astra.tokens, astra.base, astra.components, astra.views;
3
+ @layer astra.components {
4
+ :where(.astra-ui) .astra-tooltip {
5
+ z-index: var(--astra-z-preview);
6
+ width: max-content;
7
+ max-width: min(280px, calc(100vw - 16px));
8
+ padding: 6px 9px;
9
+ border: 1px solid var(--astra-color-border);
10
+ border-radius: 5px;
11
+ background: var(--astra-color-surface-raised);
12
+ box-shadow: var(--astra-shadow-preview);
13
+ color: var(--astra-color-text);
14
+ font-family: var(--astra-font-body);
15
+ font-size: 12px;
16
+ font-weight: 400;
17
+ line-height: 1.4;
18
+ text-align: left;
19
+ overflow-wrap: anywhere;
20
+ }
21
+
22
+ }
@@ -67,11 +67,15 @@
67
67
 
68
68
  :where(.astra-ui) .astra-inventory__layout {
69
69
  display: grid;
70
- grid-template-columns: minmax(0, 1fr) 180px;
70
+ grid-template-columns: minmax(0, 1fr) 220px;
71
71
  gap: 48px;
72
72
  align-items: start;
73
73
  }
74
74
 
75
+ :where(.astra-ui) .astra-inventory__layout:where(:not([data-sidebar])) {
76
+ grid-template-columns: minmax(0, 1fr);
77
+ }
78
+
75
79
  :where(.astra-ui) .astra-inventory__sections {
76
80
  display: flex;
77
81
  min-width: 0;
@@ -124,6 +128,20 @@
124
128
  min-width: 0;
125
129
  }
126
130
 
131
+ :where(.astra-ui) .astra-inventory__sidebar {
132
+ position: sticky;
133
+ top: 72px;
134
+ display: grid;
135
+ gap: 28px;
136
+ min-width: 0;
137
+ max-height: calc(100vh - 88px);
138
+ overflow-y: auto;
139
+ }
140
+
141
+ :where(.astra-ui) .astra-inventory__sidebar .astra-inventory-outline {
142
+ position: static;
143
+ }
144
+
127
145
  :where(.astra-ui) .astra-inventory-outline h3 {
128
146
  margin: 0 0 8px;
129
147
  color: var(--astra-color-text-subtle);
@@ -165,7 +183,12 @@
165
183
  color: var(--astra-color-text);
166
184
  }
167
185
 
168
- @container (max-width: 992px) {
186
+ /* The sidebar scrolls, so a ring drawn outside a full-width link would be clipped. */
187
+ :where(.astra-ui) .astra-inventory__sidebar :is(a, button):focus-visible {
188
+ outline-offset: -2px;
189
+ }
190
+
191
+ @container (max-width: 760px) {
169
192
  :where(.astra-ui) .astra-inventory__layout {
170
193
  grid-template-columns: minmax(0, 1fr);
171
194
  }
@@ -174,6 +197,16 @@
174
197
  display: none;
175
198
  }
176
199
 
200
+ :where(.astra-ui) .astra-inventory__sidebar {
201
+ position: static;
202
+ grid-row: 1;
203
+ max-height: none;
204
+ }
205
+
206
+ :where(.astra-ui) .astra-inventory__sidebar:where(:not([data-has-tree])) {
207
+ display: none;
208
+ }
209
+
177
210
  }
178
211
  @container (max-width: 544px) {
179
212
  :where(.astra-ui) .astra-inventory__heading {
@@ -1,9 +0,0 @@
1
- import type { ResolvedAnalysisNode, ResolvedInsight } from '@astra-spec/sdk';
2
- import { type HTMLAttributes } from 'react';
3
- export interface PriorInsightsListProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
4
- analysis: ResolvedAnalysisNode;
5
- onOpenRecord: (insight: ResolvedInsight, analysis: ResolvedAnalysisNode) => void;
6
- }
7
- /** Prior insights with their claim and source count. */
8
- export declare const PriorInsightsList: import("react").ForwardRefExoticComponent<PriorInsightsListProps & import("react").RefAttributes<HTMLDivElement>>;
9
- //# sourceMappingURL=prior-insights-list.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prior-insights-list.d.ts","sourceRoot":"","sources":["../../src/blocks/prior-insights-list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAMxD,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IAC9F,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,YAAY,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,oBAAoB,KAAK,IAAI,CAAC;CAClF;AAED,wDAAwD;AACxD,eAAO,MAAM,iBAAiB,mHAsC5B,CAAC"}
@@ -1,29 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from 'react';
3
- import { countLabel, recordTitle } from '../model/records.js';
4
- import { useLabels } from '../lib/labels.js';
5
- import { EmptyState, RecordIdentity, RecordList } from '../primitives/record-list.js';
6
- import { InventoryRecords } from './section.js';
7
- /** Prior insights with their claim and source count. */
8
- export const PriorInsightsList = forwardRef(function PriorInsightsList({ analysis, onOpenRecord, className, ...props }, ref) {
9
- const labels = useLabels();
10
- const records = analysis.prior_insights;
11
- if (!records.length) {
12
- return _jsx(EmptyState, { "data-slot": "prior-insights-list", ...props, ref: ref, className: className, children: labels.empty.prior_insights });
13
- }
14
- return (_jsx(InventoryRecords, { ...props, ref: ref, kind: "prior_insight", className: className, children: _jsx(RecordList, { label: labels.sections.prior_insights, columnTemplate: "minmax(18rem, 1fr) 7rem 1.5rem", columns: [
15
- { label: 'Prior insight', className: 'astra-record-list__primary' },
16
- { label: 'Evidence', className: 'astra-record-list__count astra-record-list__secondary' },
17
- { className: 'astra-record-list__arrow' },
18
- ], rows: records.map((record) => ({
19
- key: record.canonicalPath,
20
- accessibleLabel: `${recordTitle(record)}: ${record.claim} ${countLabel(record.evidence.length, 'source')}`,
21
- onOpen: () => { onOpenRecord(record, analysis); },
22
- cells: [
23
- _jsx(RecordIdentity, { kind: "prior_insight", title: record.claim, subtitle: record.label ? record.id : undefined }),
24
- _jsx("span", { children: countLabel(record.evidence.length, 'source') }),
25
- _jsx("span", { "aria-hidden": "true", children: "\u2192" }),
26
- ],
27
- })) }) }));
28
- });
29
- //# sourceMappingURL=prior-insights-list.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prior-insights-list.js","sourceRoot":"","sources":["../../src/blocks/prior-insights-list.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAuB,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAOhD,wDAAwD;AACxD,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAyC,SAAS,iBAAiB,CAAC,EAC7G,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,GAAG,KAAK,EACT,EAAE,GAAG;IACJ,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,OAAO,GAAG,QAAQ,CAAC,cAAc,CAAC;IACxC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACpB,OAAO,KAAC,UAAU,iBAAW,qBAAqB,KAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,YAAG,MAAM,CAAC,KAAK,CAAC,cAAc,GAAc,CAAC;IAC3I,CAAC;IACD,OAAO,CACL,KAAC,gBAAgB,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAC,eAAe,EAAC,SAAS,EAAE,SAAS,YAC9E,KAAC,UAAU,IACT,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,cAAc,EACrC,cAAc,EAAC,gCAAgC,EAC/C,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,4BAA4B,EAAE;gBACnE,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,uDAAuD,EAAE;gBACzF,EAAE,SAAS,EAAE,0BAA0B,EAAE;aAC1C,EACD,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;gBAC7B,GAAG,EAAE,MAAM,CAAC,aAAa;gBACzB,eAAe,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC,KAAK,IAAI,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE;gBAC1G,MAAM,EAAE,GAAG,EAAE,GAAG,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;gBACjD,KAAK,EAAE;oBACL,KAAC,cAAc,IACb,IAAI,EAAC,eAAe,EACpB,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,GAC9C;oBACF,yBAAO,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAQ;oBAC3D,8BAAkB,MAAM,uBAAS;iBAClC;aACF,CAAC,CAAC,GACH,GACe,CACpB,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -1,52 +0,0 @@
1
- import type { ResolvedAnalysisNode, ResolvedInsight } from '@astra-spec/sdk';
2
- import { forwardRef, type HTMLAttributes } from 'react';
3
- import { countLabel, recordTitle } from '../model/records.js';
4
- import { useLabels } from '../lib/labels.js';
5
- import { EmptyState, RecordIdentity, RecordList } from '../primitives/record-list.js';
6
- import { InventoryRecords } from './section.js';
7
-
8
- export interface PriorInsightsListProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
9
- analysis: ResolvedAnalysisNode;
10
- onOpenRecord: (insight: ResolvedInsight, analysis: ResolvedAnalysisNode) => void;
11
- }
12
-
13
- /** Prior insights with their claim and source count. */
14
- export const PriorInsightsList = forwardRef<HTMLDivElement, PriorInsightsListProps>(function PriorInsightsList({
15
- analysis,
16
- onOpenRecord,
17
- className,
18
- ...props
19
- }, ref) {
20
- const labels = useLabels();
21
- const records = analysis.prior_insights;
22
- if (!records.length) {
23
- return <EmptyState data-slot="prior-insights-list" {...props} ref={ref} className={className}>{labels.empty.prior_insights}</EmptyState>;
24
- }
25
- return (
26
- <InventoryRecords {...props} ref={ref} kind="prior_insight" className={className}>
27
- <RecordList
28
- label={labels.sections.prior_insights}
29
- columnTemplate="minmax(18rem, 1fr) 7rem 1.5rem"
30
- columns={[
31
- { label: 'Prior insight', className: 'astra-record-list__primary' },
32
- { label: 'Evidence', className: 'astra-record-list__count astra-record-list__secondary' },
33
- { className: 'astra-record-list__arrow' },
34
- ]}
35
- rows={records.map((record) => ({
36
- key: record.canonicalPath,
37
- accessibleLabel: `${recordTitle(record)}: ${record.claim} ${countLabel(record.evidence.length, 'source')}`,
38
- onOpen: () => { onOpenRecord(record, analysis); },
39
- cells: [
40
- <RecordIdentity
41
- kind="prior_insight"
42
- title={record.claim}
43
- subtitle={record.label ? record.id : undefined}
44
- />,
45
- <span>{countLabel(record.evidence.length, 'source')}</span>,
46
- <span aria-hidden="true">→</span>,
47
- ],
48
- }))}
49
- />
50
- </InventoryRecords>
51
- );
52
- });