@astra-spec/ui 0.0.2 → 0.0.3

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 (38) hide show
  1. package/README.md +60 -2
  2. package/TOKENS.md +4 -0
  3. package/components.css +1 -0
  4. package/dist/components/index.d.ts +3 -1
  5. package/dist/components/index.d.ts.map +1 -1
  6. package/dist/components/index.js +2 -1
  7. package/dist/components/index.js.map +1 -1
  8. package/dist/components/record-preview.d.ts +61 -0
  9. package/dist/components/record-preview.d.ts.map +1 -0
  10. package/dist/components/record-preview.js +177 -0
  11. package/dist/components/record-preview.js.map +1 -0
  12. package/dist/lib/labels.d.ts +12 -0
  13. package/dist/lib/labels.d.ts.map +1 -1
  14. package/dist/lib/labels.js +12 -0
  15. package/dist/lib/labels.js.map +1 -1
  16. package/dist/primitives/index.d.ts +3 -1
  17. package/dist/primitives/index.d.ts.map +1 -1
  18. package/dist/primitives/index.js +1 -0
  19. package/dist/primitives/index.js.map +1 -1
  20. package/dist/primitives/preview-popover.d.ts +30 -0
  21. package/dist/primitives/preview-popover.d.ts.map +1 -0
  22. package/dist/primitives/preview-popover.js +132 -0
  23. package/dist/primitives/preview-popover.js.map +1 -0
  24. package/dist/primitives/prose.d.ts +7 -1
  25. package/dist/primitives/prose.d.ts.map +1 -1
  26. package/dist/primitives/prose.js +13 -5
  27. package/dist/primitives/prose.js.map +1 -1
  28. package/package.json +2 -1
  29. package/primitives.css +1 -0
  30. package/src/components/index.ts +11 -1
  31. package/src/components/record-preview.tsx +761 -0
  32. package/src/lib/labels.tsx +27 -0
  33. package/src/primitives/index.ts +14 -1
  34. package/src/primitives/preview-popover.tsx +278 -0
  35. package/src/primitives/prose.tsx +28 -5
  36. package/styles/components/record-preview.css +316 -0
  37. package/styles/primitives/preview-popover.css +76 -0
  38. package/styles/tokens.css +5 -0
@@ -0,0 +1,316 @@
1
+ /* record-preview — emitted by src/components/record-preview.tsx */
2
+ @layer astra.tokens, astra.base, astra.components, astra.views;
3
+
4
+ @layer astra.components {
5
+ :where(.astra-ui) .astra-record-preview {
6
+ overflow: hidden;
7
+ background: var(--astra-color-surface-muted);
8
+ color: var(--astra-color-text);
9
+ font-family: var(--astra-font-body);
10
+ font-size: 0.9375rem;
11
+ line-height: 1.5;
12
+ }
13
+
14
+ :where(.astra-ui) .astra-record-preview__header.astra-surface-header {
15
+ min-height: 0;
16
+ padding: 1.1875rem 1.25rem 0;
17
+ border: 0;
18
+ background: transparent;
19
+ }
20
+
21
+ :where(.astra-ui) .astra-record-preview__header .astra-surface-header__content {
22
+ gap: 0.35rem;
23
+ }
24
+
25
+ :where(.astra-ui) .astra-record-preview__header .astra-surface-header__eyebrow {
26
+ color: var(--astra-kind-ink, var(--astra-kind));
27
+ font: 500 0.625rem/1.2 var(--astra-font-ui);
28
+ letter-spacing: 0.08em;
29
+ }
30
+
31
+ :where(.astra-ui) .astra-record-preview__kind {
32
+ display: inline-flex;
33
+ align-items: center;
34
+ gap: 0.55em;
35
+ }
36
+
37
+ :where(.astra-ui) .astra-record-preview__header .astra-surface-header__title {
38
+ margin: 0;
39
+ color: var(--astra-color-text);
40
+ font: 600 1.25rem/1.25 var(--astra-font-ui);
41
+ letter-spacing: -0.01em;
42
+ }
43
+
44
+ :where(.astra-ui) .astra-record-preview__body {
45
+ padding: 0.4rem 1.25rem 1.1875rem;
46
+ }
47
+
48
+ :where(.astra-ui) .astra-record-preview__description {
49
+ margin: 0 0 0.75rem;
50
+ color: var(--astra-color-text-muted);
51
+ }
52
+
53
+ :where(.astra-ui) .astra-record-preview__claim {
54
+ margin: 0 0 0.6rem;
55
+ color: var(--astra-color-text);
56
+ font: 500 1.1875rem/1.35 var(--astra-font-ui);
57
+ }
58
+
59
+ :where(.astra-ui) .astra-record-preview__section > h4 {
60
+ margin: 0.9rem 0 0.4rem;
61
+ color: var(--astra-color-text-subtle);
62
+ font: 500 0.625rem/1.2 var(--astra-font-ui);
63
+ letter-spacing: 0.1em;
64
+ text-transform: uppercase;
65
+ }
66
+
67
+ :where(.astra-ui) .astra-record-preview__options,
68
+ :where(.astra-ui) .astra-record-preview__relations,
69
+ :where(.astra-ui) .astra-record-preview__evidence,
70
+ :where(.astra-ui) .astra-record-preview__flow {
71
+ display: flex;
72
+ margin: 0;
73
+ padding: 0;
74
+ flex-direction: column;
75
+ gap: 0.5rem;
76
+ list-style: none;
77
+ }
78
+
79
+ :where(.astra-ui) .astra-record-preview__options > li,
80
+ :where(.astra-ui) .astra-record-preview__relations > li,
81
+ :where(.astra-ui) .astra-record-preview__evidence > li {
82
+ border: 1px solid var(--astra-color-border);
83
+ border-radius: var(--astra-radius-preview);
84
+ background: color-mix(
85
+ in srgb,
86
+ var(--astra-color-text) 4%,
87
+ var(--astra-color-surface-muted)
88
+ );
89
+ }
90
+
91
+ :where(.astra-ui) .astra-record-preview__options > li {
92
+ display: grid;
93
+ grid-template-columns: auto minmax(0, 1fr);
94
+ align-items: baseline;
95
+ gap: 0.55rem;
96
+ padding: 0.45rem 0.65rem;
97
+ color: var(--astra-color-text-subtle);
98
+ }
99
+
100
+ :where(.astra-ui) .astra-record-preview__options > li strong {
101
+ color: var(--astra-color-text);
102
+ font-family: var(--astra-font-ui);
103
+ font-size: 1rem;
104
+ font-weight: 500;
105
+ }
106
+
107
+ :where(.astra-ui) .astra-record-preview__option-status {
108
+ position: absolute;
109
+ width: 1px;
110
+ height: 1px;
111
+ padding: 0;
112
+ margin: -1px;
113
+ overflow: hidden;
114
+ clip: rect(0, 0, 0, 0);
115
+ white-space: nowrap;
116
+ border: 0;
117
+ }
118
+
119
+ :where(.astra-ui) .astra-record-preview__options > li:where([data-selected]) {
120
+ border-color: var(--astra-kind);
121
+ background: var(--astra-kind-soft);
122
+ color: var(--astra-kind-ink, var(--astra-kind));
123
+ }
124
+
125
+ :where(.astra-ui) .astra-record-preview__options > li:where([data-unselected]) {
126
+ opacity: 0.76;
127
+ }
128
+
129
+ :where(.astra-ui) .astra-record-preview__options > li:where([data-excluded]) strong {
130
+ text-decoration: line-through;
131
+ text-decoration-color: var(--astra-color-border-strong);
132
+ }
133
+
134
+ :where(.astra-ui) .astra-record-preview__relations > li {
135
+ padding: 0.3rem 0.625rem;
136
+ }
137
+
138
+ :where(.astra-ui) .astra-record-preview__relation-trigger {
139
+ display: flex;
140
+ width: 100%;
141
+ min-width: 0;
142
+ align-items: baseline;
143
+ gap: 0.5em;
144
+ border: 0;
145
+ background: transparent;
146
+ color: var(--astra-color-text);
147
+ padding: 0;
148
+ text-align: start;
149
+ font: 500 0.8125rem/1.4 var(--astra-font-ui);
150
+ }
151
+
152
+ :where(.astra-ui) button.astra-record-preview__relation-trigger {
153
+ cursor: pointer;
154
+ }
155
+
156
+ :where(.astra-ui) button.astra-record-preview__relation-trigger:hover
157
+ .astra-record-preview__relation-label {
158
+ background: var(--astra-kind-soft);
159
+ text-decoration-color: currentcolor;
160
+ }
161
+
162
+ :where(.astra-ui) .astra-record-preview__relation-glyph {
163
+ flex: none;
164
+ color: var(--astra-kind-ink, var(--astra-kind));
165
+ }
166
+
167
+ :where(.astra-ui) button.astra-record-preview__relation-trigger
168
+ .astra-record-preview__relation-label {
169
+ color: var(--astra-color-link);
170
+ text-decoration: underline;
171
+ text-decoration-color: color-mix(in srgb, currentcolor 45%, transparent);
172
+ text-decoration-thickness: 1px;
173
+ text-underline-offset: 2px;
174
+ }
175
+
176
+ :where(.astra-ui) .astra-record-preview__relation-detail {
177
+ margin-inline-start: auto;
178
+ color: var(--astra-color-text-subtle);
179
+ font-weight: 400;
180
+ }
181
+
182
+ :where(.astra-ui) .astra-record-preview__remaining {
183
+ border: 0 !important;
184
+ background: transparent !important;
185
+ color: var(--astra-color-text-subtle);
186
+ font: 400 0.6875rem/1.4 var(--astra-font-ui);
187
+ }
188
+
189
+ :where(.astra-ui) .astra-record-preview__evidence > li {
190
+ padding: 0.5rem 0.75rem;
191
+ }
192
+
193
+ :where(.astra-ui) .astra-record-preview__artifact {
194
+ margin: 0.125rem 0 0.4rem;
195
+ overflow: hidden;
196
+ border: 1px solid var(--astra-color-border);
197
+ border-radius: var(--astra-radius-preview);
198
+ background: var(--astra-color-artifact-paper);
199
+ }
200
+
201
+ :where(.astra-ui) .astra-record-preview__artifact .astra-artifact {
202
+ margin: 0;
203
+ border: 0;
204
+ }
205
+
206
+ :where(.astra-ui) .astra-record-preview__quote {
207
+ margin: 0.35rem 0 0;
208
+ color: var(--astra-color-text-subtle);
209
+ font-size: 0.8125rem;
210
+ font-style: italic;
211
+ line-height: 1.45;
212
+ }
213
+
214
+ :where(.astra-ui) .astra-record-preview__quote::before {
215
+ content: "“";
216
+ }
217
+
218
+ :where(.astra-ui) .astra-record-preview__quote::after {
219
+ content: "”";
220
+ }
221
+
222
+ :where(.astra-ui) .astra-record-preview__citation {
223
+ margin-top: 0.3rem;
224
+ color: var(--astra-color-text-subtle);
225
+ font: 400 0.75rem/1.4 var(--astra-font-ui);
226
+ }
227
+
228
+ :where(.astra-ui) .astra-record-preview__citation a,
229
+ :where(.astra-ui) .astra-record-preview__analysis-link {
230
+ color: var(--astra-color-link);
231
+ text-decoration: underline;
232
+ text-underline-offset: 2px;
233
+ }
234
+
235
+ :where(.astra-ui) button.astra-record-preview__analysis-link {
236
+ margin: 0;
237
+ border: 0;
238
+ background: transparent;
239
+ padding: 0;
240
+ font: inherit;
241
+ cursor: pointer;
242
+ }
243
+
244
+ :where(.astra-ui) .astra-record-preview__scope {
245
+ display: inline-flex;
246
+ margin: 0 0 0.6rem;
247
+ border: 1px solid color-mix(in srgb, var(--astra-kind) 30%, transparent);
248
+ border-radius: 999px;
249
+ background: var(--astra-kind-soft);
250
+ color: var(--astra-kind-ink, var(--astra-kind));
251
+ padding: 0.1em 0.6em;
252
+ font: 400 0.6875rem/1.4 var(--astra-font-ui);
253
+ letter-spacing: 0.04em;
254
+ }
255
+
256
+ :where(.astra-ui) .astra-record-preview__flow {
257
+ flex-flow: row wrap;
258
+ align-items: center;
259
+ gap: 0;
260
+ }
261
+
262
+ :where(.astra-ui) .astra-record-preview__flow > li {
263
+ display: flex;
264
+ align-items: center;
265
+ }
266
+
267
+ :where(.astra-ui) .astra-record-preview__flow > li:not(:last-child)::after {
268
+ content: "→";
269
+ color: var(--astra-color-border-strong);
270
+ margin: 0 0.35rem;
271
+ }
272
+
273
+ :where(.astra-ui) .astra-record-preview__flow code,
274
+ :where(.astra-ui) .astra-record-preview__source,
275
+ :where(.astra-ui) .astra-record-preview__selection code {
276
+ border: 1px solid var(--astra-color-border);
277
+ border-radius: var(--astra-radius-preview);
278
+ background: color-mix(
279
+ in srgb,
280
+ var(--astra-color-text) 4%,
281
+ var(--astra-color-surface-muted)
282
+ );
283
+ color: var(--astra-color-text-muted);
284
+ padding: 0.2em 0.45em;
285
+ font-family: var(--astra-font-mono);
286
+ font-size: 0.6875rem;
287
+ overflow-wrap: anywhere;
288
+ }
289
+
290
+ :where(.astra-ui) .astra-record-preview__counts {
291
+ margin: 0;
292
+ color: var(--astra-color-text-subtle);
293
+ font: 400 0.75rem/1.4 var(--astra-font-ui);
294
+ }
295
+
296
+ :where(.astra-ui) .astra-record-preview__value {
297
+ font-variant-numeric: tabular-nums;
298
+ }
299
+
300
+ :where(.astra-ui) .astra-record-preview__unit {
301
+ margin-inline-start: 0.25em;
302
+ color: var(--astra-color-text-subtle);
303
+ font-size: 0.7em;
304
+ font-weight: 400;
305
+ }
306
+
307
+ :where(.astra-ui) .astra-record-preview__selection {
308
+ display: flex;
309
+ flex-wrap: wrap;
310
+ align-items: baseline;
311
+ gap: 0.5em;
312
+ margin: 0 0 0.6rem;
313
+ color: var(--astra-color-text-subtle);
314
+ font: 400 0.75rem/1.4 var(--astra-font-ui);
315
+ }
316
+ }
@@ -0,0 +1,76 @@
1
+ /* preview-popover — emitted by src/primitives/preview-popover.tsx */
2
+ @layer astra.tokens, astra.base, astra.components, astra.views;
3
+
4
+ @layer astra.components {
5
+ :where(.astra-ui).astra-preview-popover-portal,
6
+ :where(.astra-ui) .astra-preview-popover-portal {
7
+ display: contents;
8
+ }
9
+
10
+ :where(.astra-ui) .astra-preview-popover {
11
+ z-index: var(--astra-z-preview);
12
+ width: var(--astra-width-preview);
13
+ max-width: calc(100vw - 1rem);
14
+ color: var(--astra-color-text);
15
+ font-family: var(--astra-font-body);
16
+ font-size: var(--astra-font-size);
17
+ line-height: 1.5;
18
+ }
19
+
20
+ :where(.astra-ui) .astra-preview-popover__surface {
21
+ position: relative;
22
+ display: flex;
23
+ max-height: min(
24
+ var(--astra-preview-available-height, calc(100dvh - 1.5rem)),
25
+ calc(100dvh - 1.5rem)
26
+ );
27
+ flex-direction: column;
28
+ border: 1px solid var(--astra-color-border);
29
+ border-top-color: color-mix(
30
+ in srgb,
31
+ var(--astra-kind, var(--astra-color-border-strong)) 55%,
32
+ var(--astra-color-border)
33
+ );
34
+ border-radius: var(--astra-radius-preview);
35
+ background: var(--astra-color-surface-muted);
36
+ box-shadow: var(--astra-shadow-preview);
37
+ opacity: 1;
38
+ transform: scale(1);
39
+ transition:
40
+ opacity 120ms ease,
41
+ transform 120ms ease;
42
+ transform-origin: bottom center;
43
+ }
44
+
45
+ :where(.astra-ui) .astra-preview-popover:where([data-placement^="bottom"])
46
+ .astra-preview-popover__surface {
47
+ transform-origin: top center;
48
+ }
49
+
50
+ :where(.astra-ui) .astra-preview-popover:where([data-status="initial"], [data-status="close"])
51
+ .astra-preview-popover__surface {
52
+ opacity: 0;
53
+ transform: scale(0.98);
54
+ }
55
+
56
+ :where(.astra-ui) .astra-preview-popover__scroll {
57
+ min-height: 0;
58
+ overflow-y: auto;
59
+ overscroll-behavior: contain;
60
+ scrollbar-color: var(--astra-color-border-strong) transparent;
61
+ scrollbar-width: thin;
62
+ }
63
+
64
+ :where(.astra-ui) .astra-preview-popover__arrow {
65
+ fill: var(--astra-color-surface-muted);
66
+ stroke: var(--astra-color-border);
67
+ stroke-width: 1px;
68
+ }
69
+
70
+ @media (prefers-reduced-motion: reduce) {
71
+ :where(.astra-ui) .astra-preview-popover__surface {
72
+ transform: none !important;
73
+ transition-duration: 0.01ms !important;
74
+ }
75
+ }
76
+ }
package/styles/tokens.css CHANGED
@@ -73,10 +73,14 @@
73
73
 
74
74
  /* Geometry */
75
75
  --astra-radius-control: 0;
76
+ --astra-radius-preview: 0.1875rem;
76
77
  --astra-shadow-raised: none;
78
+ --astra-shadow-preview: 0 6px 18px rgb(34 31 32 / 0.1);
79
+ --astra-width-preview: 27.5rem;
77
80
  --astra-space-2: 0.5rem;
78
81
  --astra-space-3: 0.75rem;
79
82
  --astra-z-dialog: 1000;
83
+ --astra-z-preview: 1100;
80
84
  --astra-z-fullscreen: 10000;
81
85
  }
82
86
 
@@ -117,5 +121,6 @@
117
121
  --astra-color-kind-finding-soft: rgb(214 146 125 / 0.15);
118
122
  --astra-color-kind-insight-soft: rgb(194 181 169 / 0.15);
119
123
  --astra-shadow-raised: 0 5px 18px rgb(0 0 0 / 0.38);
124
+ --astra-shadow-preview: 0 6px 18px rgb(0 0 0 / 0.45);
120
125
  }
121
126
  }