@spunto/design-system 0.51.0 → 0.53.0
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 +9 -0
- package/package.json +1 -1
- package/src/brand/logo.test.tsx +7 -1
- package/src/brand/logo.ts +15 -12
- package/src/brand/spunto-logo.tsx +7 -3
- package/src/colors.ts +11 -10
- package/src/components/devcontainer/stack-mark-paths.ts +3 -0
- package/src/components/devcontainer/stack-mark.test.ts +16 -0
- package/src/components/devcontainer/stack-mark.tsx +1 -0
- package/src/components/projects/advanced-sections.tsx +9 -41
- package/src/components/projects/form-nav.tsx +225 -0
- package/src/components/projects/form-section.tsx +5 -2
- package/src/components/projects/index.ts +8 -1
- package/src/components/projects/project-form-sidebar.test.tsx +47 -0
- package/src/components/projects/project-form.tsx +277 -14
- package/src/components/projects/section-status.ts +67 -0
- package/src/components/projects/types.ts +26 -0
- package/src/components/tasks/new-task-composer.tsx +27 -4
- package/src/components/tasks/new-task-dialog.tsx +6 -0
- package/src/components/tasks/tasks.test.tsx +14 -0
- package/styles.css +120 -52
package/README.md
CHANGED
|
@@ -362,6 +362,15 @@ Same rules as `/workers`: nothing fetches, types are structural and lax
|
|
|
362
362
|
secrets") instead of showing a bare chevron, and the form opens it by itself
|
|
363
363
|
when any of those sections already has a value — so editing a project never
|
|
364
364
|
hides a setting you made earlier.
|
|
365
|
+
- **Or a sidebar of pages** (`layout="sidebar"`, 0.52.0) — what the dashboard's
|
|
366
|
+
creation screen uses. A left rail of pages (`groups`, default `DEFAULT_GROUPS`:
|
|
367
|
+
General = identity + image + repos, then Tooling, Lifecycle, Runtime,
|
|
368
|
+
Secrets), one page shown at a time. Every entry says whether it holds
|
|
369
|
+
something required, **names what's missing**, and recaps what it already
|
|
370
|
+
holds; each section header carries a Required / Optional badge. The rail is
|
|
371
|
+
the recap, so `manifest` and `advancedSections` don't apply. Submitting with a
|
|
372
|
+
required section empty (`REQUIRED_SECTIONS`, or `required: true` on a custom
|
|
373
|
+
section) is refused and jumps to the page of the first one.
|
|
365
374
|
- **Git hosting is a list of providers, not GitHub** (0.21.0). `gitProviders`
|
|
366
375
|
(id, name, `connected`, `accounts`, `installUrl`, `operations`, `icon`) and
|
|
367
376
|
`gitRepos` (each tagged with its `provider`) replace `githubRepos` / `github` /
|
package/package.json
CHANGED
package/src/brand/logo.test.tsx
CHANGED
|
@@ -34,7 +34,13 @@ describe("SpuntoLogo", () => {
|
|
|
34
34
|
const svg = renderToStaticMarkup(<SpuntoLogo tone="flame" paint={{ tile: "#be241f" }} />)
|
|
35
35
|
expect(svg).toContain('fill="#be241f"')
|
|
36
36
|
expect(svg).not.toContain('fill="#ec5100"')
|
|
37
|
-
expect(svg).toContain('fill="#
|
|
37
|
+
expect(svg).toContain('fill="#281f45"')
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it("reads the product's tokens in the product tone", () => {
|
|
41
|
+
const svg = renderToStaticMarkup(<SpuntoLogo tone="product" />)
|
|
42
|
+
expect(svg).toContain('fill="var(--signal)"')
|
|
43
|
+
expect(svg.match(/fill="var\(--field\)"/g)).toHaveLength(spuntoLogoShapes("glyph").length)
|
|
38
44
|
})
|
|
39
45
|
|
|
40
46
|
it("is hidden from assistive tech unless it is given a name", () => {
|
package/src/brand/logo.ts
CHANGED
|
@@ -167,31 +167,34 @@ export interface SpuntoLogoPaint {
|
|
|
167
167
|
* for a hero or a social card, not for a 24 px header.
|
|
168
168
|
*/
|
|
169
169
|
export const SPUNTO_LOGO_TONES = {
|
|
170
|
-
/** The brand — Spunto Cloud: signal tile, field ink
|
|
171
|
-
*
|
|
172
|
-
|
|
170
|
+
/** The brand — Spunto Cloud: signal tile, field ink (amber on dusk violet
|
|
171
|
+
* since 2026-10-26, the pair it took over from Browser). The key keeps its
|
|
172
|
+
* old name so every `tone="flame"` caller follows. */
|
|
173
|
+
flame: { tile: "#fdcd5c", ink: "#281f45" },
|
|
174
|
+
/** Cloud's green until 2026-10-26 — `data-product="sprout"`. */
|
|
175
|
+
sprout: { tile: "#bfeb56", ink: "#0a3423" },
|
|
173
176
|
/** Spunto Lite — sky on ink blue. */
|
|
174
177
|
build: { tile: "#83dbff", ink: "#102743" },
|
|
175
|
-
/** Spunto Browser — amber on dusk. */
|
|
178
|
+
/** Spunto Browser — amber on dusk (Cloud's pair too since 2026-10-26). */
|
|
176
179
|
ship: { tile: "#fdcd5c", ink: "#281f45" },
|
|
177
180
|
/** Spunto Cloud's mid tone, light ink — for a light page that wants weight. */
|
|
178
|
-
run: { tile: "#
|
|
181
|
+
run: { tile: "#6646b7", ink: "#f5f4fc" },
|
|
179
182
|
/** The design system — graphite tile, paper ink. */
|
|
180
183
|
night: { tile: "#161c19", ink: "#edf4ee" },
|
|
181
184
|
/** Paper tile, field ink, the container lit in Cloud's tone — for a light print. */
|
|
182
|
-
cream: { tile: "#f8fbf6", ink: "#
|
|
185
|
+
cream: { tile: "#f8fbf6", ink: "#281f45", core: "#6646b7" },
|
|
183
186
|
/** Spunto CMS — petal on plum. */
|
|
184
187
|
cms: { tile: "#ffb3d7", ink: "#3d1a36" },
|
|
185
188
|
/** Spunto Search — aqua on deep teal. */
|
|
186
189
|
search: { tile: "#7ee9e5", ink: "#002f36" },
|
|
187
190
|
/** Cloud's field, the three pillars lit (night register). */
|
|
188
191
|
pillars: {
|
|
189
|
-
tile: "#
|
|
190
|
-
ink: "#
|
|
191
|
-
fleet: "#
|
|
192
|
-
build: "#
|
|
193
|
-
ship: "#
|
|
194
|
-
run: "#
|
|
192
|
+
tile: "#281f45",
|
|
193
|
+
ink: "#f5f4fc",
|
|
194
|
+
fleet: "#8f8ca0",
|
|
195
|
+
build: "#fdcd5c",
|
|
196
|
+
ship: "#fe8c64",
|
|
197
|
+
run: "#e66a84",
|
|
195
198
|
},
|
|
196
199
|
} as const satisfies Record<string, SpuntoLogoPaint>
|
|
197
200
|
|
|
@@ -23,7 +23,10 @@ import {
|
|
|
23
23
|
from the tokens (see `SPUNTO_LOGO_TONES`); `ink` is the odd one out: no
|
|
24
24
|
tile, and the drawing takes `currentColor`, so it follows the text colour
|
|
25
25
|
it sits in — the right choice for a header on a themed surface, where a
|
|
26
|
-
fixed flame tile would fight the page.
|
|
26
|
+
fixed flame tile would fight the page. `product` is the other live one:
|
|
27
|
+
the flame layout (signal tile, field ink) read from the tokens, so it wears
|
|
28
|
+
whatever `data-product` it sits under — the dashboard, where a member picks
|
|
29
|
+
their colour, uses it so the logo changes with everything else.
|
|
27
30
|
|
|
28
31
|
`paint` overrides any tone field by field. A product whose accent is not a
|
|
29
32
|
design-system token (the site's marketing `rust`, say) passes its own tile
|
|
@@ -32,7 +35,7 @@ import {
|
|
|
32
35
|
export interface SpuntoLogoProps extends Omit<SVGProps<SVGSVGElement>, "children" | "viewBox"> {
|
|
33
36
|
variant?: SpuntoLogoVariant
|
|
34
37
|
/** @default "flame" */
|
|
35
|
-
tone?: SpuntoLogoTone | "ink"
|
|
38
|
+
tone?: SpuntoLogoTone | "ink" | "product"
|
|
36
39
|
/** Per-role overrides on top of the tone. */
|
|
37
40
|
paint?: Partial<SpuntoLogoPaint>
|
|
38
41
|
/** Width and height, in px. Leave it out to size with `className`. */
|
|
@@ -55,6 +58,7 @@ export interface SpuntoLogoProps extends Omit<SVGProps<SVGSVGElement>, "children
|
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
const INK: SpuntoLogoPaint = { ink: "currentColor" }
|
|
61
|
+
const PRODUCT: SpuntoLogoPaint = { tile: "var(--signal)", ink: "var(--field)" }
|
|
58
62
|
|
|
59
63
|
type ShapeAttrs = Pick<SVGProps<SVGElement>, "className" | "style">
|
|
60
64
|
|
|
@@ -133,7 +137,7 @@ export function SpuntoLogo({
|
|
|
133
137
|
className,
|
|
134
138
|
...rest
|
|
135
139
|
}: SpuntoLogoProps) {
|
|
136
|
-
const base: SpuntoLogoPaint = tone === "ink" ? INK : SPUNTO_LOGO_TONES[tone]
|
|
140
|
+
const base: SpuntoLogoPaint = tone === "ink" ? INK : tone === "product" ? PRODUCT : SPUNTO_LOGO_TONES[tone]
|
|
137
141
|
const paint: SpuntoLogoPaint = { ...base, ...overrides }
|
|
138
142
|
const shapes = paint.tile ? [spuntoLogoTile(), ...spuntoLogoShapes(variant)] : spuntoLogoShapes(variant)
|
|
139
143
|
|
package/src/colors.ts
CHANGED
|
@@ -20,20 +20,21 @@ export const cssVar = {
|
|
|
20
20
|
run: "var(--run)",
|
|
21
21
|
} as const
|
|
22
22
|
|
|
23
|
-
/**
|
|
23
|
+
/** Line colors for time-series charts (recharts strokes, etc.). Token
|
|
24
|
+
* references, so they follow the product being worn and the theme. */
|
|
24
25
|
export const chartColors = {
|
|
25
|
-
cpu: "
|
|
26
|
-
memory: "
|
|
27
|
-
ship: "
|
|
26
|
+
cpu: "var(--run)",
|
|
27
|
+
memory: "var(--build)",
|
|
28
|
+
ship: "var(--ship)",
|
|
28
29
|
} as const
|
|
29
30
|
|
|
30
|
-
/** Sequential
|
|
31
|
+
/** Sequential ramp (the product's signal → its mid tone). Same as --chart-1..5. */
|
|
31
32
|
export const chartRamp = [
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
33
|
+
"var(--chart-1)",
|
|
34
|
+
"var(--chart-2)",
|
|
35
|
+
"var(--chart-3)",
|
|
36
|
+
"var(--chart-4)",
|
|
37
|
+
"var(--chart-5)",
|
|
37
38
|
] as const
|
|
38
39
|
|
|
39
40
|
/** Categorical, CVD-validated slots for disk/segment breakdowns. */
|
|
@@ -52,6 +52,9 @@ export const STACK_MARK_PATHS = {
|
|
|
52
52
|
"M13.88 12.685c-.4 0 .08.2.601.28.14-.1.27-.22.39-.33a3.001 3.001 0 01-.99.05m2.14-.53c.23-.33.4-.69.47-1.06-.06.27-.2.5-.33.73-.75.47-.07-.27 0-.56-.8 1.01-.11.6-.14.89m.781-2.05c.05-.721-.14-.501-.2-.221.07.04.13.5.2.22M12.38.31c.2.04.45.07.42.12.23-.05.28-.1-.43-.12m.43.12l-.15.03.14-.01V.43m6.633 9.944c.02.64-.2.95-.38 1.5l-.35.181c-.28.54.03.35-.17.78-.44.39-1.34 1.22-1.62 1.301-.201 0 .14-.25.19-.34-.591.4-.481.6-1.371.85l-.03-.06c-2.221 1.04-5.303-1.02-5.253-3.842-.03.17-.07.13-.12.2a3.551 3.552 0 012.001-3.501 3.361 3.362 0 013.732.48 3.341 3.342 0 00-2.721-1.3c-1.18.01-2.281.76-2.651 1.57-.6.38-.67 1.47-.93 1.661-.361 2.601.66 3.722 2.38 5.042.27.19.08.21.12.35a4.702 4.702 0 01-1.53-1.16c.23.33.47.66.8.91-.55-.18-1.27-1.3-1.48-1.35.93 1.66 3.78 2.921 5.261 2.3a6.203 6.203 0 01-2.33-.28c-.33-.16-.77-.51-.7-.57a5.802 5.803 0 005.902-.84c.44-.35.93-.94 1.07-.95-.2.32.04.16-.12.44.44-.72-.2-.3.46-1.24l.24.33c-.09-.6.74-1.321.66-2.262.19-.3.2.3 0 .97.29-.74.08-.85.15-1.46.08.2.18.42.23.63-.18-.7.2-1.2.28-1.6-.09-.05-.28.3-.32-.53 0-.37.1-.2.14-.28-.08-.05-.26-.32-.38-.861.08-.13.22.33.34.34-.08-.42-.2-.75-.2-1.08-.34-.68-.12.1-.4-.3-.34-1.091.3-.25.34-.74.54.77.84 1.96.981 2.46-.1-.6-.28-1.2-.49-1.76.16.07-.26-1.241.21-.37A7.823 7.824 0 0017.702 1.6c.18.17.42.39.33.42-.75-.45-.62-.48-.73-.67-.61-.25-.65.02-1.06 0C15.082.73 14.862.8 13.8.4l.05.23c-.77-.25-.9.1-1.73 0-.05-.04.27-.14.53-.18-.741.1-.701-.14-1.431.03.17-.13.36-.21.55-.32-.6.04-1.44.35-1.18.07C9.6.68 7.847 1.3 6.867 2.22L6.838 2c-.45.54-1.96 1.611-2.08 2.311l-.131.03c-.23.4-.38.85-.57 1.261-.3.52-.45.2-.4.28-.6 1.22-.9 2.251-1.16 3.102.18.27 0 1.65.07 2.76-.3 5.463 3.84 10.776 8.363 12.006.67.23 1.65.23 2.49.25-.99-.28-1.12-.15-2.08-.49-.7-.32-.85-.7-1.34-1.13l.2.35c-.971-.34-.57-.42-1.361-.67l.21-.27c-.31-.03-.83-.53-.97-.81l-.34.01c-.41-.501-.63-.871-.61-1.161l-.111.2c-.13-.21-1.52-1.901-.8-1.511-.13-.12-.31-.2-.5-.55l.14-.17c-.35-.44-.64-1.02-.62-1.2.2.24.32.3.45.33-.88-2.172-.93-.12-1.601-2.202l.15-.02c-.1-.16-.18-.34-.26-.51l.06-.6c-.63-.74-.18-3.102-.09-4.402.07-.54.53-1.1.88-1.981l-.21-.04c.4-.71 2.341-2.872 3.241-2.761.43-.55-.09 0-.18-.14.96-.991 1.26-.7 1.901-.88.7-.401-.6.16-.27-.151 1.2-.3.85-.7 2.421-.85.16.1-.39.14-.52.26 1-.49 3.151-.37 4.562.27 1.63.77 3.461 3.011 3.531 5.132l.08.02c-.04.85.13 1.821-.17 2.711l.2-.42M9.54 13.236l-.05.28c.26.35.47.73.8 1.01-.24-.47-.42-.66-.75-1.3m.62-.02c-.14-.15-.22-.34-.31-.52.08.32.26.6.43.88l-.12-.36m10.945-2.382l-.07.15c-.1.76-.34 1.511-.69 2.212.4-.73.65-1.541.75-2.362M12.45.12c.27-.1.66-.05.95-.12-.37.03-.74.05-1.1.1l.15.02M3.006 5.142c.07.57-.43.8.11.42.3-.66-.11-.18-.1-.42m-.64 2.661c.12-.39.15-.62.2-.84-.35.44-.17.53-.2.83",
|
|
53
53
|
bash:
|
|
54
54
|
"M21.038,4.9l-7.577-4.498C13.009,0.134,12.505,0,12,0c-0.505,0-1.009,0.134-1.462,0.403L2.961,4.9 C2.057,5.437,1.5,6.429,1.5,7.503v8.995c0,1.073,0.557,2.066,1.462,2.603l7.577,4.497C10.991,23.866,11.495,24,12,24 c0.505,0,1.009-0.134,1.461-0.402l7.577-4.497c0.904-0.537,1.462-1.529,1.462-2.603V7.503C22.5,6.429,21.943,5.437,21.038,4.9z M15.17,18.946l0.013,0.646c0.001,0.078-0.05,0.167-0.111,0.198l-0.383,0.22c-0.061,0.031-0.111-0.007-0.112-0.085L14.57,19.29 c-0.328,0.136-0.66,0.169-0.872,0.084c-0.04-0.016-0.057-0.075-0.041-0.142l0.139-0.584c0.011-0.046,0.036-0.092,0.069-0.121 c0.012-0.011,0.024-0.02,0.036-0.026c0.022-0.011,0.043-0.014,0.062-0.006c0.229,0.077,0.521,0.041,0.802-0.101 c0.357-0.181,0.596-0.545,0.592-0.907c-0.003-0.328-0.181-0.465-0.613-0.468c-0.55,0.001-1.064-0.107-1.072-0.917 c-0.007-0.667,0.34-1.361,0.889-1.8l-0.007-0.652c-0.001-0.08,0.048-0.168,0.111-0.2l0.37-0.236 c0.061-0.031,0.111,0.007,0.112,0.087l0.006,0.653c0.273-0.109,0.511-0.138,0.726-0.088c0.047,0.012,0.067,0.076,0.048,0.151 l-0.144,0.578c-0.011,0.044-0.036,0.088-0.065,0.116c-0.012,0.012-0.025,0.021-0.038,0.028c-0.019,0.01-0.038,0.013-0.057,0.009 c-0.098-0.022-0.332-0.073-0.699,0.113c-0.385,0.195-0.52,0.53-0.517,0.778c0.003,0.297,0.155,0.387,0.681,0.396 c0.7,0.012,1.003,0.318,1.01,1.023C16.105,17.747,15.736,18.491,15.17,18.946z M19.143,17.859c0,0.06-0.008,0.116-0.058,0.145 l-1.916,1.164c-0.05,0.029-0.09,0.004-0.09-0.056v-0.494c0-0.06,0.037-0.093,0.087-0.122l1.887-1.129 c0.05-0.029,0.09-0.004,0.09,0.056V17.859z M20.459,6.797l-7.168,4.427c-0.894,0.523-1.553,1.109-1.553,2.187v8.833 c0,0.645,0.26,1.063,0.66,1.184c-0.131,0.023-0.264,0.039-0.398,0.039c-0.42,0-0.833-0.114-1.197-0.33L3.226,18.64 c-0.741-0.44-1.201-1.261-1.201-2.142V7.503c0-0.881,0.46-1.702,1.201-2.142l7.577-4.498c0.363-0.216,0.777-0.33,1.197-0.33 c0.419,0,0.833,0.114,1.197,0.33l7.577,4.498c0.624,0.371,1.046,1.013,1.164,1.732C21.686,6.557,21.12,6.411,20.459,6.797z",
|
|
55
|
+
// simple-icons `openai` — the mark of the Codex agent app (RFC 0048).
|
|
56
|
+
openai:
|
|
57
|
+
"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",
|
|
55
58
|
claude:
|
|
56
59
|
"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",
|
|
57
60
|
} as const satisfies Record<string, string>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest"
|
|
2
|
+
import { STACK_MARK_PATHS, resolveStackMark } from "./stack-mark"
|
|
3
|
+
|
|
4
|
+
describe("resolveStackMark", () => {
|
|
5
|
+
it("gives each agent app its brand (RFC 0048)", () => {
|
|
6
|
+
expect(resolveStackMark("claude")).toBe("claude")
|
|
7
|
+
expect(resolveStackMark("codex")).toBe("openai")
|
|
8
|
+
expect(resolveStackMark("spunto-agent-codex")).toBe("openai")
|
|
9
|
+
expect(STACK_MARK_PATHS.openai.startsWith("M")).toBe(true)
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
it("keeps the more specific patterns first", () => {
|
|
13
|
+
expect(resolveStackMark("typescript-node-26")).toBe("typescript")
|
|
14
|
+
expect(resolveStackMark("unknown-thing")).toBeUndefined()
|
|
15
|
+
})
|
|
16
|
+
})
|
|
@@ -27,6 +27,7 @@ const PATTERNS: [RegExp, StackMarkName][] = [
|
|
|
27
27
|
[/google-?cloud|gcloud|(^|[^a-z])gcp([^a-z]|$)/, "googlecloud"],
|
|
28
28
|
[/github|(^|[^a-z])gh([^a-z]|$)/, "github"],
|
|
29
29
|
[/claude|anthropic/, "claude"],
|
|
30
|
+
[/openai|codex/, "openai"],
|
|
30
31
|
[/jekyll/, "jekyll"],
|
|
31
32
|
[/ruby|rails/, "ruby"],
|
|
32
33
|
[/rust|cargo/, "rust"],
|
|
@@ -5,12 +5,12 @@ import { ChevronDownIcon, Settings2Icon } from "lucide-react"
|
|
|
5
5
|
|
|
6
6
|
import { cn } from "../../utils"
|
|
7
7
|
import {
|
|
8
|
-
isInternalSectionId,
|
|
9
8
|
type ProjectFormCustomSection,
|
|
10
9
|
type ProjectFormSectionId,
|
|
11
10
|
type ProjectFormValue,
|
|
12
11
|
type ProjectSecretRef,
|
|
13
12
|
} from "./types"
|
|
13
|
+
import { sectionSummary } from "./section-status"
|
|
14
14
|
|
|
15
15
|
export interface AdvancedDisclosureProps {
|
|
16
16
|
open: boolean
|
|
@@ -124,44 +124,12 @@ export function advancedSummary<TValue extends ProjectFormValue>(
|
|
|
124
124
|
*/
|
|
125
125
|
customSections: ProjectFormCustomSection<TValue>[] = []
|
|
126
126
|
): string[] {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
if (
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
switch (id) {
|
|
137
|
-
case "features":
|
|
138
|
-
if (value.features.length) out.push(`${value.features.length} feature${value.features.length > 1 ? "s" : ""}`)
|
|
139
|
-
break
|
|
140
|
-
case "extensions":
|
|
141
|
-
if (value.vscodeExtensions.length)
|
|
142
|
-
out.push(`${value.vscodeExtensions.length} extension${value.vscodeExtensions.length > 1 ? "s" : ""}`)
|
|
143
|
-
break
|
|
144
|
-
case "lifecycle":
|
|
145
|
-
if (value.postCreateCommand || value.postStartCommand) out.push("lifecycle")
|
|
146
|
-
break
|
|
147
|
-
case "ports":
|
|
148
|
-
if (value.forwardPorts.length) out.push(`ports ${value.forwardPorts.join(", ")}`)
|
|
149
|
-
break
|
|
150
|
-
case "prewarm":
|
|
151
|
-
if (value.prewarmImages.length) out.push(`${value.prewarmImages.length} prewarm`)
|
|
152
|
-
break
|
|
153
|
-
case "docker":
|
|
154
|
-
if (value.dockerInDocker) out.push("docker-in-docker")
|
|
155
|
-
break
|
|
156
|
-
case "secrets": {
|
|
157
|
-
const n = value.secrets.length + savedSecrets.filter((x) => !value.removedSecretIds.includes(x.id)).length
|
|
158
|
-
if (n) out.push(`${n} secret${n > 1 ? "s" : ""}`)
|
|
159
|
-
break
|
|
160
|
-
}
|
|
161
|
-
// Identity, image and repositories are never advanced — they're the form.
|
|
162
|
-
default:
|
|
163
|
-
break
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
return out
|
|
127
|
+
return sections.flatMap((id) => {
|
|
128
|
+
// The three sections that *are* the form keep out of the fold's sentence
|
|
129
|
+
// even if a caller folds them: "my-project" isn't a setting you'd look for
|
|
130
|
+
// behind "Advanced options".
|
|
131
|
+
if (id === "identity" || id === "image" || id === "repositories") return []
|
|
132
|
+
const label = sectionSummary(value, id, savedSecrets, customSections)
|
|
133
|
+
return label ? [label] : []
|
|
134
|
+
})
|
|
167
135
|
}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import type { ComponentType, ReactNode } from "react"
|
|
4
|
+
import { AsteriskIcon, CheckIcon } from "lucide-react"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../utils"
|
|
7
|
+
|
|
8
|
+
/** One page of a sectioned form, as its nav entry sees it — counts, not values. */
|
|
9
|
+
export interface FormNavItem {
|
|
10
|
+
id: string
|
|
11
|
+
title: string
|
|
12
|
+
icon?: ComponentType<{ className?: string }>
|
|
13
|
+
/** Required sections on this page. */
|
|
14
|
+
required: number
|
|
15
|
+
/** Titles of the required sections still empty — named in the nav, not just counted. */
|
|
16
|
+
missing: string[]
|
|
17
|
+
/** One label per section that holds something (`my-project`, `2 features`). */
|
|
18
|
+
summary: string[]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface FormNavProps {
|
|
22
|
+
items: FormNavItem[]
|
|
23
|
+
active: string
|
|
24
|
+
onSelect: (id: string) => void
|
|
25
|
+
/** Turns "missing" from a reminder into an error — set once a submit was refused. */
|
|
26
|
+
showErrors?: boolean
|
|
27
|
+
/** Under the list: the submit block, typically. */
|
|
28
|
+
footer?: ReactNode
|
|
29
|
+
className?: string
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Where a page stands: something required is missing, something is set, or nothing yet. */
|
|
33
|
+
function itemState(item: FormNavItem): "missing" | "done" | "empty" {
|
|
34
|
+
if (item.missing.length) return "missing"
|
|
35
|
+
return item.summary.length || item.required ? "done" : "empty"
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The left rail of the `sidebar` layout: one entry per page of the form, each
|
|
40
|
+
* saying **whether it's required, what's missing, and what it already holds** —
|
|
41
|
+
* so the state of the whole form reads at a glance, without visiting a page.
|
|
42
|
+
*
|
|
43
|
+
* Three states, three marks, and a legend under the list that names them: a
|
|
44
|
+
* mark you have to guess the meaning of isn't an indicator.
|
|
45
|
+
*
|
|
46
|
+
* Below the container's `48rem`, the rail turns into a strip of pills over the
|
|
47
|
+
* content; the counts collapse into the mark alone.
|
|
48
|
+
*/
|
|
49
|
+
export function FormNav({ items, active, onSelect, showErrors = false, footer, className }: FormNavProps) {
|
|
50
|
+
const required = items.reduce((n, i) => n + i.required, 0)
|
|
51
|
+
const missing = items.reduce((n, i) => n + i.missing.length, 0)
|
|
52
|
+
const done = required - missing
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<nav data-slot="form-nav" aria-label="Form sections" className={cn("space-y-4", className)}>
|
|
56
|
+
{required > 0 && (
|
|
57
|
+
<div className="hidden space-y-2 @min-[48rem]/form:block">
|
|
58
|
+
<div className="flex items-baseline justify-between text-xs">
|
|
59
|
+
<span className="font-medium">Required</span>
|
|
60
|
+
<span className={cn("font-mono", missing ? "text-muted-foreground" : "text-success")}>
|
|
61
|
+
{done}/{required}
|
|
62
|
+
</span>
|
|
63
|
+
</div>
|
|
64
|
+
<div className="flex gap-1" aria-hidden>
|
|
65
|
+
{Array.from({ length: required }, (_, i) => (
|
|
66
|
+
<span
|
|
67
|
+
key={i}
|
|
68
|
+
className={cn("h-1 flex-1 rounded-full transition-colors", i < done ? "bg-success" : "bg-muted")}
|
|
69
|
+
/>
|
|
70
|
+
))}
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
)}
|
|
74
|
+
|
|
75
|
+
<ol
|
|
76
|
+
className={cn(
|
|
77
|
+
// A strip of pills on a narrow form, a list beside it once there's room.
|
|
78
|
+
"-mx-1 flex gap-1.5 overflow-x-auto px-1 pb-1",
|
|
79
|
+
"@min-[48rem]/form:mx-0 @min-[48rem]/form:flex-col @min-[48rem]/form:gap-1 @min-[48rem]/form:overflow-visible @min-[48rem]/form:px-0 @min-[48rem]/form:pb-0"
|
|
80
|
+
)}
|
|
81
|
+
>
|
|
82
|
+
{items.map((item) => {
|
|
83
|
+
const state = itemState(item)
|
|
84
|
+
const current = item.id === active
|
|
85
|
+
const Icon = item.icon
|
|
86
|
+
return (
|
|
87
|
+
<li key={item.id} className="shrink-0">
|
|
88
|
+
<button
|
|
89
|
+
type="button"
|
|
90
|
+
onClick={() => onSelect(item.id)}
|
|
91
|
+
aria-current={current ? "step" : undefined}
|
|
92
|
+
data-state={state}
|
|
93
|
+
className={cn(
|
|
94
|
+
"group relative flex w-full cursor-pointer items-center gap-2.5 rounded-lg border px-3 py-2 text-left transition-colors",
|
|
95
|
+
"@min-[48rem]/form:items-start @min-[48rem]/form:py-2.5",
|
|
96
|
+
current
|
|
97
|
+
? "border-border bg-card shadow-sm"
|
|
98
|
+
: "border-transparent hover:bg-muted/60"
|
|
99
|
+
)}
|
|
100
|
+
>
|
|
101
|
+
{current && (
|
|
102
|
+
<span
|
|
103
|
+
aria-hidden
|
|
104
|
+
className="absolute inset-y-2 left-0 hidden w-0.5 rounded-full bg-primary @min-[48rem]/form:block"
|
|
105
|
+
/>
|
|
106
|
+
)}
|
|
107
|
+
{Icon && (
|
|
108
|
+
<Icon
|
|
109
|
+
className={cn(
|
|
110
|
+
"h-4 w-4 shrink-0 @min-[48rem]/form:mt-0.5",
|
|
111
|
+
current ? "text-primary" : "text-muted-foreground"
|
|
112
|
+
)}
|
|
113
|
+
/>
|
|
114
|
+
)}
|
|
115
|
+
<span className="min-w-0 flex-1">
|
|
116
|
+
<span className="flex items-center gap-1.5 text-sm font-medium whitespace-nowrap">
|
|
117
|
+
{item.title}
|
|
118
|
+
{item.required > 0 && (
|
|
119
|
+
<span className="hidden font-mono text-[10px] font-normal text-muted-foreground @min-[48rem]/form:inline">
|
|
120
|
+
required
|
|
121
|
+
</span>
|
|
122
|
+
)}
|
|
123
|
+
</span>
|
|
124
|
+
<span
|
|
125
|
+
className={cn(
|
|
126
|
+
"mt-0.5 hidden truncate text-xs @min-[48rem]/form:block",
|
|
127
|
+
state === "missing"
|
|
128
|
+
? showErrors
|
|
129
|
+
? "text-destructive"
|
|
130
|
+
: "text-warning"
|
|
131
|
+
: "text-muted-foreground"
|
|
132
|
+
)}
|
|
133
|
+
>
|
|
134
|
+
{state === "missing"
|
|
135
|
+
? `Missing: ${item.missing.join(", ").toLowerCase()}`
|
|
136
|
+
: item.summary.length
|
|
137
|
+
? item.summary.join(" · ")
|
|
138
|
+
: "Optional · nothing set"}
|
|
139
|
+
</span>
|
|
140
|
+
</span>
|
|
141
|
+
<StateMark state={state} error={showErrors} />
|
|
142
|
+
</button>
|
|
143
|
+
</li>
|
|
144
|
+
)
|
|
145
|
+
})}
|
|
146
|
+
</ol>
|
|
147
|
+
|
|
148
|
+
<ul className="hidden space-y-1 border-t pt-3 text-[11px] text-muted-foreground @min-[48rem]/form:block">
|
|
149
|
+
<li className="flex items-center gap-2">
|
|
150
|
+
<StateMark state="missing" /> Required, still to fill
|
|
151
|
+
</li>
|
|
152
|
+
<li className="flex items-center gap-2">
|
|
153
|
+
<StateMark state="done" /> Filled in
|
|
154
|
+
</li>
|
|
155
|
+
<li className="flex items-center gap-2">
|
|
156
|
+
<StateMark state="empty" /> Optional, nothing set
|
|
157
|
+
</li>
|
|
158
|
+
</ul>
|
|
159
|
+
|
|
160
|
+
{footer}
|
|
161
|
+
</nav>
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** The little round mark at the end of a nav entry (and in the legend). */
|
|
166
|
+
function StateMark({ state, error = false }: { state: "missing" | "done" | "empty"; error?: boolean }) {
|
|
167
|
+
return (
|
|
168
|
+
<span
|
|
169
|
+
aria-hidden
|
|
170
|
+
className={cn(
|
|
171
|
+
"flex h-4 w-4 shrink-0 items-center justify-center rounded-full border transition-colors @min-[48rem]/form:mt-0.5",
|
|
172
|
+
state === "done" && "border-success bg-success text-background",
|
|
173
|
+
state === "missing" &&
|
|
174
|
+
(error ? "border-destructive bg-destructive/10 text-destructive" : "border-warning bg-warning/10 text-warning"),
|
|
175
|
+
state === "empty" && "border-dashed border-muted-foreground/40"
|
|
176
|
+
)}
|
|
177
|
+
>
|
|
178
|
+
{state === "done" && <CheckIcon className="h-2.5 w-2.5" strokeWidth={3} />}
|
|
179
|
+
{state === "missing" && <AsteriskIcon className="h-2.5 w-2.5" strokeWidth={3} />}
|
|
180
|
+
</span>
|
|
181
|
+
)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* The badge in a section's header: Required / Optional, and whether it's set.
|
|
186
|
+
* Same words as the nav, so the two never disagree about a section.
|
|
187
|
+
*/
|
|
188
|
+
export function SectionStatusBadge({
|
|
189
|
+
required,
|
|
190
|
+
filled,
|
|
191
|
+
error = false,
|
|
192
|
+
}: {
|
|
193
|
+
required: boolean
|
|
194
|
+
filled: boolean
|
|
195
|
+
/** A submit was refused: an empty required section turns red instead of amber. */
|
|
196
|
+
error?: boolean
|
|
197
|
+
}) {
|
|
198
|
+
const base = "inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] leading-none font-medium"
|
|
199
|
+
if (filled)
|
|
200
|
+
return (
|
|
201
|
+
<span data-slot="section-status" data-state="done" className={cn(base, "border-success/30 bg-success/10 text-success")}>
|
|
202
|
+
<CheckIcon className="h-3 w-3" strokeWidth={3} />
|
|
203
|
+
{required ? "Required · done" : "Set"}
|
|
204
|
+
</span>
|
|
205
|
+
)
|
|
206
|
+
if (required)
|
|
207
|
+
return (
|
|
208
|
+
<span
|
|
209
|
+
data-slot="section-status"
|
|
210
|
+
data-state="missing"
|
|
211
|
+
className={cn(
|
|
212
|
+
base,
|
|
213
|
+
error ? "border-destructive/40 bg-destructive/10 text-destructive" : "border-warning/40 bg-warning/10 text-warning"
|
|
214
|
+
)}
|
|
215
|
+
>
|
|
216
|
+
<AsteriskIcon className="h-3 w-3" strokeWidth={3} />
|
|
217
|
+
Required
|
|
218
|
+
</span>
|
|
219
|
+
)
|
|
220
|
+
return (
|
|
221
|
+
<span data-slot="section-status" data-state="empty" className={cn(base, "border-dashed text-muted-foreground")}>
|
|
222
|
+
Optional
|
|
223
|
+
</span>
|
|
224
|
+
)
|
|
225
|
+
}
|
|
@@ -13,6 +13,8 @@ export interface FormSectionProps {
|
|
|
13
13
|
accent?: SectionAccent
|
|
14
14
|
title: string
|
|
15
15
|
hint?: string
|
|
16
|
+
/** Right side of the header — a "Required" / "Optional" badge, typically. */
|
|
17
|
+
status?: ReactNode
|
|
16
18
|
children: ReactNode
|
|
17
19
|
/** Mostly for the entrance `animationDelay` a stack of sections staggers with. */
|
|
18
20
|
style?: React.CSSProperties
|
|
@@ -31,7 +33,7 @@ export interface FormSectionProps {
|
|
|
31
33
|
* for one fade-in, and `motion-reduce:animate-none` covers the accessibility
|
|
32
34
|
* side that `useReducedMotion` covered before.
|
|
33
35
|
*/
|
|
34
|
-
export function FormSection({ n, icon: Icon, accent = "build", title, hint, children, style, className }: FormSectionProps) {
|
|
36
|
+
export function FormSection({ n, icon: Icon, accent = "build", title, hint, status, children, style, className }: FormSectionProps) {
|
|
35
37
|
return (
|
|
36
38
|
<section
|
|
37
39
|
data-slot="form-section"
|
|
@@ -54,13 +56,14 @@ export function FormSection({ n, icon: Icon, accent = "build", title, hint, chil
|
|
|
54
56
|
{n}
|
|
55
57
|
</span>
|
|
56
58
|
)}
|
|
57
|
-
<div className="min-w-0">
|
|
59
|
+
<div className="min-w-0 flex-1">
|
|
58
60
|
<h3 className="flex items-center gap-2 font-display text-base font-bold tracking-tight">
|
|
59
61
|
{Icon && <Icon className="h-4 w-4 shrink-0 text-[var(--a)]" />}
|
|
60
62
|
{title}
|
|
61
63
|
</h3>
|
|
62
64
|
{hint && <p className="text-xs text-muted-foreground">{hint}</p>}
|
|
63
65
|
</div>
|
|
66
|
+
{status && <div className="shrink-0 self-start">{status}</div>}
|
|
64
67
|
</div>
|
|
65
68
|
{children}
|
|
66
69
|
</section>
|
|
@@ -26,12 +26,17 @@
|
|
|
26
26
|
// Every brick is exported on its own, because a screen that needs only the repo
|
|
27
27
|
// rows or only the manifest shouldn't have to take the form with it.
|
|
28
28
|
|
|
29
|
-
export { ProjectForm, manifestRows } from "./project-form"
|
|
29
|
+
export { ProjectForm, manifestRows, DEFAULT_GROUPS } from "./project-form"
|
|
30
30
|
export type { ProjectFormProps } from "./project-form"
|
|
31
31
|
|
|
32
32
|
export { FormSection, Field } from "./form-section"
|
|
33
33
|
export type { FormSectionProps, SectionAccent } from "./form-section"
|
|
34
34
|
|
|
35
|
+
export { FormNav, SectionStatusBadge } from "./form-nav"
|
|
36
|
+
export type { FormNavItem, FormNavProps } from "./form-nav"
|
|
37
|
+
|
|
38
|
+
export { sectionSummary, isSectionRequired } from "./section-status"
|
|
39
|
+
|
|
35
40
|
export { AdvancedDisclosure, advancedSummary } from "./advanced-sections"
|
|
36
41
|
export type { AdvancedDisclosureProps } from "./advanced-sections"
|
|
37
42
|
|
|
@@ -57,6 +62,7 @@ export {
|
|
|
57
62
|
CREATE_SECTIONS,
|
|
58
63
|
EDIT_SECTIONS,
|
|
59
64
|
INTERNAL_SECTION_IDS,
|
|
65
|
+
REQUIRED_SECTIONS,
|
|
60
66
|
emptyProjectFormValue,
|
|
61
67
|
isInternalSectionId,
|
|
62
68
|
toProjectFormValue,
|
|
@@ -65,6 +71,7 @@ export type {
|
|
|
65
71
|
InternalSectionId,
|
|
66
72
|
ProjectFeatureSelection,
|
|
67
73
|
ProjectFormCustomSection,
|
|
74
|
+
ProjectFormGroup,
|
|
68
75
|
ProjectFormSectionId,
|
|
69
76
|
ProjectFormValue,
|
|
70
77
|
ProjectRepo,
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `sidebar` layout's promise: the rail says what's required and what's missing, and a submit
|
|
3
|
+
* with a required section empty never reaches the app — it lands the user on the page to fix.
|
|
4
|
+
*/
|
|
5
|
+
import { describe, it, expect, vi } from "vitest"
|
|
6
|
+
import { useState } from "react"
|
|
7
|
+
import { render, screen, fireEvent, within } from "@testing-library/react"
|
|
8
|
+
import { ProjectForm } from "./project-form"
|
|
9
|
+
import { emptyProjectFormValue, type ProjectFormValue } from "./types"
|
|
10
|
+
|
|
11
|
+
const IMAGES = [{ id: "node", label: "Node.js 24", image: "mcr.microsoft.com/devcontainers/typescript-node:24" }]
|
|
12
|
+
|
|
13
|
+
function Harness({ onSubmit }: { onSubmit: (v: ProjectFormValue) => void }) {
|
|
14
|
+
const [value, setValue] = useState<ProjectFormValue>(emptyProjectFormValue)
|
|
15
|
+
return <ProjectForm layout="sidebar" value={value} onChange={setValue} onSubmit={onSubmit} images={IMAGES} submitLabel="Create" />
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const nav = () => within(document.querySelector('[data-slot="form-nav"]') as HTMLElement)
|
|
19
|
+
const navEntry = (title: string) => nav().getByRole("button", { name: new RegExp(`^${title}`) })
|
|
20
|
+
|
|
21
|
+
describe("ProjectForm layout=sidebar", () => {
|
|
22
|
+
it("names what's missing, refuses the submit, and jumps to the page holding it", () => {
|
|
23
|
+
const onSubmit = vi.fn()
|
|
24
|
+
render(<Harness onSubmit={onSubmit} />)
|
|
25
|
+
|
|
26
|
+
expect(navEntry("General").textContent).toContain("Missing: name, base image")
|
|
27
|
+
expect(navEntry("Tooling").textContent).toContain("Optional · nothing set")
|
|
28
|
+
|
|
29
|
+
fireEvent.click(navEntry("Secrets"))
|
|
30
|
+
expect(navEntry("Secrets").getAttribute("aria-current")).toBe("step")
|
|
31
|
+
|
|
32
|
+
fireEvent.click(screen.getAllByRole("button", { name: "Create" })[0])
|
|
33
|
+
expect(onSubmit).not.toHaveBeenCalled()
|
|
34
|
+
expect(navEntry("General").getAttribute("aria-current")).toBe("step")
|
|
35
|
+
expect(screen.getByText("Give the project a name.")).toBeTruthy()
|
|
36
|
+
|
|
37
|
+
fireEvent.change(screen.getByLabelText(/^Name/), { target: { value: "api" } })
|
|
38
|
+
fireEvent.click(screen.getByRole("button", { name: /Node\.js 24/ }))
|
|
39
|
+
expect(navEntry("General").textContent).not.toContain("Missing")
|
|
40
|
+
expect(navEntry("General").textContent).toContain("api")
|
|
41
|
+
|
|
42
|
+
fireEvent.click(screen.getAllByRole("button", { name: "Create" })[0])
|
|
43
|
+
expect(onSubmit).toHaveBeenCalledWith(
|
|
44
|
+
expect.objectContaining({ name: "api", image: "mcr.microsoft.com/devcontainers/typescript-node:24" })
|
|
45
|
+
)
|
|
46
|
+
})
|
|
47
|
+
})
|