@reqvire-org/ads 0.3.42 → 0.3.44
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 +11 -5
- package/dist/assets.mjs +48 -2
- package/dist/bootstrap-ds/ADS.md +2 -1
- package/dist/bootstrap-ds/README.md +25 -14
- package/dist/bootstrap-ds/design-system/assets/brand/README.md +26 -19
- package/dist/bootstrap-ds/design-system/assets/brand/app-icon.svg +4 -0
- package/dist/bootstrap-ds/design-system/assets/brand/logo.dark.svg +6 -0
- package/dist/bootstrap-ds/design-system/assets/brand/logo.svg +6 -0
- 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/Content/Logo/Logo.ads.fixture.ts +1 -0
- package/dist/bootstrap-ds/design-system/components/Content/Logo/Logo.ads.scenario.tsx +12 -0
- package/dist/bootstrap-ds/design-system/components/Content/Logo/Logo.tsx +41 -0
- package/dist/bootstrap-ds/design-system/components/Content/Logo/README.md +10 -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 +5 -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/brand-preview/BrandPreview.tsx +115 -0
- package/dist/bootstrap-ds/design-system/review/demo-frame/DemoFrame.tsx +29 -0
- package/dist/bootstrap-ds/design-system/review/index.ts +3 -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/Brand.ads.fixture.ts +12 -0
- package/dist/bootstrap-ds/design-system/tokens/Brand.ads.scenario.tsx +4 -0
- 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/ds.config.json +2 -1
- 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 +20 -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/brand-assets.mjs +136 -3
- package/dist/check.mjs +4 -2
- package/dist/config.mjs +49 -1
- package/dist/init.mjs +16 -7
- package/dist/mcp/preview-widget.bundle.js +1 -1
- package/dist/mcp/project-widget.bundle.js +1 -1
- package/dist/mcp/server.mjs +5 -2
- package/dist/mcp/showcase-host.mjs +5 -1
- package/dist/preview-builder.mjs +8 -2
- package/dist/preview-bun.mjs +4 -2
- package/dist/preview-resources.mjs +1 -1
- package/dist/scenarios.mjs +11 -4
- package/dist/skills/ads-break-ui/SKILL.md +2 -2
- package/dist/skills/ads-designer/SKILL.md +42 -19
- package/dist/skills/ads-designer/assets/bootstrap-ds/ADS.md +2 -1
- package/dist/skills/ads-designer/assets/bootstrap-ds/README.md +25 -14
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/brand/README.md +26 -19
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/brand/app-icon.svg +4 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/brand/logo.dark.svg +6 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/brand/logo.svg +6 -0
- 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/Content/Logo/Logo.ads.fixture.ts +1 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Content/Logo/Logo.ads.scenario.tsx +12 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Content/Logo/Logo.tsx +41 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Content/Logo/README.md +10 -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 +5 -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/brand-preview/BrandPreview.tsx +115 -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 +3 -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/Brand.ads.fixture.ts +12 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Brand.ads.scenario.tsx +4 -0
- 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/ds.config.json +2 -1
- 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 +20 -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/branding.md +89 -0
- package/dist/skills/ads-designer/references/cli.md +1 -1
- package/dist/skills/ads-designer/references/design-craft.md +1 -1
- package/dist/skills/ads-import/SKILL.md +2 -2
- package/dist/skills/ads-import/references/branding.md +10 -3
- package/dist/skills/ads-import/references/cli.md +1 -1
- package/dist/skills/ads-motion/SKILL.md +2 -2
- package/dist/skills/ads-port/SKILL.md +3 -3
- package/dist/skills/ads-port/references/cli.md +1 -1
- package/dist/token-fixtures.mjs +2 -2
- package/docs/ADS.md +12 -9
- package/docs/ARCHITECTURE.md +3 -2
- package/docs/CHANGELOG.md +56 -12
- package/docs/GUIDE.md +57 -15
- package/package.json +1 -1
- 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/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/README.md
CHANGED
|
@@ -25,7 +25,7 @@ Data, UX, Skin, and the performance reasons behind that choice.
|
|
|
25
25
|
ADS manages its batch-task cache internally; see [cache controls and CI wiring](docs/CACHING.md).
|
|
26
26
|
|
|
27
27
|
ADS supports **React and native Preact** with the same architecture guards and
|
|
28
|
-
MCP preview flow. The
|
|
28
|
+
MCP preview flow. The starter comes for React and for Preact; this repository’s working example
|
|
29
29
|
uses Preact. See [implementation support](docs/GUIDE.md#implementation-support).
|
|
30
30
|
|
|
31
31
|
## What ADS does
|
|
@@ -233,7 +233,7 @@ happens automatically; no separate project showcase rebuild is needed.
|
|
|
233
233
|
|
|
234
234
|
For an existing app, `init` adds the showcase launch script; it does not install
|
|
235
235
|
a preview compiler. Integrate the [starter compiler and mount adapter](docs/GUIDE.md#showcase)
|
|
236
|
-
with your build. The copied
|
|
236
|
+
with your build. The copied starter already includes that setup.
|
|
237
237
|
|
|
238
238
|
There are no required showcase page files. Add a colocated scenario and fixture
|
|
239
239
|
for tokens and each public UI owner; larger entries live under `composition/`.
|
|
@@ -249,7 +249,11 @@ Change values in `design-system/tokens/`, keeping the
|
|
|
249
249
|
[shared token names](docs/ADS.md#shared-token-contract), such as `--accent` and
|
|
250
250
|
`--font-sans`.
|
|
251
251
|
|
|
252
|
-
Keep original artwork
|
|
252
|
+
Keep original artwork, with its use, credits and license in a README, in
|
|
253
|
+
`design-system/assets/brand/`; `ads check` warns about undescribed, unlicensed,
|
|
254
|
+
unpreviewed or unused artwork. Name dark-theme variants `<name>.dark.svg`.
|
|
255
|
+
Committed native and export icons (`assets.targets`: SVG, PNG, ICO, ICNS) and UI
|
|
256
|
+
icon sets (`assets.glyphs`) are generated by `ads assets` and checked for freshness.
|
|
253
257
|
To generate web icons, add this to `ds.config.json`:
|
|
254
258
|
|
|
255
259
|
```json
|
|
@@ -336,8 +340,10 @@ The [dummy project](tests/fixtures/guard-project/README.md) tests the generic gu
|
|
|
336
340
|
|
|
337
341
|
There are two different starting points in this checkout:
|
|
338
342
|
|
|
339
|
-
- [bootstrap-ds/](bootstrap-ds/README.md) is
|
|
340
|
-
|
|
343
|
+
- [bootstrap-ds/](bootstrap-ds/README.md) is the React application starter, and
|
|
344
|
+
[bootstrap-ds-preact/](bootstrap-ds-preact/) the files that make it Preact:
|
|
345
|
+
token defaults in two groups, build setup, one example component in each of two groups,
|
|
346
|
+
a pattern and a composition, development-only review renderers, and a project preview compiler adapter. It is bundled with `ads-designer` so an agent can copy it when starting
|
|
341
347
|
from zero. `ads init` uses its empty foundation files when a project has no ADS.
|
|
342
348
|
- [design-system/](design-system/README.md) is this repository's working example,
|
|
343
349
|
with real components, patterns, and scenarios inspected through the built-in showcase. It demonstrates the architecture
|
package/dist/assets.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
1
|
+
import { existsSync, lstatSync, readFileSync, readdirSync } from "node:fs";
|
|
2
2
|
import { spawnSync } from "node:child_process";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { isInside } from "./config.mjs";
|
|
5
|
-
import { brandFiles, brandSourceDiagnostic } from "./brand-assets.mjs";
|
|
5
|
+
import { brandFiles, brandSourceDiagnostic, staleBrandOutputs } from "./brand-assets.mjs";
|
|
6
6
|
|
|
7
7
|
function assetFiles(directory, prefix = "") {
|
|
8
8
|
const stat = lstatSync(directory, { throwIfNoEntry: false });
|
|
@@ -17,10 +17,56 @@ function assetFiles(directory, prefix = "") {
|
|
|
17
17
|
return files.sort();
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
const sourceExtensions = /\.(?:[cm]?[jt]sx?|css|html|svg)$/;
|
|
21
|
+
const previewFile = /(?:\.ads)?\.(?:scenario\.tsx?|fixture\.ts)$/;
|
|
22
|
+
/** Text of the project's own source files, for finding which brand artwork is referenced. */
|
|
23
|
+
function sourceTexts(directories, skipped) {
|
|
24
|
+
const texts = [];
|
|
25
|
+
const visit = directory => {
|
|
26
|
+
const stat = lstatSync(directory, { throwIfNoEntry: false });
|
|
27
|
+
if (!stat || stat.isSymbolicLink() || !stat.isDirectory() || skipped.some(skip => directory === skip || isInside(skip, directory))) return;
|
|
28
|
+
for (const entry of readdirSync(directory, { withFileTypes: true })) {
|
|
29
|
+
const file = path.join(directory, entry.name);
|
|
30
|
+
if (entry.isDirectory()) { if (!["node_modules", ".git"].includes(entry.name)) visit(file); }
|
|
31
|
+
else if (entry.isFile() && sourceExtensions.test(entry.name)) texts.push({ file, text: readFileSync(file, "utf8") });
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
for (const directory of directories) visit(directory);
|
|
35
|
+
return texts;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Brand artwork is documented, licensed, previewed and used. Generated outputs match their masters. */
|
|
39
|
+
function inspectBrand({ root, dsRoot, config }) {
|
|
40
|
+
const diagnostics = [];
|
|
41
|
+
const relative = file => path.relative(root, file).replaceAll("\\", "/") || ".";
|
|
42
|
+
for (const { file, message } of staleBrandOutputs({ root, dsRoot, config })) diagnostics.push({ rule: "brand-output-stale", file, line: 1, column: 1, message });
|
|
43
|
+
const brand = path.join(dsRoot, "assets/brand");
|
|
44
|
+
const artwork = assetFiles(brand).filter(file => file.toLowerCase().endsWith(".svg"));
|
|
45
|
+
if (!artwork.length) return diagnostics;
|
|
46
|
+
const warn = (rule, file, message) => diagnostics.push({ rule, severity: "warning", file: relative(file), line: 1, column: 1, guidanceUri: "ads://guides/branding", message });
|
|
47
|
+
const readmeFile = path.join(brand, "README.md");
|
|
48
|
+
const readme = existsSync(readmeFile) ? readFileSync(readmeFile, "utf8") : null;
|
|
49
|
+
if (readme === null) warn("brand-readme", brand, "Describe each artwork in assets/brand/README.md: its use, suitable backgrounds, credits and license.");
|
|
50
|
+
else if (!/licen[cs]e/i.test(readme)) warn("brand-license", readmeFile, "State the license (or ownership) of the brand artwork in assets/brand/README.md.");
|
|
51
|
+
const generated = [...config.assets.generatedPaths.map(entry => path.resolve(root, entry)), path.join(root, ".ds")];
|
|
52
|
+
const sources = sourceTexts([dsRoot, path.join(root, config.sourceDir ?? "src")], [path.join(dsRoot, "assets"), ...generated]);
|
|
53
|
+
const configured = new Set([config.assets.iconSource, ...config.assets.targets.map(target => target.from)].filter(Boolean).map(file => path.join(dsRoot, file)));
|
|
54
|
+
const previews = path.join(dsRoot, config.tokenDir);
|
|
55
|
+
for (const name of artwork) {
|
|
56
|
+
const file = path.join(brand, name), base = path.basename(name);
|
|
57
|
+
if (readme !== null && !readme.includes(base)) warn("brand-readme", file, `Describe ${base} in assets/brand/README.md: its use, suitable backgrounds, credits and license.`);
|
|
58
|
+
const referencing = sources.filter(source => source.text.includes(base));
|
|
59
|
+
if (!referencing.some(source => isInside(previews, source.file) && previewFile.test(source.file))) warn("brand-preview", file, `Show ${base} in a token-folder brand scenario, so it can be reviewed with the foundation.`);
|
|
60
|
+
if (!configured.has(file) && !referencing.some(source => !previewFile.test(source.file))) warn("brand-unused", file, `${base} is not used by any component, assets.iconSource or assets.targets. Use it or remove it.`);
|
|
61
|
+
}
|
|
62
|
+
return diagnostics;
|
|
63
|
+
}
|
|
64
|
+
|
|
20
65
|
export function inspectAssets({ root, dsRoot, config, trackingRoot = root }) {
|
|
21
66
|
const diagnostics = [];
|
|
22
67
|
const sourceDiagnostic = brandSourceDiagnostic({ root, dsRoot, config });
|
|
23
68
|
if (sourceDiagnostic) diagnostics.push(sourceDiagnostic);
|
|
69
|
+
diagnostics.push(...inspectBrand({ root, dsRoot, config }));
|
|
24
70
|
function report(rule, file, message) { diagnostics.push({ rule, file: path.relative(root, file).replaceAll("\\", "/") || ".", line: 1, column: 1, message }); }
|
|
25
71
|
const assetRoot = path.join(dsRoot, "assets");
|
|
26
72
|
// Every mount is compared with the canonical ADS assets. Public mounts are
|
package/dist/bootstrap-ds/ADS.md
CHANGED
|
@@ -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, Logo, TextField, SearchBar,
|
|
28
|
+
SearchPage) and placeholder brand artwork. 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,15 @@
|
|
|
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) and a Brand preview, components in three groups (`components/Actions/Button`,
|
|
7
|
+
`components/Content/Logo`, `components/Forms/TextField`), one pattern
|
|
8
|
+
(`patterns/Search/SearchBar`) and one composition (`composition/Search/SearchPage`),
|
|
9
|
+
plus placeholder brand artwork in `assets/brand/` (a logo with its dark-theme
|
|
10
|
+
variant, and the app icon that `assets.iconSource` names). Rename, restyle or
|
|
11
|
+
replace them as the product's own; it has no fonts. The minimal showcase shell and MCP client
|
|
12
|
+
come from ADS tooling.
|
|
7
13
|
|
|
8
14
|
Read the local [contract](ADS.md) and the
|
|
9
15
|
[architecture](https://github.com/reqvire-org/ads/blob/main/docs/ARCHITECTURE.md).
|
|
@@ -11,12 +17,15 @@ Read the local [contract](ADS.md) and the
|
|
|
11
17
|
## Start
|
|
12
18
|
|
|
13
19
|
Copy the contents of `bootstrap-ds/`, including dotfiles, into a new project.
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
It is the React starter. For Preact, then copy `bootstrap-ds-preact/` over it
|
|
21
|
+
(its package, compiler settings, scenario mount, token preview and scenario
|
|
22
|
+
types) and delete the React `package-lock.json`. The installed `ads-designer`
|
|
23
|
+
skill contains the same files in `assets/bootstrap-ds/` and
|
|
24
|
+
`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
25
|
Node/npm build pipeline. Use a current ADS release.
|
|
17
26
|
|
|
18
27
|
```sh
|
|
19
|
-
npx @reqvire-org/ads init --framework react
|
|
28
|
+
npx @reqvire-org/ads init --framework react # or preact
|
|
20
29
|
npm install
|
|
21
30
|
npm run build
|
|
22
31
|
npm run dev:showcase
|
|
@@ -40,10 +49,10 @@ Bun projects and preserves their scripts/lockfiles. Use `bun install` and
|
|
|
40
49
|
|
|
41
50
|
For an existing application, merge only the ADS source and required extraction,
|
|
42
51
|
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.
|
|
52
|
+
Each starter declares its framework in `ds.config.json`. For an existing app
|
|
53
|
+
without a saved ADS framework, use `ads init --framework react` or
|
|
54
|
+
`--framework preact`. Init records that choice and adds that framework's token
|
|
55
|
+
preview and scenario mount without migrating the app or rewriting its compiler. Subsequent init runs reuse the saved choice.
|
|
47
56
|
Init adds missing foundation files and connects architectural checks; it does
|
|
48
57
|
not configure Linaria or generate product component source. Generated `.ds/` files are
|
|
49
58
|
ignored; original artwork and provenance belong in `assets/brand/`.
|
|
@@ -51,14 +60,16 @@ ignored; original artwork and provenance belong in `assets/brand/`.
|
|
|
51
60
|
## Inspect and add UI
|
|
52
61
|
|
|
53
62
|
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
|
|
63
|
+
the website automatically. Otherwise `npm run dev:showcase` runs `ads showcase`; give it a port the ADS MCP
|
|
64
|
+
does not use, since both serve a showcase.
|
|
55
65
|
Its shell is minimal: tabs, collapsible left menu, theme switch and App slot.
|
|
56
66
|
Its MCP client discovers entries, invokes preview tools and follows notifications.
|
|
57
67
|
There are no required TokensPage/ComponentsPage/PatternsPage/CompositionPage
|
|
58
68
|
files, and no separate project browser app to implement or rebuild.
|
|
59
69
|
|
|
60
|
-
The
|
|
61
|
-
|
|
70
|
+
The `tokens/Color.ads.scenario.tsx` and `tokens/SpaceTypeMotion.ads.scenario.tsx`
|
|
71
|
+
groups and their colocated fixtures visually demonstrate all starter token values,
|
|
72
|
+
one tile per token with its current value. The fixture owns `{ token, property, probe }` bindings;
|
|
62
73
|
the development-only `TokenPreview` renderer, exported through `@ds/review`, owns their presentation and applies the real CSS
|
|
63
74
|
variables. Add/remove samples alongside token definitions. `ads check` rejects
|
|
64
75
|
missing coverage and invented names; the App verifies the declared CSS bindings
|
|
@@ -1,29 +1,36 @@
|
|
|
1
1
|
# Project branding
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
The starter's placeholder artwork. Replace each file with the product's own and keep this
|
|
4
|
+
table current: `ads check` warns about artwork that is undescribed, unlicensed, unused or
|
|
5
|
+
missing from the brand scenario (`tokens/Brand.ads.scenario.tsx`).
|
|
6
|
+
|
|
7
|
+
| File | Use | Backgrounds |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| `logo.svg` | Logo in the UI (`components/Content/Logo`), light theme | Light surfaces |
|
|
10
|
+
| `logo.dark.svg` | The same logo for the dark theme | Dark surfaces |
|
|
11
|
+
| `app-icon.svg` | Master for web icons (`assets.iconSource`) and any `assets.targets` | Any; it has its own fill and padding |
|
|
12
|
+
|
|
13
|
+
License: placeholder artwork made for the ADS starter, free to use, change or remove
|
|
14
|
+
(MIT, like ADS). Record the real artwork's credits and license here when it replaces this.
|
|
15
|
+
|
|
16
|
+
## How branding works
|
|
6
17
|
|
|
7
18
|
UI branding uses the project-owned shared roles in `tokens/`: change values such as
|
|
8
19
|
`--accent`, `--font-sans`, and `--radius-md`. Components own `--ds-*` variables;
|
|
9
20
|
patterns and development review helpers own `--ux-*`; the showcase owns
|
|
10
|
-
`--showcase-*`. Do not introduce a
|
|
11
|
-
|
|
21
|
+
`--showcase-*`. Do not introduce a brand-prefixed token vocabulary or override
|
|
22
|
+
component state variables.
|
|
23
|
+
|
|
24
|
+
Name a dark-theme variant `<name>.dark.svg`; the component showing the artwork renders
|
|
25
|
+
both and the theme picks one. Fixed colors belong inside the artwork only.
|
|
12
26
|
|
|
13
27
|
Put licensed font files in `assets/fonts/` and their declarations in
|
|
14
28
|
`tokens/fonts.css`. Keep that optional import first in `styles.css`.
|
|
15
29
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
After `ads init`, the normal npm or Bun build generates `favicon.svg`,
|
|
24
|
-
`favicon.ico` (16/32/48), `apple-touch-icon.png` (180), `icon-192.png`, and
|
|
25
|
-
`icon-512.png` in ignored `.ds/assets/`. Run `ads assets` to regenerate manually.
|
|
26
|
-
Outputs retain the artwork's colors and transparent background; provide an
|
|
27
|
-
appropriate source background if a platform needs one. Mount this directory
|
|
28
|
-
through the application's existing bundler and keep app manifest metadata in
|
|
29
|
-
the application. Edit the original SVG, never generated variants.
|
|
30
|
+
`assets.iconSource` (here `assets/brand/app-icon.svg`) makes every build generate
|
|
31
|
+
`favicon.svg`, `favicon.ico` (16/32/48), `apple-touch-icon.png` (180), `icon-192.png` and
|
|
32
|
+
`icon-512.png` in ignored `.ds/assets/`; mount that folder through the application's
|
|
33
|
+
bundler and keep the manifest in the application. Native launchers, tray icons and
|
|
34
|
+
upload exports are committed `assets.targets` (PNG, ICO, ICNS or SVG copies), kept
|
|
35
|
+
fresh by `ads assets` and checked by `ads check`. Edit the masters here, never
|
|
36
|
+
generated files. See the [branding guide](https://github.com/reqvire-org/ads/blob/main/skills/ads-designer/references/branding.md).
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 40" role="img" aria-label="Starter">
|
|
2
|
+
<rect x="2" y="4" width="32" height="32" rx="8" fill="#fb7185"/>
|
|
3
|
+
<circle cx="18" cy="20" r="7" fill="#17191e"/>
|
|
4
|
+
<rect x="46" y="12" width="68" height="7" rx="3.5" fill="#f8fafc"/>
|
|
5
|
+
<rect x="46" y="24" width="44" height="5" rx="2.5" fill="#94a3b8"/>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 40" role="img" aria-label="Starter">
|
|
2
|
+
<rect x="2" y="4" width="32" height="32" rx="8" fill="#c62648"/>
|
|
3
|
+
<circle cx="18" cy="20" r="7" fill="#ffffff"/>
|
|
4
|
+
<rect x="46" y="12" width="68" height="7" rx="3.5" fill="#1e293b"/>
|
|
5
|
+
<rect x="46" y="24" width="44" height="5" rx="2.5" fill="#64748b"/>
|
|
6
|
+
</svg>
|
|
@@ -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 @@
|
|
|
1
|
+
export const fixture = { title: "Logo", label: "Starter" } as const;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Logo } from "@ds";
|
|
2
|
+
import { DemoFrame } from "@ds/review";
|
|
3
|
+
import { fixture } from "./Logo.ads.fixture";
|
|
4
|
+
export const scenario = { title: fixture.title, covers: ["Logo"] };
|
|
5
|
+
export default function Scenario() {
|
|
6
|
+
return (
|
|
7
|
+
<DemoFrame>
|
|
8
|
+
<Logo label={fixture.label} />
|
|
9
|
+
<Logo label={fixture.label} size="large" />
|
|
10
|
+
</DemoFrame>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { css, cx } from "@linaria/atomic";
|
|
2
|
+
import logo from "../../../assets/brand/logo.svg?url";
|
|
3
|
+
import logoDark from "../../../assets/brand/logo.dark.svg?url";
|
|
4
|
+
|
|
5
|
+
export interface LogoProps {
|
|
6
|
+
/** The product name, read by assistive technology. */
|
|
7
|
+
label: string;
|
|
8
|
+
size?: "small" | "large";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const base = css`
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
`;
|
|
15
|
+
const sizes = {
|
|
16
|
+
small: css`height: var(--space-12);`,
|
|
17
|
+
large: css`height: calc(var(--space-16) * 2);`,
|
|
18
|
+
};
|
|
19
|
+
const image = css`
|
|
20
|
+
display: block;
|
|
21
|
+
height: 100%;
|
|
22
|
+
width: auto;
|
|
23
|
+
`;
|
|
24
|
+
// Both variants are in the page; the theme shows one, so switching needs no script.
|
|
25
|
+
const light = css`
|
|
26
|
+
:root[data-theme="dark"] & { display: none; }
|
|
27
|
+
`;
|
|
28
|
+
const dark = css`
|
|
29
|
+
display: none;
|
|
30
|
+
:root[data-theme="dark"] & { display: block; }
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
/** The product logo, in its light- or dark-theme artwork. */
|
|
34
|
+
export function Logo({ label, size = "small" }: LogoProps) {
|
|
35
|
+
return (
|
|
36
|
+
<span className={cx("ds-logo", base, sizes[size])} role="img" aria-label={label}>
|
|
37
|
+
<img className={cx(image, light)} src={logo} alt="" />
|
|
38
|
+
<img className={cx(image, dark)} src={logoDark} alt="" />
|
|
39
|
+
</span>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Logo
|
|
2
|
+
|
|
3
|
+
The product logo from `assets/brand/`: `logo.svg` in the light theme and `logo.dark.svg`
|
|
4
|
+
in the dark theme. Both images are in the page and the theme shows one, so switching
|
|
5
|
+
themes needs no script. `label` is the accessible name.
|
|
6
|
+
|
|
7
|
+
| Prop | Type | Default |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| `label` | `string` | — |
|
|
10
|
+
| `size` | `"small" \| "large"` | `"small"` |
|
|
@@ -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
|
+
}
|
package/dist/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.fixture.ts
ADDED
|
@@ -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;
|
package/dist/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.scenario.tsx
ADDED
|
@@ -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,8 @@
|
|
|
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 { Logo, type LogoProps } from "./components/Content/Logo/Logo";
|
|
7
|
+
export { TextField, type TextFieldProps } from "./components/Forms/TextField/TextField";
|
|
8
|
+
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
|
+
}
|