@seclai/react 0.0.0-stage → 0.0.1

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.
@@ -0,0 +1,321 @@
1
+ /*
2
+ * Optional styles. Set any --seclai-* variable on :root or an ancestor to theme
3
+ * the components. The defaults have no specificity, so yours always win.
4
+ */
5
+ :where(:root, :host) {
6
+ --seclai-font: inherit;
7
+ --seclai-text: inherit;
8
+ --seclai-muted: color-mix(in srgb, currentColor 70%, transparent);
9
+ --seclai-border: color-mix(in srgb, currentColor 15%, transparent);
10
+ --seclai-field-border: color-mix(in srgb, currentColor 50%, transparent);
11
+ --seclai-surface: color-mix(in srgb, currentColor 5%, transparent);
12
+ --seclai-surface-hover: color-mix(in srgb, currentColor 10%, transparent);
13
+ --seclai-accent: light-dark(#581c87, #d8b4fe);
14
+ --seclai-accent-hover: light-dark(#4c1d95, #e9d8ff);
15
+ --seclai-on-accent: light-dark(#ffffff, #1e1b4b);
16
+ --seclai-focus: var(--seclai-accent);
17
+ --seclai-error: light-dark(#b42318, #fda29b);
18
+ --seclai-error-surface: color-mix(in srgb, var(--seclai-error) 10%, transparent);
19
+ --seclai-radius: 8px;
20
+ --seclai-gap: 16px;
21
+ --seclai-control-height: 40px;
22
+ }
23
+
24
+ .seclai-agent,
25
+ .seclai-agent *,
26
+ .seclai-agent *::before,
27
+ .seclai-agent *::after {
28
+ box-sizing: border-box;
29
+ }
30
+
31
+ .seclai-agent {
32
+ display: flex;
33
+ flex-direction: column;
34
+ gap: var(--seclai-gap);
35
+ font-family: var(--seclai-font);
36
+ color: var(--seclai-text);
37
+ line-height: 1.5;
38
+ }
39
+
40
+ .seclai-agent :focus-visible {
41
+ outline: 2px solid var(--seclai-focus);
42
+ outline-offset: 2px;
43
+ }
44
+
45
+ .seclai-form,
46
+ .seclai-field {
47
+ display: flex;
48
+ flex-direction: column;
49
+ gap: calc(var(--seclai-gap) / 2);
50
+ }
51
+
52
+ .seclai-form {
53
+ gap: var(--seclai-gap);
54
+ }
55
+
56
+ .seclai-field > span {
57
+ font-size: 0.875em;
58
+ font-weight: 500;
59
+ }
60
+
61
+ /* Fields */
62
+ .seclai-agent textarea,
63
+ .seclai-agent input[type="file"] {
64
+ width: 100%;
65
+ min-height: var(--seclai-control-height);
66
+ font: inherit;
67
+ color: inherit;
68
+ background: transparent;
69
+ border: 1px solid var(--seclai-field-border);
70
+ border-radius: var(--seclai-radius);
71
+ }
72
+
73
+ .seclai-agent textarea {
74
+ display: block;
75
+ padding: 8px 12px;
76
+ resize: vertical;
77
+ }
78
+
79
+ .seclai-agent textarea::placeholder {
80
+ color: var(--seclai-muted);
81
+ opacity: 1;
82
+ }
83
+
84
+ .seclai-agent input[type="file"] {
85
+ padding: 4px;
86
+ font-size: 0.875em;
87
+ cursor: pointer;
88
+ }
89
+
90
+ .seclai-agent input[type="file"]::file-selector-button {
91
+ min-height: 30px;
92
+ margin-inline-end: 12px;
93
+ padding: 0 12px;
94
+ font: inherit;
95
+ font-weight: 500;
96
+ color: var(--seclai-text);
97
+ cursor: pointer;
98
+ background: var(--seclai-surface);
99
+ border: 1px solid var(--seclai-border);
100
+ border-radius: calc(var(--seclai-radius) - 3px);
101
+ transition: background-color 120ms ease-out;
102
+ }
103
+
104
+ /* Inset, so the ring never collides with a neighbouring field. */
105
+ .seclai-agent textarea:focus-visible,
106
+ .seclai-agent input[type="file"]:focus-visible {
107
+ outline-offset: -2px;
108
+ }
109
+
110
+ /* Buttons */
111
+ .seclai-actions {
112
+ display: flex;
113
+ flex-wrap: wrap;
114
+ gap: calc(var(--seclai-gap) / 2);
115
+ }
116
+
117
+ .seclai-button {
118
+ position: relative;
119
+ display: inline-flex;
120
+ align-items: center;
121
+ justify-content: center;
122
+ min-height: var(--seclai-control-height);
123
+ padding: 0 16px;
124
+ font: inherit;
125
+ font-size: 0.875em;
126
+ font-weight: 500;
127
+ color: var(--seclai-text);
128
+ cursor: pointer;
129
+ background: transparent;
130
+ border: 1px solid var(--seclai-field-border);
131
+ border-radius: var(--seclai-radius);
132
+ transition:
133
+ background-color 120ms ease-out,
134
+ border-color 120ms ease-out,
135
+ transform 120ms ease-out;
136
+ }
137
+
138
+ /* Brings the 40px control up to a 44px hit target without changing its look. */
139
+ .seclai-button::before {
140
+ content: "";
141
+ position: absolute;
142
+ inset: -3px -1px;
143
+ }
144
+
145
+ .seclai-button:active:not(:disabled) {
146
+ transform: translateY(1px);
147
+ }
148
+
149
+ .seclai-button:disabled {
150
+ cursor: not-allowed;
151
+ opacity: 0.55;
152
+ }
153
+
154
+ .seclai-button-primary {
155
+ color: var(--seclai-on-accent);
156
+ background: var(--seclai-accent);
157
+ border-color: var(--seclai-accent);
158
+ }
159
+
160
+ @media (hover: hover) {
161
+ .seclai-button:hover:not(:disabled) {
162
+ background: var(--seclai-surface-hover);
163
+ }
164
+
165
+ .seclai-button-primary:hover:not(:disabled) {
166
+ background: var(--seclai-accent-hover);
167
+ border-color: var(--seclai-accent-hover);
168
+ }
169
+
170
+ .seclai-agent input[type="file"]:hover::file-selector-button {
171
+ background: var(--seclai-surface-hover);
172
+ }
173
+ }
174
+
175
+ @media (pointer: coarse) {
176
+ .seclai-agent {
177
+ --seclai-control-height: 44px;
178
+ }
179
+
180
+ /* Below 16px, iOS zooms the page when a field takes focus. */
181
+ .seclai-agent textarea {
182
+ font-size: 16px;
183
+ }
184
+ }
185
+
186
+ /* The run's progress */
187
+ .seclai-steps {
188
+ display: flex;
189
+ flex-direction: column;
190
+ gap: 4px;
191
+ margin: 0;
192
+ padding: 0 0 0 12px;
193
+ font-size: 0.875em;
194
+ list-style: none;
195
+ border-inline-start: 2px solid var(--seclai-border);
196
+ }
197
+
198
+ /* Earlier steps recede, so the latest one reads as the run's current state. */
199
+ .seclai-steps li:not(:last-child) {
200
+ color: var(--seclai-muted);
201
+ }
202
+
203
+ /* Output */
204
+ .seclai-output,
205
+ .seclai-turn {
206
+ display: flex;
207
+ flex-direction: column;
208
+ gap: calc(var(--seclai-gap) * 0.75);
209
+ }
210
+
211
+ .seclai-output {
212
+ padding: var(--seclai-gap);
213
+ background: var(--seclai-surface);
214
+ border-radius: var(--seclai-radius);
215
+ }
216
+
217
+ /* Chat */
218
+ .seclai-turns {
219
+ display: flex;
220
+ flex-direction: column;
221
+ gap: var(--seclai-gap);
222
+ margin: 0;
223
+ padding: 0;
224
+ list-style: none;
225
+ }
226
+
227
+ .seclai-turns:empty {
228
+ display: none;
229
+ }
230
+
231
+ .seclai-turn-user {
232
+ align-self: flex-end;
233
+ max-width: 80%;
234
+ padding: 8px 12px;
235
+ background: var(--seclai-surface-hover);
236
+ border-radius: var(--seclai-radius);
237
+ }
238
+
239
+ .seclai-markdown {
240
+ white-space: pre-wrap;
241
+ overflow-wrap: anywhere;
242
+ }
243
+
244
+ .seclai-media {
245
+ display: flex;
246
+ flex-direction: column;
247
+ gap: 8px;
248
+ margin: 0;
249
+ font-size: 0.875em;
250
+ }
251
+
252
+ .seclai-media img {
253
+ display: block;
254
+ /* A flex item stretches by default, which would blow up a small image. */
255
+ align-self: flex-start;
256
+ max-width: 100%;
257
+ height: auto;
258
+ border-radius: var(--seclai-radius);
259
+ }
260
+
261
+ .seclai-media a {
262
+ color: var(--seclai-accent);
263
+ text-underline-offset: 0.16em;
264
+ }
265
+
266
+ /* Messages */
267
+ .seclai-notice {
268
+ margin: 0;
269
+ font-size: 0.875em;
270
+ color: var(--seclai-muted);
271
+ }
272
+
273
+ .seclai-error {
274
+ margin: 0;
275
+ padding: 8px 12px;
276
+ font-size: 0.875em;
277
+ color: var(--seclai-error);
278
+ background: var(--seclai-error-surface);
279
+ border-radius: var(--seclai-radius);
280
+ }
281
+
282
+ /* Holds the form's shape while the agent's attachments load. */
283
+ .seclai-skeleton {
284
+ display: flex;
285
+ flex-direction: column;
286
+ gap: var(--seclai-gap);
287
+ }
288
+
289
+ .seclai-skeleton > span {
290
+ display: block;
291
+ height: 114px;
292
+ background: var(--seclai-surface-hover);
293
+ border-radius: var(--seclai-radius);
294
+ animation: seclai-pulse 1.6s ease-in-out infinite;
295
+ }
296
+
297
+ .seclai-skeleton > span:last-child {
298
+ width: 72px;
299
+ height: var(--seclai-control-height);
300
+ }
301
+
302
+ @keyframes seclai-pulse {
303
+ 50% {
304
+ opacity: 0.5;
305
+ }
306
+ }
307
+
308
+ @media (prefers-reduced-motion: reduce) {
309
+ .seclai-button,
310
+ .seclai-agent input[type="file"]::file-selector-button {
311
+ transition: none;
312
+ }
313
+
314
+ .seclai-button:active:not(:disabled) {
315
+ transform: none;
316
+ }
317
+
318
+ .seclai-skeleton > span {
319
+ animation: none;
320
+ }
321
+ }
package/package.json CHANGED
@@ -1,6 +1,60 @@
1
1
  {
2
2
  "name": "@seclai/react",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.1",
4
+ "description": "React components and hooks for running Seclai agents: run form, chat, and streaming output.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/index.cjs",
8
+ "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "import": {
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "require": {
17
+ "types": "./dist/index.d.cts",
18
+ "default": "./dist/index.cjs"
19
+ }
20
+ },
21
+ "./styles.css": "./dist/styles.css",
22
+ "./package.json": "./package.json"
23
+ },
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "sideEffects": [
28
+ "**/*.css"
29
+ ],
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/seclai/seclai-ui.git",
36
+ "directory": "packages/react"
37
+ },
38
+ "scripts": {
39
+ "build": "tsup",
40
+ "typecheck": "tsc --noEmit",
41
+ "test": "vitest run"
42
+ },
43
+ "peerDependencies": {
44
+ "react": ">=18",
45
+ "react-dom": ">=18"
46
+ },
47
+ "devDependencies": {
48
+ "@testing-library/dom": "^10.4.0",
49
+ "@testing-library/react": "^16.3.0",
50
+ "@testing-library/user-event": "^14.6.1",
51
+ "@types/react": "^19.0.0",
52
+ "@types/react-dom": "^19.0.0",
53
+ "jsdom": "^26.1.0",
54
+ "react": "^19.0.0",
55
+ "react-dom": "^19.0.0",
56
+ "tsup": "^8.5.0",
57
+ "typescript": "^5.9.3",
58
+ "vitest": "^3.2.4"
59
+ }
60
+ }