@reqvire-org/ads 0.3.41 → 0.3.43
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 +7 -4
- package/dist/bootstrap-ds/ADS.md +2 -1
- package/dist/bootstrap-ds/README.md +23 -14
- package/dist/bootstrap-ds/design-system/components/Actions/Button/Button.ads.fixture.ts +1 -0
- package/dist/bootstrap-ds/design-system/components/Actions/Button/Button.ads.scenario.tsx +13 -0
- package/dist/bootstrap-ds/design-system/components/Actions/Button/Button.tsx +49 -0
- package/dist/bootstrap-ds/design-system/components/Actions/Button/README.md +12 -0
- package/dist/bootstrap-ds/design-system/components/Forms/TextField/README.md +14 -0
- package/dist/bootstrap-ds/design-system/components/Forms/TextField/TextField.ads.fixture.ts +6 -0
- package/dist/bootstrap-ds/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +13 -0
- package/dist/bootstrap-ds/design-system/components/Forms/TextField/TextField.tsx +57 -0
- package/dist/bootstrap-ds/design-system/composition/Search/SearchPage/README.md +4 -0
- package/dist/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.fixture.ts +7 -0
- package/dist/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.scenario.tsx +16 -0
- package/dist/bootstrap-ds/design-system/index.ts +4 -1
- package/dist/bootstrap-ds/design-system/patterns/Search/SearchBar/README.md +12 -0
- package/dist/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.ads.fixture.ts +1 -0
- package/dist/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.ads.scenario.tsx +11 -0
- package/dist/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.tsx +41 -0
- package/dist/bootstrap-ds/design-system/review/demo-frame/DemoFrame.tsx +29 -0
- package/dist/bootstrap-ds/design-system/review/index.ts +2 -0
- package/dist/bootstrap-ds/design-system/review/screen-frame/ScreenFrame.tsx +34 -0
- package/dist/bootstrap-ds/design-system/review/token-preview/TokenPreview.tsx +107 -19
- package/dist/bootstrap-ds/design-system/tokens/Color.ads.fixture.ts +18 -0
- package/dist/bootstrap-ds/design-system/tokens/{Foundation.ads.scenario.tsx → Color.ads.scenario.tsx} +1 -1
- package/dist/{skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Foundation.ads.fixture.ts → bootstrap-ds/design-system/tokens/SpaceTypeMotion.ads.fixture.ts} +1 -13
- package/dist/bootstrap-ds/design-system/tokens/SpaceTypeMotion.ads.scenario.tsx +4 -0
- package/dist/bootstrap-ds-preact/design-system/review/demo-frame/DemoFrame.tsx +29 -0
- package/dist/bootstrap-ds-preact/design-system/review/screen-frame/ScreenFrame.tsx +34 -0
- package/dist/bootstrap-ds-preact/design-system/review/token-preview/TokenPreview.tsx +119 -0
- package/dist/bootstrap-ds-preact/design-system/showcase/mcp/main.tsx +6 -0
- package/dist/bootstrap-ds-preact/ds.config.json +19 -0
- package/dist/bootstrap-ds-preact/package.json +38 -0
- package/dist/bootstrap-ds-preact/src/vite-env.d.ts +7 -0
- package/dist/bootstrap-ds-preact/tsconfig.json +36 -0
- package/dist/bootstrap-ds-preact/vite.config.ts +23 -0
- package/dist/bun-compiler.mjs +8 -4
- package/dist/cli.mjs +7 -4
- package/dist/init.mjs +15 -7
- package/dist/mcp/execution-results.mjs +1 -0
- package/dist/mcp/mutations.mjs +1 -1
- package/dist/mcp/server.mjs +10 -8
- package/dist/mcp/showcase-host.mjs +5 -1
- package/dist/preview-builder.mjs +8 -2
- package/dist/scenarios-compiler.mjs +28 -1
- package/dist/skills/ads-break-ui/SKILL.md +2 -2
- package/dist/skills/ads-break-ui/references/validation.md +13 -0
- package/dist/skills/ads-designer/SKILL.md +33 -19
- package/dist/skills/ads-designer/assets/bootstrap-ds/ADS.md +2 -1
- package/dist/skills/ads-designer/assets/bootstrap-ds/README.md +23 -14
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/Button.ads.fixture.ts +1 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/Button.ads.scenario.tsx +13 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/Button.tsx +49 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/README.md +12 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/README.md +14 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/TextField.ads.fixture.ts +6 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +13 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/TextField.tsx +57 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/Search/SearchPage/README.md +4 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.fixture.ts +7 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.scenario.tsx +16 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/index.ts +4 -1
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/README.md +12 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.ads.fixture.ts +1 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.ads.scenario.tsx +11 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.tsx +41 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/demo-frame/DemoFrame.tsx +29 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/index.ts +2 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/screen-frame/ScreenFrame.tsx +34 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/token-preview/TokenPreview.tsx +107 -19
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Color.ads.fixture.ts +18 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/{Foundation.ads.scenario.tsx → Color.ads.scenario.tsx} +1 -1
- package/dist/{bootstrap-ds/design-system/tokens/Foundation.ads.fixture.ts → skills/ads-designer/assets/bootstrap-ds/design-system/tokens/SpaceTypeMotion.ads.fixture.ts} +1 -13
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/SpaceTypeMotion.ads.scenario.tsx +4 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/review/demo-frame/DemoFrame.tsx +29 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/review/screen-frame/ScreenFrame.tsx +34 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/review/token-preview/TokenPreview.tsx +119 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/showcase/mcp/main.tsx +6 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/ds.config.json +19 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/package.json +38 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/src/vite-env.d.ts +7 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/tsconfig.json +36 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/vite.config.ts +23 -0
- package/dist/skills/ads-designer/references/cli.md +7 -2
- package/dist/skills/ads-designer/references/design-craft.md +1 -1
- package/dist/skills/ads-designer/references/validation.md +13 -0
- package/dist/skills/ads-import/SKILL.md +2 -2
- package/dist/skills/ads-import/references/cli.md +7 -2
- package/dist/skills/ads-import/references/validation.md +13 -0
- package/dist/skills/ads-motion/SKILL.md +2 -2
- package/dist/skills/ads-motion/references/validation.md +13 -0
- package/dist/skills/ads-port/SKILL.md +3 -3
- package/dist/skills/ads-port/references/cli.md +7 -2
- package/dist/skills/ads-port/references/validation.md +13 -0
- package/dist/task-cache.mjs +122 -0
- package/dist/task-worker.mjs +19 -0
- package/dist/validation-checks.mjs +7 -9
- package/dist/validation.mjs +3 -3
- package/docs/ADS.md +7 -7
- package/docs/ARCHITECTURE.md +12 -2
- package/docs/CACHING.md +99 -0
- package/docs/CHANGELOG.md +46 -12
- package/docs/GUIDE.md +16 -14
- package/docs/benchmarks/turbo-poc.md +266 -0
- package/package.json +4 -3
- package/dist/bootstrap-ds/design-system/components/.gitkeep +0 -0
- package/dist/bootstrap-ds/design-system/composition/.gitkeep +0 -0
- package/dist/bootstrap-ds/design-system/patterns/.gitkeep +0 -0
- package/dist/check-runner.mjs +0 -7
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/.gitkeep +0 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/.gitkeep +0 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/.gitkeep +0 -0
package/dist/preview-builder.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { previewSourceRevision } from "./preview-inputs.mjs";
|
|
5
5
|
import { createPreviewResources } from "./preview-resources.mjs";
|
|
@@ -56,7 +56,13 @@ export function createVitePreviewBuilder({ build, configure }) {
|
|
|
56
56
|
// Rollup's watch task owns its input cache and replaces rollupOptions.cache.
|
|
57
57
|
// Seed the first options hook; later builds use the watcher's own cache.
|
|
58
58
|
let seed = moduleCache;
|
|
59
|
-
|
|
59
|
+
// A seeded module's transform ran in the previous graph's plugins. Styles a transform
|
|
60
|
+
// generates (Linaria's virtual `.wyw-in-js.css`) exist only in that plugin instance, so
|
|
61
|
+
// a cached module importing one is transformed again in this graph.
|
|
62
|
+
const virtualStyle = (id, code) => [...code.matchAll(/["']([^"'\n]+\.css)["']/g)].some(([, specifier]) =>
|
|
63
|
+
(specifier.startsWith(".") || path.isAbsolute(specifier)) && !existsSync(path.resolve(path.dirname(id), specifier)));
|
|
64
|
+
const seedCache = {name:"ads-preview-seed-cache",options(input){if(!seed)return;const cache=seed;seed=undefined;return{...input,cache};},
|
|
65
|
+
shouldTransformCachedModule({ id, code }) { return path.isAbsolute(id) && virtualStyle(id, code) || null; }};
|
|
60
66
|
let started;
|
|
61
67
|
let candidate;
|
|
62
68
|
const capture = { name: "ads-incremental-preview", enforce: "post",
|
|
@@ -14,6 +14,7 @@ import { createScenarioInspector } from "./scenario-inspector.mjs";
|
|
|
14
14
|
import { configurationFiles } from "./units.mjs";
|
|
15
15
|
import { validationInputFiles } from "./validation-inputs.mjs";
|
|
16
16
|
import { previewRuntimeFingerprint } from "./runtime-requirements.mjs";
|
|
17
|
+
import { architectureExternalInputs } from "./task-cache.mjs";
|
|
17
18
|
|
|
18
19
|
const digest = value => createHash("sha256").update(value).digest("hex");
|
|
19
20
|
const fileDigest = file => { try { return digest(readFileSync(file)); } catch { return null; } };
|
|
@@ -23,6 +24,9 @@ const cacheVersion = 3, maxCacheBytes = 8 * 1024 * 1024;
|
|
|
23
24
|
* Cache state is development output, never proof that a failed build is current. */
|
|
24
25
|
export function createPreviewCache(options, compilerFiles = []) {
|
|
25
26
|
const { root } = options;
|
|
27
|
+
// Build adapters such as Vite set NODE_ENV while configuring a build. Capture
|
|
28
|
+
// the launch environment once; internal compiler setup is not an external edit.
|
|
29
|
+
const launchEnvironment=architectureExternalInputs(root).environment;
|
|
26
30
|
const key = file => isInside(import.meta.dirname,file) ? `ads-tool/${path.relative(import.meta.dirname,file)}` : isInside(root,file) ? `project/${path.relative(root,file)}` : file;
|
|
27
31
|
const adapterFiles = [import.meta.filename, ...["runtime-requirements.mjs", "preview-builder.mjs", "preview-workers.mjs", "preview-files.mjs", "preview-inputs.mjs", "preview-resources.mjs", "preview-scope.mjs", "scenario-groups.mjs", "scenario-inspector.mjs", "scenario-registry.mjs", "scenarios-vite.mjs", "linaria.mjs", "linaria/atomic-css.cjs", "linaria/atomic-styled.cjs", "linaria/preserve-values.cjs"].map(file => path.join(import.meta.dirname, file)), ...compilerFiles,
|
|
28
32
|
...["package.json", "package-lock.json", "bun.lock", "bun.lockb", "node_modules/.package-lock.json"].map(file => path.join(root, file))];
|
|
@@ -40,7 +44,7 @@ export function createPreviewCache(options, compilerFiles = []) {
|
|
|
40
44
|
}
|
|
41
45
|
reload();
|
|
42
46
|
function inputs() {
|
|
43
|
-
const rows = [["project-inputs",previewSourceRevision(options)],["runtime",previewRuntimeFingerprint()]];
|
|
47
|
+
const rows = [["project-inputs",previewSourceRevision(options)],["runtime",previewRuntimeFingerprint()],["architecture-environment",{...architectureExternalInputs(root),environment:launchEnvironment}]];
|
|
44
48
|
for (const file of compilerFiles) rows.push([key(file), fileDigest(file)]);
|
|
45
49
|
// Tool upgrades invalidate validation even when the project's lockfile is unchanged.
|
|
46
50
|
for (const name of readdirSync(import.meta.dirname).filter(name => name.endsWith(".mjs"))) {
|
|
@@ -183,6 +187,29 @@ export function preparePreviewCache(candidate, target) {
|
|
|
183
187
|
|
|
184
188
|
export function promotePreviewCache(candidate,target) { const publish=preparePreviewCache(candidate,target);return publish?publish():false; }
|
|
185
189
|
|
|
190
|
+
/** Restore a complete verified graph without rediscovering semantic scenarios or
|
|
191
|
+
* starting a compiler. Live build evidence always belongs to this new session. */
|
|
192
|
+
export async function restoreCompiledPreviews(options, compilerFiles) {
|
|
193
|
+
const cache=createPreviewCache(options,compilerFiles),stamp=cache.inputs();
|
|
194
|
+
if(!cache.production(stamp))return false;
|
|
195
|
+
const entries=cache.registry(stamp);
|
|
196
|
+
if(!entries?.length)return false;
|
|
197
|
+
const publication=cachedPreviewPublication(options,entries,cache.graphRevision());
|
|
198
|
+
if(!publication)return false;
|
|
199
|
+
// The native graph stamp includes the successful gate's source, tool, runtime,
|
|
200
|
+
// Git tracking and installed-package environment. Do not invoke a second batch
|
|
201
|
+
// runner to revalidate identical evidence already attached to this graph.
|
|
202
|
+
const sourceRevision=previewSourceRevision(options);
|
|
203
|
+
if(cache.inputs()!==stamp)return false;
|
|
204
|
+
const reporter=createBuildReporter(options.root,{apps:entries.map(entry=>({id:entry.id,file:previewArtifactPath(options,entry.artifact)}))});
|
|
205
|
+
publication.publish(reporter.session);
|
|
206
|
+
mkdirSync(path.join(options.root,".ds/scenarios"),{recursive:true});
|
|
207
|
+
writeFileSync(path.join(options.root,".ds/scenarios/manifest.json"),JSON.stringify({schemaVersion:1,scenarios:entries}));
|
|
208
|
+
if(cache.inputs()!==stamp)return false;
|
|
209
|
+
reporter.batch(()=>{for(const entry of entries){const revision=reporter.begin(entry.id,{sourceRevision});reporter.ready(entry.id,revision);}reporter.progress("idle");});
|
|
210
|
+
return {restored:true,revision:publication.revision,scenarios:entries.length};
|
|
211
|
+
}
|
|
212
|
+
|
|
186
213
|
/** Shared scheduling and cache; the project supplies its own React/Preact build. */
|
|
187
214
|
export async function runScenarioCompiler(directory, { watched = false, validate, build, buildGraph, compilerFiles = [] }) {
|
|
188
215
|
const root = path.resolve(directory);
|
|
@@ -157,8 +157,8 @@ production and scenario builds; never alias React to Preact just to shrink a
|
|
|
157
157
|
preview. Native Preact uses its own JSX transform, hooks and DOM events (live
|
|
158
158
|
text updates use `onInput`). Native SVG uses DOM names such as `stroke-width`,
|
|
159
159
|
not React presentation aliases. Keep Linaria extraction and the same public APIs.
|
|
160
|
-
The
|
|
161
|
-
uses Preact. Neither is a component dependency of the receiving project.
|
|
160
|
+
The starter comes for React and for Preact; the tool repository's working
|
|
161
|
+
example uses Preact. Neither is a component dependency of the receiving project.
|
|
162
162
|
|
|
163
163
|
## Choose the work
|
|
164
164
|
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Validation scope
|
|
2
2
|
|
|
3
|
+
ADS runs architecture batch checks through its internal pinned Turbo dependency.
|
|
4
|
+
Local task caching is on by default; projects need no Turbo config. Source/tool,
|
|
5
|
+
dependency, Git-tracking and runtime changes invalidate reports. A hit reuses only
|
|
6
|
+
the source analysis, never policy success, browser results, a baseline or a run ID.
|
|
7
|
+
Project scripts and registered behavior tests still follow the selected policy.
|
|
8
|
+
Use CLI `check/validate --fresh`, or MCP `ads_check`, `ads_validate`, `ads_accept`
|
|
9
|
+
with `fresh:true`, to bypass task-cache reads. `ADS_CACHE=off` disables reads and
|
|
10
|
+
writes; `ADS_CACHE_DIR` relocates the local store. Remote caching is opt-in with
|
|
11
|
+
`ADS_REMOTE_CACHE=1` and standard Turbo provider variables. For CI, persist only
|
|
12
|
+
`.ds/task-cache` with the CI cache action or configure that remote provider; no
|
|
13
|
+
ADS cache service/API is needed. Inspect task-cache status in source reports,
|
|
14
|
+
execution summaries and `ads_results`; it is not a new test execution claim.
|
|
15
|
+
|
|
3
16
|
These checks apply to both [direct editing and MCP-only editing](workflows.md).
|
|
4
17
|
Direct source edits need current checks and rendered review; ordinary edits do
|
|
5
18
|
not require a draft or acceptance call. Tracked proposals validate on acceptance.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ads-designer
|
|
3
|
-
description: Bootstrap an empty local React design system from bundled scaffolding, or build UI using a project's existing design system. Covers shared token contracts, local ownership, public APIs, external source integration, showcase inspection, and validation.
|
|
3
|
+
description: Bootstrap an empty local React or Preact design system from bundled scaffolding, or build UI using a project's existing design system. Covers shared token contracts, local ownership, public APIs, external source integration, showcase inspection, and validation.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
## Choose the editing workflow
|
|
@@ -36,14 +36,14 @@ and memory limits in project configuration; verify real workloads under them.
|
|
|
36
36
|
Inspect the target before editing. Read its `README.md`, `docs/ARCHITECTURE.md`
|
|
37
37
|
and `docs/ADS.md` when present (or existing project guides), public exports, and relevant
|
|
38
38
|
component guides. Preserve its
|
|
39
|
-
framework and contracts. Starting from zero works from the bundled
|
|
40
|
-
|
|
39
|
+
framework and contracts. Starting from zero works from the bundled starter
|
|
40
|
+
without an example repository.
|
|
41
41
|
|
|
42
42
|
Linaria is required for ADS component and pattern styling. Preserve the target's
|
|
43
43
|
UI framework and integrate compatible Linaria extraction with both application
|
|
44
|
-
and preview builds. The bundled React
|
|
45
|
-
`ads init` does not install or configure Linaria. Use the starter
|
|
46
|
-
framework
|
|
44
|
+
and preview builds. The bundled React and Preact starters already configure it;
|
|
45
|
+
`ads init` does not install or configure Linaria. Use the starter for the
|
|
46
|
+
project's framework. Current core
|
|
47
47
|
guards inspect JS/TS/JSX, CSS, and imported Linaria templates, not Vue/Svelte
|
|
48
48
|
single-file components or general HTML component templates. Entry HTML mount
|
|
49
49
|
CSS is checked; that is not component-template coverage. Preserve the target stack and matching
|
|
@@ -54,12 +54,13 @@ production and scenario builds; never alias React to Preact just to shrink a
|
|
|
54
54
|
preview. Native Preact uses its own JSX transform, hooks and DOM events (live
|
|
55
55
|
text updates use `onInput`). Native SVG uses DOM names such as `stroke-width`,
|
|
56
56
|
not React presentation aliases. Keep Linaria extraction and the same public APIs.
|
|
57
|
-
The
|
|
58
|
-
|
|
57
|
+
The starter comes for React (`bootstrap-ds/`) and Preact (the same files
|
|
58
|
+
with `bootstrap-ds-preact/` copied over them); the tool repository's working
|
|
59
|
+
example uses Preact. Neither is a component dependency of the receiving project.
|
|
59
60
|
|
|
60
61
|
When initializing a project without a saved framework, pass `--framework react`
|
|
61
62
|
or `--framework preact` for its actual runtime. Init saves the choice and later
|
|
62
|
-
runs reuse it.
|
|
63
|
+
runs reuse it. Each starter already declares its framework. Resolve any explicit
|
|
63
64
|
JSX/configuration conflict deliberately; do not change frameworks to make init
|
|
64
65
|
pass. Init does not install the runtime or configure the application's compiler.
|
|
65
66
|
|
|
@@ -200,21 +201,32 @@ checks; do not fetch the unpublished package.
|
|
|
200
201
|
|
|
201
202
|
Read [assets/bootstrap-ds/README.md](assets/bootstrap-ds/README.md) and its
|
|
202
203
|
[contract](assets/bootstrap-ds/ADS.md). The scaffold contains semantic token
|
|
203
|
-
defaults, React
|
|
204
|
-
barrel,
|
|
205
|
-
It
|
|
204
|
+
defaults, React or Preact TypeScript/Linaria configuration, general lint, a public
|
|
205
|
+
barrel, project-owned review renderers (token tiles, demo and screen frames), and a project preview compiler adapter. The browser shell is supplied by ADS tooling.
|
|
206
|
+
It has one example of each layer to build on: two token groups (Color; Space, type &
|
|
207
|
+
motion), two components in two groups (`components/Actions/Button`,
|
|
208
|
+
`components/Forms/TextField`), one pattern (`patterns/Search/SearchBar`) and one
|
|
209
|
+
composition (`composition/Search/SearchPage`). Treat them as the project's own: adapt or replace them
|
|
210
|
+
for the requested product. It has no vendored fonts or icons.
|
|
206
211
|
|
|
207
212
|
Resolve assets relative to this skill's `SKILL.md`, including after installation
|
|
208
213
|
by `npx skills`. In the tool checkout, root `bootstrap-ds/` is canonical.
|
|
209
|
-
For a new empty project, copy its **contents**, including dotfiles
|
|
214
|
+
For a new empty project, copy its **contents**, including dotfiles. For
|
|
215
|
+
Preact, copy `bootstrap-ds-preact/` over them and drop the React lockfile; never
|
|
216
|
+
port the React files by hand:
|
|
210
217
|
|
|
211
218
|
```sh
|
|
212
|
-
|
|
219
|
+
assets_dir="/absolute/path/to/ads-designer/assets"
|
|
213
220
|
target_dir="/absolute/path/to/new-project"
|
|
221
|
+
framework="react" # or "preact"
|
|
214
222
|
mkdir -p "$target_dir"
|
|
215
|
-
cp -a "$
|
|
223
|
+
cp -a "$assets_dir/bootstrap-ds/." "$target_dir/"
|
|
224
|
+
if [ "$framework" = preact ]; then
|
|
225
|
+
cp -a "$assets_dir/bootstrap-ds-preact/." "$target_dir/"
|
|
226
|
+
rm "$target_dir/package-lock.json"
|
|
227
|
+
fi
|
|
216
228
|
cd "$target_dir"
|
|
217
|
-
# Run ads init here when an actual tool distribution is available.
|
|
229
|
+
# Run ads init --framework "$framework" here when an actual tool distribution is available.
|
|
218
230
|
npm install
|
|
219
231
|
npm run build
|
|
220
232
|
```
|
|
@@ -226,6 +238,8 @@ The bundled application defaults to npm. For a new Bun application,
|
|
|
226
238
|
translate nested npm script calls to `bun run` and omit the starter npm lockfile;
|
|
227
239
|
preserve an existing app's package manager and lockfile when merging.
|
|
228
240
|
Initialize/install ADS before running `npm run dev:showcase` for visual inspection.
|
|
241
|
+
`dev:showcase` and the project's ADS MCP (`.mcp.json`) each serve a showcase:
|
|
242
|
+
give them different ports, or open the MCP's showcase instead of starting one.
|
|
229
243
|
Use an existing MCP runtime URL when connected; do not leave an unrequested
|
|
230
244
|
server running.
|
|
231
245
|
|
|
@@ -534,7 +548,7 @@ adding an approval step solely because a showcase exists.
|
|
|
534
548
|
|
|
535
549
|
## Notifications when a local Toast exists
|
|
536
550
|
|
|
537
|
-
Read the local notification guide before using its API; the
|
|
551
|
+
Read the local notification guide before using its API; the starter has
|
|
538
552
|
no Toast. Follow its host/provider mounting, routing, scope, duration, and focus
|
|
539
553
|
contracts instead of assuming Sonner compatibility or a particular native API.
|
|
540
554
|
|
|
@@ -546,12 +560,12 @@ information in the relevant form, inline alert, or dialog.
|
|
|
546
560
|
|
|
547
561
|
Customize through shared tokens, component mappings and documented variants. Stacking, gestures,
|
|
548
562
|
measured geometry, and animation belong to the component. Register applicable
|
|
549
|
-
component-local usage rules in project tooling; do not assume the
|
|
563
|
+
component-local usage rules in project tooling; do not assume the starter
|
|
550
564
|
includes them or that core tooling bundles this component.
|
|
551
565
|
|
|
552
566
|
## Validate
|
|
553
567
|
|
|
554
|
-
Use the target's actual lint/typecheck/build commands. The
|
|
568
|
+
Use the target's actual lint/typecheck/build commands. The starter provides:
|
|
555
569
|
|
|
556
570
|
```sh
|
|
557
571
|
npm run typecheck
|
|
@@ -24,7 +24,8 @@ The starter declares React in `ds.config.json`. Keep that choice, JSX, runtime
|
|
|
24
24
|
dependencies and the preview mount adapter consistent. Init records a choice for
|
|
25
25
|
an unconfigured project; it does not convert copied React source to Preact.
|
|
26
26
|
|
|
27
|
-
The starter has
|
|
27
|
+
The starter has one example of each layer (Button, TextField, SearchBar,
|
|
28
|
+
SearchPage). Rename, restyle or replace them; add only what the product needs.
|
|
28
29
|
Keep the ADS in root `design-system/`, beside application `src/`.
|
|
29
30
|
Keep public exports in `design-system/index.ts`; consumers use its `@ds` alias.
|
|
30
31
|
`styles.css` is the foundation CSS entry and contains token imports only.
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Starter native design system
|
|
2
2
|
|
|
3
|
-
This private React
|
|
3
|
+
This private React or Preact TypeScript workspace contains semantic CSS tokens, a project-owned
|
|
4
4
|
token review renderer, a public barrel, Linaria extraction and a preview compiler
|
|
5
|
-
adapter
|
|
6
|
-
|
|
5
|
+
adapter, plus one example of each layer to build on: two token groups (Color; Space, type &
|
|
6
|
+
motion), two components in two groups (`components/Actions/Button`,
|
|
7
|
+
`components/Forms/TextField`), one pattern (`patterns/Search/SearchBar`) and one
|
|
8
|
+
composition (`composition/Search/SearchPage`). Rename, restyle or replace them as the
|
|
9
|
+
product's own; it has no icons or fonts. The minimal showcase shell and MCP client
|
|
10
|
+
come from ADS tooling.
|
|
7
11
|
|
|
8
12
|
Read the local [contract](ADS.md) and the
|
|
9
13
|
[architecture](https://github.com/reqvire-org/ads/blob/main/docs/ARCHITECTURE.md).
|
|
@@ -11,12 +15,15 @@ Read the local [contract](ADS.md) and the
|
|
|
11
15
|
## Start
|
|
12
16
|
|
|
13
17
|
Copy the contents of `bootstrap-ds/`, including dotfiles, into a new project.
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
It is the React starter. For Preact, then copy `bootstrap-ds-preact/` over it
|
|
19
|
+
(its package, compiler settings, scenario mount, token preview and scenario
|
|
20
|
+
types) and delete the React `package-lock.json`. The installed `ads-designer`
|
|
21
|
+
skill contains the same files in `assets/bootstrap-ds/` and
|
|
22
|
+
`assets/bootstrap-ds-preact/`. Set the project name in `package.json`. Install Bun 1.4.1+ for ADS tooling and previews. The application can keep its
|
|
16
23
|
Node/npm build pipeline. Use a current ADS release.
|
|
17
24
|
|
|
18
25
|
```sh
|
|
19
|
-
npx @reqvire-org/ads init --framework react
|
|
26
|
+
npx @reqvire-org/ads init --framework react # or preact
|
|
20
27
|
npm install
|
|
21
28
|
npm run build
|
|
22
29
|
npm run dev:showcase
|
|
@@ -40,10 +47,10 @@ Bun projects and preserves their scripts/lockfiles. Use `bun install` and
|
|
|
40
47
|
|
|
41
48
|
For an existing application, merge only the ADS source and required extraction,
|
|
42
49
|
aliases and preview adapter. Preserve its framework, entry points and build.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Init records that choice and
|
|
46
|
-
app or rewriting its compiler. Subsequent init runs reuse the saved choice.
|
|
50
|
+
Each starter declares its framework in `ds.config.json`. For an existing app
|
|
51
|
+
without a saved ADS framework, use `ads init --framework react` or
|
|
52
|
+
`--framework preact`. Init records that choice and adds that framework's token
|
|
53
|
+
preview and scenario mount without migrating the app or rewriting its compiler. Subsequent init runs reuse the saved choice.
|
|
47
54
|
Init adds missing foundation files and connects architectural checks; it does
|
|
48
55
|
not configure Linaria or generate product component source. Generated `.ds/` files are
|
|
49
56
|
ignored; original artwork and provenance belong in `assets/brand/`.
|
|
@@ -51,14 +58,16 @@ ignored; original artwork and provenance belong in `assets/brand/`.
|
|
|
51
58
|
## Inspect and add UI
|
|
52
59
|
|
|
53
60
|
When an agent already runs `ads mcp`, open its `ads_status.showcaseUrl`. MCP starts
|
|
54
|
-
the website automatically. Otherwise `npm run dev:showcase` runs `ads showcase
|
|
61
|
+
the website automatically. Otherwise `npm run dev:showcase` runs `ads showcase`; give it a port the ADS MCP
|
|
62
|
+
does not use, since both serve a showcase.
|
|
55
63
|
Its shell is minimal: tabs, collapsible left menu, theme switch and App slot.
|
|
56
64
|
Its MCP client discovers entries, invokes preview tools and follows notifications.
|
|
57
65
|
There are no required TokensPage/ComponentsPage/PatternsPage/CompositionPage
|
|
58
66
|
files, and no separate project browser app to implement or rebuild.
|
|
59
67
|
|
|
60
|
-
The
|
|
61
|
-
|
|
68
|
+
The `tokens/Color.ads.scenario.tsx` and `tokens/SpaceTypeMotion.ads.scenario.tsx`
|
|
69
|
+
groups and their colocated fixtures visually demonstrate all starter token values,
|
|
70
|
+
one tile per token with its current value. The fixture owns `{ token, property, probe }` bindings;
|
|
62
71
|
the development-only `TokenPreview` renderer, exported through `@ds/review`, owns their presentation and applies the real CSS
|
|
63
72
|
variables. Add/remove samples alongside token definitions. `ads check` rejects
|
|
64
73
|
missing coverage and invented names; the App verifies the declared CSS bindings
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const fixture = { title: "Button", primary: "Save", secondary: "Cancel", disabled: "Unavailable" } as const;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Button } from "@ds";
|
|
2
|
+
import { DemoFrame } from "@ds/review";
|
|
3
|
+
import { fixture } from "./Button.ads.fixture";
|
|
4
|
+
export const scenario = { title: fixture.title, covers: ["Button"] };
|
|
5
|
+
export default function Scenario() {
|
|
6
|
+
return (
|
|
7
|
+
<DemoFrame>
|
|
8
|
+
<Button label={fixture.primary} variant="primary" />
|
|
9
|
+
<Button label={fixture.secondary} />
|
|
10
|
+
<Button label={fixture.disabled} disabled />
|
|
11
|
+
</DemoFrame>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { css, cx } from "@linaria/atomic";
|
|
2
|
+
|
|
3
|
+
export interface ButtonProps {
|
|
4
|
+
label: string;
|
|
5
|
+
/** `primary` for the main action of a view; `secondary` for the others. */
|
|
6
|
+
variant?: "primary" | "secondary";
|
|
7
|
+
type?: "button" | "submit";
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
onClick?: () => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const base = css`
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
padding-block: var(--space-4);
|
|
17
|
+
padding-inline: var(--space-8);
|
|
18
|
+
border-width: var(--border-w);
|
|
19
|
+
border-style: solid;
|
|
20
|
+
border-color: transparent;
|
|
21
|
+
border-radius: var(--radius-md);
|
|
22
|
+
font-size: var(--text-base);
|
|
23
|
+
font-weight: var(--weight-semibold);
|
|
24
|
+
line-height: var(--leading-normal);
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
&:disabled { cursor: default; opacity: 0.5; }
|
|
27
|
+
`;
|
|
28
|
+
const variants = {
|
|
29
|
+
primary: css`
|
|
30
|
+
background: var(--accent);
|
|
31
|
+
color: var(--accent-fg);
|
|
32
|
+
&:hover:not(:disabled) { background: var(--accent-hover); }
|
|
33
|
+
`,
|
|
34
|
+
secondary: css`
|
|
35
|
+
background: var(--bg-surface);
|
|
36
|
+
border-color: var(--border-default);
|
|
37
|
+
color: var(--text-body);
|
|
38
|
+
&:hover:not(:disabled) { border-color: var(--accent); }
|
|
39
|
+
`,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** A labelled action. */
|
|
43
|
+
export function Button({ label, variant = "secondary", type = "button", disabled, onClick }: ButtonProps) {
|
|
44
|
+
return (
|
|
45
|
+
<button type={type} className={cx("ds-button", base, variants[variant])} disabled={disabled} onClick={onClick}>
|
|
46
|
+
{label}
|
|
47
|
+
</button>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Button
|
|
2
|
+
|
|
3
|
+
A labelled action. `variant="primary"` marks the main action of a view; other actions use the
|
|
4
|
+
default `secondary`. `type="submit"` submits its form.
|
|
5
|
+
|
|
6
|
+
| Prop | Type | Default |
|
|
7
|
+
|---|---|---|
|
|
8
|
+
| `label` | `string` | — |
|
|
9
|
+
| `variant` | `"primary" \| "secondary"` | `"secondary"` |
|
|
10
|
+
| `type` | `"button" \| "submit"` | `"button"` |
|
|
11
|
+
| `disabled` | `boolean` | `false` |
|
|
12
|
+
| `onClick` | `() => void` | — |
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# TextField
|
|
2
|
+
|
|
3
|
+
A labelled single-line text input. `id` ties the label to the input. Pass `value` and
|
|
4
|
+
`onValueChange` to own its value, or only `name` to let a form read it on submit.
|
|
5
|
+
|
|
6
|
+
| Prop | Type | Default |
|
|
7
|
+
|---|---|---|
|
|
8
|
+
| `id` | `string` | — |
|
|
9
|
+
| `label` | `string` | — |
|
|
10
|
+
| `name` | `string` | — |
|
|
11
|
+
| `placeholder` | `string` | — |
|
|
12
|
+
| `value` | `string` | — |
|
|
13
|
+
| `disabled` | `boolean` | `false` |
|
|
14
|
+
| `onValueChange` | `(value: string) => void` | — |
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const fixture = {
|
|
2
|
+
title: "Text field",
|
|
3
|
+
email: { id: "text-field-email", label: "Email", placeholder: "you@example.com" },
|
|
4
|
+
filled: { id: "text-field-name", label: "Name", value: "Ada Lovelace" },
|
|
5
|
+
disabled: { id: "text-field-disabled", label: "Team", value: "Design", disabled: true },
|
|
6
|
+
} as const;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TextField } from "@ds";
|
|
2
|
+
import { DemoFrame } from "@ds/review";
|
|
3
|
+
import { fixture } from "./TextField.ads.fixture";
|
|
4
|
+
export const scenario = { title: fixture.title, covers: ["TextField"] };
|
|
5
|
+
export default function Scenario() {
|
|
6
|
+
return (
|
|
7
|
+
<DemoFrame layout="column">
|
|
8
|
+
<TextField {...fixture.email} />
|
|
9
|
+
<TextField {...fixture.filled} />
|
|
10
|
+
<TextField {...fixture.disabled} />
|
|
11
|
+
</DemoFrame>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { css, cx } from "@linaria/atomic";
|
|
2
|
+
|
|
3
|
+
export interface TextFieldProps {
|
|
4
|
+
/** Ties the label to the input. */
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
/** The form field name its value is submitted under. */
|
|
8
|
+
name?: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
/** The current value; without it the field keeps its own. */
|
|
11
|
+
value?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
onValueChange?: (value: string) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const field = css`
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
gap: var(--space-2);
|
|
20
|
+
min-width: 0;
|
|
21
|
+
`;
|
|
22
|
+
const labelStyle = css`
|
|
23
|
+
font-size: var(--text-sm);
|
|
24
|
+
font-weight: var(--weight-semibold);
|
|
25
|
+
color: var(--text-body);
|
|
26
|
+
`;
|
|
27
|
+
const input = css`
|
|
28
|
+
padding-block: var(--space-4);
|
|
29
|
+
padding-inline: var(--space-4);
|
|
30
|
+
border: var(--border-w) solid var(--border-default);
|
|
31
|
+
border-radius: var(--radius-md);
|
|
32
|
+
background: var(--bg-surface);
|
|
33
|
+
color: var(--text-body);
|
|
34
|
+
font-size: var(--text-base);
|
|
35
|
+
line-height: var(--leading-normal);
|
|
36
|
+
&::placeholder { color: var(--text-muted); }
|
|
37
|
+
&:disabled { opacity: 0.5; }
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
/** A labelled single-line text input. */
|
|
41
|
+
export function TextField({ id, label, name, placeholder, value, disabled, onValueChange }: TextFieldProps) {
|
|
42
|
+
return (
|
|
43
|
+
<div className={cx("ds-text-field", field)}>
|
|
44
|
+
<label className={labelStyle} htmlFor={id}>{label}</label>
|
|
45
|
+
<input
|
|
46
|
+
id={id}
|
|
47
|
+
className={input}
|
|
48
|
+
name={name}
|
|
49
|
+
type="text"
|
|
50
|
+
placeholder={placeholder}
|
|
51
|
+
value={value}
|
|
52
|
+
disabled={disabled}
|
|
53
|
+
onInput={event => onValueChange?.(event.currentTarget.value)}
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const fixture = {
|
|
2
|
+
title: "Search page",
|
|
3
|
+
heading: "Find anything in the design system",
|
|
4
|
+
description: "Search tokens, components and patterns by name.",
|
|
5
|
+
search: { id: "search-page-query", label: "Search", placeholder: "Button, colors, search…" },
|
|
6
|
+
browse: "Browse all components",
|
|
7
|
+
} as const;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Button, SearchBar } from "@ds";
|
|
2
|
+
import { ScreenFrame } from "@ds/review";
|
|
3
|
+
import { fixture } from "./SearchPage.ads.fixture";
|
|
4
|
+
|
|
5
|
+
// A screen composed from public parts, for review only: it is not exported from @ds.
|
|
6
|
+
export const scenario = { title: fixture.title, covers: ["SearchBar", "Button"] };
|
|
7
|
+
export default function Scenario() {
|
|
8
|
+
return (
|
|
9
|
+
<ScreenFrame title={fixture.heading} description={fixture.description}>
|
|
10
|
+
<SearchBar {...fixture.search} />
|
|
11
|
+
<div>
|
|
12
|
+
<Button label={fixture.browse} />
|
|
13
|
+
</div>
|
|
14
|
+
</ScreenFrame>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
// Load local foundation styles; the compile check also extracts dist/styles.css.
|
|
2
2
|
import "./styles.css";
|
|
3
3
|
|
|
4
|
-
//
|
|
4
|
+
// Public components and patterns. Add new ones here as they are implemented.
|
|
5
|
+
export { Button, type ButtonProps } from "./components/Actions/Button/Button";
|
|
6
|
+
export { TextField, type TextFieldProps } from "./components/Forms/TextField/TextField";
|
|
7
|
+
export { SearchBar, type SearchBarProps } from "./patterns/Search/SearchBar/SearchBar";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# SearchBar
|
|
2
|
+
|
|
3
|
+
A search form built from `TextField` and a primary `Button`. Enter or the button calls
|
|
4
|
+
`onSearch` with the trimmed query; the page decides what searching means.
|
|
5
|
+
|
|
6
|
+
| Prop | Type | Default |
|
|
7
|
+
|---|---|---|
|
|
8
|
+
| `id` | `string` | — |
|
|
9
|
+
| `label` | `string` | — |
|
|
10
|
+
| `placeholder` | `string` | — |
|
|
11
|
+
| `submitLabel` | `string` | `"Search"` |
|
|
12
|
+
| `onSearch` | `(query: string) => void` | — |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const fixture = { title: "Search bar", id: "search-bar-query", label: "Search the docs", placeholder: "Tokens, components…" } as const;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SearchBar } from "@ds";
|
|
2
|
+
import { DemoFrame } from "@ds/review";
|
|
3
|
+
import { fixture } from "./SearchBar.ads.fixture";
|
|
4
|
+
export const scenario = { title: fixture.title, covers: ["SearchBar"] };
|
|
5
|
+
export default function Scenario() {
|
|
6
|
+
return (
|
|
7
|
+
<DemoFrame layout="column">
|
|
8
|
+
<SearchBar id={fixture.id} label={fixture.label} placeholder={fixture.placeholder} />
|
|
9
|
+
</DemoFrame>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { css, cx } from "@linaria/atomic";
|
|
2
|
+
import { Button } from "../../../components/Actions/Button/Button";
|
|
3
|
+
import { TextField } from "../../../components/Forms/TextField/TextField";
|
|
4
|
+
|
|
5
|
+
export interface SearchBarProps {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
submitLabel?: string;
|
|
10
|
+
/** Called with the typed query when the person searches. */
|
|
11
|
+
onSearch?: (query: string) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const form = css`
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: flex-end;
|
|
17
|
+
gap: var(--space-4);
|
|
18
|
+
`;
|
|
19
|
+
const query = css`
|
|
20
|
+
flex: 1;
|
|
21
|
+
min-width: 0;
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
/** A search field with its submit action: Enter or the button searches. */
|
|
25
|
+
export function SearchBar({ id, label, placeholder, submitLabel = "Search", onSearch }: SearchBarProps) {
|
|
26
|
+
return (
|
|
27
|
+
<form
|
|
28
|
+
role="search"
|
|
29
|
+
className={cx("ds-search-bar", form)}
|
|
30
|
+
onSubmit={event => {
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
onSearch?.(String(new FormData(event.currentTarget).get("query") ?? "").trim());
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<div className={query}>
|
|
36
|
+
<TextField id={id} label={label} name="query" placeholder={placeholder} />
|
|
37
|
+
</div>
|
|
38
|
+
<Button label={submitLabel} variant="primary" type="submit" />
|
|
39
|
+
</form>
|
|
40
|
+
);
|
|
41
|
+
}
|
package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/demo-frame/DemoFrame.tsx
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { css, cx } from "@linaria/atomic";
|
|
3
|
+
|
|
4
|
+
export interface DemoFrameProps {
|
|
5
|
+
/** `row` lays examples side by side; `column` stacks them at a readable width. */
|
|
6
|
+
layout?: "row" | "column";
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const frame = css`
|
|
11
|
+
display: flex;
|
|
12
|
+
gap: var(--space-8);
|
|
13
|
+
padding: var(--space-12);
|
|
14
|
+
`;
|
|
15
|
+
const layouts = {
|
|
16
|
+
row: css`
|
|
17
|
+
flex-wrap: wrap;
|
|
18
|
+
align-items: flex-start;
|
|
19
|
+
`,
|
|
20
|
+
column: css`
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
max-width: calc(var(--space-16) * 12);
|
|
23
|
+
`,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** Development-only framing for component and pattern scenarios: spacing between examples. */
|
|
27
|
+
export function DemoFrame({ layout = "row", children }: DemoFrameProps) {
|
|
28
|
+
return <div className={cx(frame, layouts[layout])}>{children}</div>;
|
|
29
|
+
}
|