@astryxdesign/cli 0.4.7 → 0.5.0-canary.055e75f
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/CHANGELOG.md +64 -0
- package/README.md +53 -51
- package/api/docs/docs.doc.mjs +2 -2
- package/api/index.d.mts +1 -1
- package/api/index.mjs +1 -1
- package/api/search/search.mjs +50 -4
- package/api/search/search.test.mjs +71 -0
- package/api/template/template.doc.mjs +2 -2
- package/api/theme/build/build.mjs +12 -42
- package/api/theme/targets/targets.d.mts +18 -0
- package/api/theme/targets/targets.mjs +87 -0
- package/api/theme/targets/targets.test.mjs +66 -0
- package/api/theme/theme.d.mts +1 -0
- package/api/theme/theme.mjs +3 -1
- package/api/theme/theme.type.d.mts +23 -0
- package/api/theme/theme.type.mjs +21 -1
- package/api/theme/themeTargets.doc.d.mts +11 -0
- package/api/theme/themeTargets.doc.mjs +58 -0
- package/api/theme/themeTemplate.doc.mjs +3 -3
- package/assets/codemods/__tests__/registry.test.mjs +1 -0
- package/assets/codemods/registry.mjs +1 -0
- package/assets/codemods/transforms/v0.5.0/__tests__/next-codemods.test.mjs +127 -0
- package/assets/codemods/transforms/v0.5.0/banner-collapsible-content.mjs +171 -0
- package/assets/codemods/transforms/v0.5.0/index.mjs +20 -0
- package/assets/docs/README.md +50 -0
- package/assets/docs/cli-integrations.doc.mjs +4 -4
- package/assets/docs/theme.doc.dense.mjs +1 -1
- package/assets/docs/theme.doc.mjs +1 -1
- package/assets/docs/typography.doc.mjs +2 -2
- package/assets/templates/blocks/components/Banner/BannerCollapsibleContent.doc.mjs +1 -1
- package/assets/templates/blocks/components/Banner/BannerCollapsibleContent.tsx +1 -1
- package/assets/templates/blocks/components/DateInput/DateInputClearable.tsx +5 -1
- package/assets/templates/blocks/components/DateInput/DateInputDateRange.tsx +6 -1
- package/assets/templates/blocks/components/DateInput/DateInputFormats.tsx +5 -1
- package/assets/templates/blocks/components/DateInput/DateInputShowcase.tsx +4 -1
- package/assets/templates/blocks/components/DateInput/DateInputWithDescription.tsx +5 -1
- package/assets/templates/blocks/components/DateInput/DateInputWithValidation.tsx +5 -1
- package/assets/templates/blocks/components/Dialog/DialogAdaptivePresentation.doc.mjs +25 -0
- package/assets/templates/blocks/components/Dialog/DialogAdaptivePresentation.tsx +167 -0
- package/assets/templates/blocks/components/Dialog/DialogScrollingContent.tsx +1 -1
- package/assets/templates/blocks/components/HoverCard/HoverCardHookUsage.tsx +4 -1
- package/assets/templates/blocks/components/Step/StepContent.doc.mjs +14 -0
- package/assets/templates/blocks/components/Step/StepContent.tsx +32 -0
- package/assets/templates/blocks/components/Step/StepIndicator.doc.mjs +14 -0
- package/assets/templates/blocks/components/Step/StepIndicator.tsx +60 -0
- package/assets/templates/blocks/components/Step/StepShowcase.doc.mjs +15 -0
- package/assets/templates/blocks/components/Step/StepShowcase.tsx +26 -0
- package/assets/templates/blocks/components/Step/StepStates.doc.mjs +14 -0
- package/assets/templates/blocks/components/Step/StepStates.tsx +46 -0
- package/assets/templates/blocks/components/Stepper/StepperCustomContent.doc.mjs +22 -0
- package/assets/templates/blocks/components/Stepper/StepperCustomContent.tsx +126 -0
- package/assets/templates/blocks/components/Stepper/StepperIndicatorModes.doc.mjs +1 -1
- package/assets/templates/blocks/components/Stepper/StepperIndicatorModes.tsx +17 -5
- package/assets/templates/blocks/components/Stepper/StepperOnTrackHorizontal.doc.mjs +14 -0
- package/assets/templates/blocks/components/Stepper/StepperOnTrackHorizontal.tsx +25 -0
- package/assets/templates/blocks/components/Stepper/StepperOnTrackVertical.doc.mjs +2 -2
- package/assets/templates/blocks/components/Stepper/StepperOnTrackVertical.tsx +1 -1
- package/assets/templates/blocks/components/Stepper/StepperShowcase.doc.mjs +1 -1
- package/assets/templates/blocks/components/Stepper/StepperShowcase.tsx +6 -7
- package/assets/templates/blocks/components/Stepper/StepperStatus.tsx +1 -1
- package/assets/templates/pages/mixed-gallery/page.tsx +12 -3
- package/assets/templates/pages/table-grouped/page.tsx +151 -144
- package/assets/templates/pages/theme-showcase/page.tsx +36 -17
- package/assets/templates/themes/chocolate/chocolateTheme.ts +3 -1
- package/assets/templates/themes/matcha/matchaTheme.ts +3 -1
- package/assets/templates/themes/neutral/neutralTheme.ts +16 -9
- package/assets/templates/themes/stone/stoneTheme.ts +3 -1
- package/clients/cli/commands/build-theme.mjs +85 -0
- package/clients/cli/commands/dialog-adaptive-template.test.mjs +24 -0
- package/clients/cli/commands/theme-targets.behavior.test.mjs +64 -0
- package/clients/cli/commands/theme-targets.doc.mjs +38 -0
- package/clients/cli/commands/theme-template.doc.mjs +2 -2
- package/clients/cli/commands/theme.doc.mjs +4 -2
- package/clients/cli/index.mjs +1 -0
- package/clients/cli/lib/component-format.mjs +2 -2
- package/clients/cli/lib/manifest.mjs +2 -0
- package/foundation/discovery/theming-targets.d.mts +86 -0
- package/foundation/discovery/theming-targets.mjs +202 -0
- package/foundation/discovery/theming-targets.test.mjs +245 -0
- package/foundation/response/response-types.doc.mjs +7 -2
- package/package.json +9 -9
- package/assets/templates/blocks/components/Stepper/StepperHorizontal.doc.mjs +0 -14
- package/assets/templates/blocks/components/Stepper/StepperHorizontal.tsx +0 -24
- package/assets/templates/blocks/components/Stepper/StepperMultiStepForm.doc.mjs +0 -14
- package/assets/templates/blocks/components/Stepper/StepperMultiStepForm.tsx +0 -92
- package/assets/templates/blocks/components/Stepper/StepperVerticalOnboarding.doc.mjs +0 -14
- package/assets/templates/blocks/components/Stepper/StepperVerticalOnboarding.tsx +0 -40
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file The enumerability guard for component theming targets.
|
|
5
|
+
*
|
|
6
|
+
* A theming target is only useful if a theme author can find it. These tests
|
|
7
|
+
* run against the REAL core docs and fail if any component's targets stop
|
|
8
|
+
* being enumerable — a doc that moves out of the scanned tree, a target shape
|
|
9
|
+
* that stops being read, or a component whose Theming table says one thing
|
|
10
|
+
* while `theme targets` says another. That divergence is the failure the
|
|
11
|
+
* listing exists to prevent: a target list that can drift from the components
|
|
12
|
+
* is worse than no list.
|
|
13
|
+
*
|
|
14
|
+
* The public vars a target carries get the same treatment, one step further:
|
|
15
|
+
* being enumerable is not the same as being settable. A documented var no
|
|
16
|
+
* component reads compiles to a declaration that never applies (#5012), and a
|
|
17
|
+
* var the component writes inline outranks every cascade layer, so no theme can
|
|
18
|
+
* reach it (#4530). Both shipped. Neither is visible in the generated theme CSS
|
|
19
|
+
* — the artifact the jsdom suites assert on — so the wiring is checked here
|
|
20
|
+
* against source. Whether the cascade then lands the value on the element is a
|
|
21
|
+
* browser fact and no jsdom test can stand in for it.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import {describe, it, expect} from 'vitest';
|
|
25
|
+
import * as fs from 'node:fs';
|
|
26
|
+
import * as path from 'node:path';
|
|
27
|
+
import {findCoreDir} from '../fs/paths.mjs';
|
|
28
|
+
import {
|
|
29
|
+
discoverComponents,
|
|
30
|
+
findComponentReadme,
|
|
31
|
+
} from './component-discovery.mjs';
|
|
32
|
+
import {loadComponentDoc} from './component-loader.mjs';
|
|
33
|
+
import {
|
|
34
|
+
collectThemingTargets,
|
|
35
|
+
collectThemingVars,
|
|
36
|
+
targetsByKey,
|
|
37
|
+
} from './theming-targets.mjs';
|
|
38
|
+
|
|
39
|
+
const coreDir = /** @type {string} */ (findCoreDir(process.cwd()));
|
|
40
|
+
const coreSrc = path.join(coreDir, 'src');
|
|
41
|
+
|
|
42
|
+
/** @type {Promise<import('./theming-targets.mjs').ThemingTarget[]>} */
|
|
43
|
+
const enumerated = collectThemingTargets(coreSrc);
|
|
44
|
+
|
|
45
|
+
describe('collectThemingTargets', () => {
|
|
46
|
+
it('enumerates the whole surface, not a handful', async () => {
|
|
47
|
+
const targets = await enumerated;
|
|
48
|
+
expect(targets.length).toBeGreaterThan(100);
|
|
49
|
+
expect(new Set(targets.map(t => t.component)).size).toBeGreaterThan(50);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('drops the namespace prefix so each key is what defineTheme takes', async () => {
|
|
53
|
+
for (const t of await enumerated) {
|
|
54
|
+
expect(t.className).toBe(`astryx-${t.key}`);
|
|
55
|
+
expect(t.component).toBeTruthy();
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('carries the props and states a target reflects', async () => {
|
|
60
|
+
const targets = await enumerated;
|
|
61
|
+
expect(targets.find(t => t.key === 'switch-thumb')).toEqual({
|
|
62
|
+
key: 'switch-thumb',
|
|
63
|
+
className: 'astryx-switch-thumb',
|
|
64
|
+
component: 'Switch',
|
|
65
|
+
props: ['size'],
|
|
66
|
+
states: ['checked'],
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('is sorted by key, so a diff of two runs is readable', async () => {
|
|
71
|
+
const keys = (await enumerated).map(t => t.key);
|
|
72
|
+
expect(keys).toEqual([...keys].sort((a, b) => a.localeCompare(b)));
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// The listing and `theme build`'s override validation read this one
|
|
76
|
+
// enumeration. `targetsByKey` is the shape validation wants: props and
|
|
77
|
+
// states merged, because both are legal override keys.
|
|
78
|
+
it('collapses to the override keys, merging the components that share one', async () => {
|
|
79
|
+
const byKey = targetsByKey(await enumerated);
|
|
80
|
+
expect(byKey['switch']).toEqual(['size', 'checked', 'disabled']);
|
|
81
|
+
// `radio` is documented by both Indicator and RadioList.
|
|
82
|
+
const radio = (await enumerated).filter(t => t.key === 'radio');
|
|
83
|
+
expect(radio.length).toBeGreaterThan(1);
|
|
84
|
+
for (const t of radio) {
|
|
85
|
+
for (const name of [...t.props, ...t.states]) {
|
|
86
|
+
expect(byKey['radio']).toContain(name);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('every component doc that declares targets has them enumerated', async () => {
|
|
92
|
+
const targets = await enumerated;
|
|
93
|
+
/** @type {Map<string, Set<string>>} key -> props+states */
|
|
94
|
+
const byKey = new Map(
|
|
95
|
+
Object.entries(targetsByKey(targets)).map(([k, v]) => [k, new Set(v)]),
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const names = Object.values(discoverComponents(coreDir)).flat();
|
|
99
|
+
/** @type {string[]} */
|
|
100
|
+
const missing = [];
|
|
101
|
+
/** @type {Set<string>} */
|
|
102
|
+
const seenDocs = new Set();
|
|
103
|
+
let checked = 0;
|
|
104
|
+
|
|
105
|
+
for (const name of names) {
|
|
106
|
+
const docPath = findComponentReadme(coreDir, name);
|
|
107
|
+
if (!docPath || seenDocs.has(docPath)) continue;
|
|
108
|
+
seenDocs.add(docPath);
|
|
109
|
+
|
|
110
|
+
/** @type {any} */
|
|
111
|
+
let doc;
|
|
112
|
+
try {
|
|
113
|
+
doc = await loadComponentDoc(docPath);
|
|
114
|
+
} catch {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
for (const target of doc?.theming?.targets || []) {
|
|
119
|
+
if (typeof target?.className !== 'string') continue;
|
|
120
|
+
checked++;
|
|
121
|
+
const key = target.className.replace(/^astryx-/, '');
|
|
122
|
+
const known = byKey.get(key);
|
|
123
|
+
if (!known) {
|
|
124
|
+
missing.push(`${name}: ${target.className} is not enumerable`);
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
for (const prop of [
|
|
128
|
+
...(target.visualProps || []),
|
|
129
|
+
...(target.states || []),
|
|
130
|
+
]) {
|
|
131
|
+
if (!known.has(prop)) {
|
|
132
|
+
missing.push(`${name}: ${target.className} lost "${prop}"`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
expect(checked).toBeGreaterThan(100);
|
|
139
|
+
expect(missing).toEqual([]);
|
|
140
|
+
}, 60_000);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// ---------------------------------------------------------------------------
|
|
144
|
+
// Public vars — enumerable is not the same as settable
|
|
145
|
+
// ---------------------------------------------------------------------------
|
|
146
|
+
|
|
147
|
+
/** @type {Promise<import('./theming-targets.mjs').ThemingVar[]>} */
|
|
148
|
+
const enumeratedVars = collectThemingVars(coreSrc);
|
|
149
|
+
|
|
150
|
+
/** Every non-test source file under a component directory. */
|
|
151
|
+
function sourcesIn(dir) {
|
|
152
|
+
/** @type {string[]} */
|
|
153
|
+
const out = [];
|
|
154
|
+
for (const entry of fs.readdirSync(dir, {withFileTypes: true})) {
|
|
155
|
+
if (entry.isDirectory()) {
|
|
156
|
+
if (entry.name === 'node_modules' || entry.name === '__tests__') continue;
|
|
157
|
+
out.push(...sourcesIn(path.join(dir, entry.name)));
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (!/\.tsx?$/.test(entry.name)) continue;
|
|
161
|
+
if (/\.(test|stories)\.tsx?$/.test(entry.name)) continue;
|
|
162
|
+
out.push(path.join(dir, entry.name));
|
|
163
|
+
}
|
|
164
|
+
return out;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* The text of every inline style a file writes — `style={{…}}` objects and
|
|
169
|
+
* `setProperty` calls. A custom property written from either outranks every
|
|
170
|
+
* cascade layer, so a theme cannot reach it.
|
|
171
|
+
*/
|
|
172
|
+
function inlineStyleText(src) {
|
|
173
|
+
const chunks = [];
|
|
174
|
+
for (const m of src.matchAll(/style=\{\{/g)) {
|
|
175
|
+
const end = src.indexOf('}}', m.index);
|
|
176
|
+
chunks.push(src.slice(m.index, end === -1 ? src.length : end));
|
|
177
|
+
}
|
|
178
|
+
for (const m of src.matchAll(/setProperty\(\s*'[^']+'/g)) chunks.push(m[0]);
|
|
179
|
+
return chunks.join('\n');
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
describe('collectThemingVars', () => {
|
|
183
|
+
it('enumerates the public vars and drops the private plumbing', async () => {
|
|
184
|
+
const names = (await enumeratedVars).map(v => v.name);
|
|
185
|
+
expect(names.length).toBeGreaterThan(0);
|
|
186
|
+
expect(names.every(n => !n.startsWith('--_'))).toBe(true);
|
|
187
|
+
expect(names).toEqual([...names].sort((a, b) => a.localeCompare(b)));
|
|
188
|
+
expect(names).toEqual([...new Set(names)]);
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
it('carries the component and the documented default', async () => {
|
|
192
|
+
const indent = (await enumeratedVars).find(
|
|
193
|
+
v => v.name === '--tree-list-indent',
|
|
194
|
+
);
|
|
195
|
+
expect(indent).toMatchObject({
|
|
196
|
+
name: '--tree-list-indent',
|
|
197
|
+
component: 'TreeList',
|
|
198
|
+
default: 'var(--spacing-4)',
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
// #5012: the theme docs advertised `--button-press-scale`, which no component
|
|
203
|
+
// ever read. A theme setting it compiled to a declaration nothing consumed,
|
|
204
|
+
// and nothing failed — the var was in the docs, so every existence check
|
|
205
|
+
// passed. Reading it is the minimum that makes a documented var mean anything.
|
|
206
|
+
it('every documented var is read by the component that documents it', async () => {
|
|
207
|
+
/** @type {string[]} */
|
|
208
|
+
const unread = [];
|
|
209
|
+
for (const v of await enumeratedVars) {
|
|
210
|
+
const read = sourcesIn(v.dir).some(f =>
|
|
211
|
+
fs.readFileSync(f, 'utf-8').includes(`var(${v.name}`),
|
|
212
|
+
);
|
|
213
|
+
if (!read) unread.push(`${v.component}: nothing reads var(${v.name})`);
|
|
214
|
+
}
|
|
215
|
+
expect(
|
|
216
|
+
unread,
|
|
217
|
+
`A documented public var no component reads compiles to a declaration ` +
|
|
218
|
+
`that never applies (#5012). Either wire it up or drop it from the doc.`,
|
|
219
|
+
).toEqual([]);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
// #4530: TreeList's indent was an inline `margin-inline-start` on the element
|
|
223
|
+
// carrying the theme target. An inline declaration outranks every cascade
|
|
224
|
+
// layer, so `@layer astryx-theme` could not reach it — the var was real, read,
|
|
225
|
+
// and documented, and still unsettable. The fix moved it into a StyleX rule.
|
|
226
|
+
it('no documented var is written inline, where no theme can outrank it', async () => {
|
|
227
|
+
/** @type {string[]} */
|
|
228
|
+
const clobbered = [];
|
|
229
|
+
for (const v of await enumeratedVars) {
|
|
230
|
+
for (const f of sourcesIn(v.dir)) {
|
|
231
|
+
if (inlineStyleText(fs.readFileSync(f, 'utf-8')).includes(v.name)) {
|
|
232
|
+
clobbered.push(
|
|
233
|
+
`${v.component}: ${path.basename(f)} sets ${v.name} inline`,
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
expect(
|
|
239
|
+
clobbered,
|
|
240
|
+
`An inline custom property beats every cascade layer, so a theme setting ` +
|
|
241
|
+
`it through @layer astryx-theme is silently ignored (#4530). Declare it ` +
|
|
242
|
+
`in a StyleX rule instead.`,
|
|
243
|
+
).toEqual([]);
|
|
244
|
+
});
|
|
245
|
+
});
|
|
@@ -153,7 +153,7 @@ export const doc = {
|
|
|
153
153
|
{
|
|
154
154
|
value: 'template.cdn',
|
|
155
155
|
description:
|
|
156
|
-
'A write receipt for the no-build-step CDN starter page: the path (relative to cwd), the Astryx version every CDN URL was pinned to, whether it was written, and the reason it was not
|
|
156
|
+
'A write receipt for the no-build-step CDN starter page: the path (relative to cwd), the Astryx version every CDN URL was pinned to, whether it was written, and the reason it was not. `exists` when a file was already there, which is a success.',
|
|
157
157
|
},
|
|
158
158
|
|
|
159
159
|
// hook
|
|
@@ -197,7 +197,12 @@ export const doc = {
|
|
|
197
197
|
{
|
|
198
198
|
value: 'theme.template',
|
|
199
199
|
description:
|
|
200
|
-
'A write receipt for the annotated theme template: the path (relative to cwd), whether it was written, and the reason it was not
|
|
200
|
+
'A write receipt for the annotated theme template: the path (relative to cwd), whether it was written, and the reason it was not. `exists` when a file was already there, which is a success.',
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
value: 'theme.targets',
|
|
204
|
+
description:
|
|
205
|
+
'The whole themeable surface: the echoed filter, the component count, and one entry per theming target — {key, className, component, props, states}, where props and states are its legal override keys.',
|
|
201
206
|
},
|
|
202
207
|
|
|
203
208
|
// upgrade
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-canary.055e75f",
|
|
4
4
|
"displayName": "CLI",
|
|
5
5
|
"description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -87,10 +87,10 @@
|
|
|
87
87
|
"zod": "^4.4.3"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
|
-
"@astryxdesign/charts": "
|
|
91
|
-
"@astryxdesign/core": "
|
|
92
|
-
"@astryxdesign/lab": "
|
|
93
|
-
"@astryxdesign/theme-neutral": "
|
|
90
|
+
"@astryxdesign/charts": "0.5.0-canary.055e75f",
|
|
91
|
+
"@astryxdesign/core": "0.5.0-canary.055e75f",
|
|
92
|
+
"@astryxdesign/lab": "0.5.0-canary.055e75f",
|
|
93
|
+
"@astryxdesign/theme-neutral": "0.5.0-canary.055e75f",
|
|
94
94
|
"gpt-tokenizer": "^3.4.0"
|
|
95
95
|
},
|
|
96
96
|
"peerDependenciesMeta": {
|
|
@@ -108,10 +108,10 @@
|
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
|
-
"@astryxdesign/charts": "
|
|
112
|
-
"@astryxdesign/core": "
|
|
113
|
-
"@astryxdesign/lab": "
|
|
114
|
-
"@astryxdesign/theme-neutral": "
|
|
111
|
+
"@astryxdesign/charts": "0.5.0-canary.055e75f",
|
|
112
|
+
"@astryxdesign/core": "0.5.0-canary.055e75f",
|
|
113
|
+
"@astryxdesign/lab": "0.5.0-canary.055e75f",
|
|
114
|
+
"@astryxdesign/theme-neutral": "0.5.0-canary.055e75f",
|
|
115
115
|
"gpt-tokenizer": "^3.4.0"
|
|
116
116
|
},
|
|
117
117
|
"scripts": {
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
|
|
4
|
-
export const doc = {
|
|
5
|
-
type: 'block',
|
|
6
|
-
exampleFor: 'Stepper',
|
|
7
|
-
name: 'Stepper — Horizontal Progress',
|
|
8
|
-
displayName: 'Stepper — Horizontal Progress',
|
|
9
|
-
description:
|
|
10
|
-
'A horizontal separated stepper: each step owns a segment of the progress bar above its label. Filled segments track how far the flow has progressed.',
|
|
11
|
-
isReady: true,
|
|
12
|
-
aspectRatio: 16 / 9,
|
|
13
|
-
componentsUsed: ['Stepper'],
|
|
14
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
|
-
import {useState} from 'react';
|
|
6
|
-
import {Stepper, Step} from '@astryxdesign/lab';
|
|
7
|
-
|
|
8
|
-
export default function StepperHorizontal() {
|
|
9
|
-
const [active, setActive] = useState(1);
|
|
10
|
-
return (
|
|
11
|
-
<div style={{width: '100%', maxWidth: 600}}>
|
|
12
|
-
<Stepper
|
|
13
|
-
activeStep={active}
|
|
14
|
-
orientation="horizontal"
|
|
15
|
-
onStepClick={setActive}>
|
|
16
|
-
<Step step={0} label="Workspace" />
|
|
17
|
-
<Step step={1} label="Team" />
|
|
18
|
-
<Step step={2} label="Integrations" />
|
|
19
|
-
<Step step={3} label="Import" />
|
|
20
|
-
<Step step={4} label="Launch" />
|
|
21
|
-
</Stepper>
|
|
22
|
-
</div>
|
|
23
|
-
);
|
|
24
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
|
|
4
|
-
export const doc = {
|
|
5
|
-
type: 'block',
|
|
6
|
-
exampleFor: 'Stepper',
|
|
7
|
-
name: 'Stepper — Multi-Step Form',
|
|
8
|
-
displayName: 'Stepper — Multi-Step Form',
|
|
9
|
-
description:
|
|
10
|
-
'A vertical stepper driving a multi-step form. Each step renders its own fields in the content slot for the active step, with Back/Continue buttons advancing activeStep.',
|
|
11
|
-
isReady: true,
|
|
12
|
-
aspectRatio: 4 / 3,
|
|
13
|
-
componentsUsed: ['Stepper', 'TextInput', 'Button', 'Text'],
|
|
14
|
-
};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
|
-
import {useState} from 'react';
|
|
6
|
-
import {Stepper, Step} from '@astryxdesign/lab';
|
|
7
|
-
import {TextInput} from '@astryxdesign/core/TextInput';
|
|
8
|
-
import {Button} from '@astryxdesign/core/Button';
|
|
9
|
-
import {Text} from '@astryxdesign/core/Text';
|
|
10
|
-
|
|
11
|
-
export default function StepperMultiStepForm() {
|
|
12
|
-
const [active, setActive] = useState(0);
|
|
13
|
-
return (
|
|
14
|
-
<div style={{width: '100%', maxWidth: 480}}>
|
|
15
|
-
<Stepper
|
|
16
|
-
activeStep={active}
|
|
17
|
-
orientation="vertical"
|
|
18
|
-
onStepClick={setActive}>
|
|
19
|
-
<Step step={0} label="Project details" indicator="number">
|
|
20
|
-
{active === 0 && (
|
|
21
|
-
<div style={{display: 'flex', flexDirection: 'column', gap: 12}}>
|
|
22
|
-
<TextInput
|
|
23
|
-
label="Project name"
|
|
24
|
-
placeholder="My awesome project"
|
|
25
|
-
value=""
|
|
26
|
-
/>
|
|
27
|
-
<TextInput
|
|
28
|
-
label="Repository URL"
|
|
29
|
-
placeholder="https://github.com/..."
|
|
30
|
-
value=""
|
|
31
|
-
/>
|
|
32
|
-
<div>
|
|
33
|
-
<Button
|
|
34
|
-
label="Continue"
|
|
35
|
-
variant="primary"
|
|
36
|
-
onClick={() => setActive(1)}
|
|
37
|
-
/>
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
)}
|
|
41
|
-
</Step>
|
|
42
|
-
<Step step={1} label="Environment" indicator="number">
|
|
43
|
-
{active === 1 && (
|
|
44
|
-
<div style={{display: 'flex', flexDirection: 'column', gap: 12}}>
|
|
45
|
-
<TextInput label="Node version" placeholder="20" value="" />
|
|
46
|
-
<TextInput
|
|
47
|
-
label="Build command"
|
|
48
|
-
placeholder="npm run build"
|
|
49
|
-
value=""
|
|
50
|
-
/>
|
|
51
|
-
<div style={{display: 'flex', gap: 8}}>
|
|
52
|
-
<Button
|
|
53
|
-
label="Back"
|
|
54
|
-
variant="secondary"
|
|
55
|
-
onClick={() => setActive(0)}
|
|
56
|
-
/>
|
|
57
|
-
<Button
|
|
58
|
-
label="Continue"
|
|
59
|
-
variant="primary"
|
|
60
|
-
onClick={() => setActive(2)}
|
|
61
|
-
/>
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
)}
|
|
65
|
-
</Step>
|
|
66
|
-
<Step step={2} label="Deploy" indicator="number">
|
|
67
|
-
{active === 2 && (
|
|
68
|
-
<div style={{display: 'flex', flexDirection: 'column', gap: 12}}>
|
|
69
|
-
<Text type="body">
|
|
70
|
-
Ready to deploy. This creates a production build and pushes to
|
|
71
|
-
your configured hosting.
|
|
72
|
-
</Text>
|
|
73
|
-
<div style={{display: 'flex', gap: 8}}>
|
|
74
|
-
<Button
|
|
75
|
-
label="Back"
|
|
76
|
-
variant="secondary"
|
|
77
|
-
onClick={() => setActive(1)}
|
|
78
|
-
/>
|
|
79
|
-
<Button
|
|
80
|
-
label="Deploy now"
|
|
81
|
-
variant="primary"
|
|
82
|
-
onClick={() => setActive(3)}
|
|
83
|
-
/>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
)}
|
|
87
|
-
</Step>
|
|
88
|
-
<Step step={3} label="Done" indicator="number" />
|
|
89
|
-
</Stepper>
|
|
90
|
-
</div>
|
|
91
|
-
);
|
|
92
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
|
|
4
|
-
export const doc = {
|
|
5
|
-
type: 'block',
|
|
6
|
-
exampleFor: 'Stepper',
|
|
7
|
-
name: 'Stepper — Vertical Onboarding',
|
|
8
|
-
displayName: 'Stepper — Vertical Onboarding',
|
|
9
|
-
description:
|
|
10
|
-
'A vertical stepper for an onboarding flow, with a label and description per step. The auto indicator shows a check for completed steps, a ring for the current step, and a number for upcoming ones.',
|
|
11
|
-
isReady: true,
|
|
12
|
-
aspectRatio: 4 / 3,
|
|
13
|
-
componentsUsed: ['Stepper'],
|
|
14
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
|
-
import {useState} from 'react';
|
|
6
|
-
import {Stepper, Step} from '@astryxdesign/lab';
|
|
7
|
-
|
|
8
|
-
export default function StepperVerticalOnboarding() {
|
|
9
|
-
const [active, setActive] = useState(2);
|
|
10
|
-
return (
|
|
11
|
-
<div style={{width: '100%', maxWidth: 400}}>
|
|
12
|
-
<Stepper
|
|
13
|
-
activeStep={active}
|
|
14
|
-
orientation="vertical"
|
|
15
|
-
onStepClick={setActive}>
|
|
16
|
-
<Step
|
|
17
|
-
step={0}
|
|
18
|
-
label="Create workspace"
|
|
19
|
-
description="Name and configure your workspace"
|
|
20
|
-
/>
|
|
21
|
-
<Step
|
|
22
|
-
step={1}
|
|
23
|
-
label="Invite team members"
|
|
24
|
-
description="Add collaborators by email"
|
|
25
|
-
/>
|
|
26
|
-
<Step
|
|
27
|
-
step={2}
|
|
28
|
-
label="Set up integrations"
|
|
29
|
-
description="Connect Slack, GitHub, Jira"
|
|
30
|
-
/>
|
|
31
|
-
<Step
|
|
32
|
-
step={3}
|
|
33
|
-
label="Import data"
|
|
34
|
-
description="Bring in existing projects"
|
|
35
|
-
/>
|
|
36
|
-
<Step step={4} label="Launch" description="Go live with your team" />
|
|
37
|
-
</Stepper>
|
|
38
|
-
</div>
|
|
39
|
-
);
|
|
40
|
-
}
|