@reqvire-org/ads 0.3.42 → 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 +6 -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/init.mjs +15 -7
- package/dist/mcp/showcase-host.mjs +5 -1
- package/dist/preview-builder.mjs +8 -2
- package/dist/skills/ads-break-ui/SKILL.md +2 -2
- 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 +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/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/docs/ADS.md +7 -7
- package/docs/ARCHITECTURE.md +3 -2
- package/docs/CHANGELOG.md +33 -12
- package/docs/GUIDE.md +16 -14
- 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
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { css } from "@linaria/atomic";
|
|
3
|
+
|
|
4
|
+
export interface ScreenFrameProps { title: string; description?: string; children?: ReactNode; }
|
|
5
|
+
|
|
6
|
+
const frame = css`
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
gap: var(--space-8);
|
|
10
|
+
max-width: calc(var(--space-16) * 20);
|
|
11
|
+
padding: var(--space-12);
|
|
12
|
+
`;
|
|
13
|
+
const heading = css`
|
|
14
|
+
margin: 0;
|
|
15
|
+
font-size: var(--text-xl);
|
|
16
|
+
font-weight: var(--weight-semibold);
|
|
17
|
+
line-height: var(--leading-tight);
|
|
18
|
+
color: var(--text-strong);
|
|
19
|
+
`;
|
|
20
|
+
const lead = css`
|
|
21
|
+
margin: 0;
|
|
22
|
+
color: var(--text-muted);
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
/** Development-only page framing for composition scenarios: a heading and the page width. */
|
|
26
|
+
export function ScreenFrame({ title, description, children }: ScreenFrameProps) {
|
|
27
|
+
return (
|
|
28
|
+
<main className={frame}>
|
|
29
|
+
<h1 className={heading}>{title}</h1>
|
|
30
|
+
{description ? <p className={lead}>{description}</p> : null}
|
|
31
|
+
{children}
|
|
32
|
+
</main>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -1,31 +1,119 @@
|
|
|
1
|
-
import { useLayoutEffect, useRef } from "react";
|
|
1
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
2
2
|
import { css, cx } from "@linaria/atomic";
|
|
3
3
|
|
|
4
4
|
export interface TokenSample { token: `--${string}`; property: string; }
|
|
5
5
|
export interface TokenPreviewProps { title: string; samples: readonly TokenSample[]; text: string; }
|
|
6
|
+
|
|
7
|
+
const grid = css`
|
|
8
|
+
display: grid;
|
|
9
|
+
grid-template-columns: repeat(auto-fill, minmax(calc(var(--space-8) * 10), 1fr));
|
|
10
|
+
gap: var(--space-8);
|
|
11
|
+
padding: var(--space-8);
|
|
12
|
+
`;
|
|
13
|
+
const heading = css`
|
|
14
|
+
grid-column: 1 / -1;
|
|
15
|
+
margin: 0;
|
|
16
|
+
font-size: var(--text-base);
|
|
17
|
+
font-weight: var(--weight-semibold);
|
|
18
|
+
color: var(--text-body);
|
|
19
|
+
`;
|
|
20
|
+
const tile = css`
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
gap: var(--space-4);
|
|
24
|
+
padding: var(--space-8);
|
|
25
|
+
border: var(--border-w) solid var(--border-default);
|
|
26
|
+
border-radius: var(--radius-md);
|
|
27
|
+
background: var(--bg-surface);
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
`;
|
|
30
|
+
const label = css`
|
|
31
|
+
font-size: var(--text-sm);
|
|
32
|
+
color: var(--text-muted);
|
|
33
|
+
overflow-wrap: anywhere;
|
|
34
|
+
`;
|
|
35
|
+
// Each sample shows its token through the property it styles: colors as swatches, lengths as
|
|
36
|
+
// bars, radius as a shape, type as text.
|
|
6
37
|
const sampleStyle = css`
|
|
7
|
-
display:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
&[data-ads-property="
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
&[data-ads-property="
|
|
38
|
+
display: block;
|
|
39
|
+
min-height: calc(var(--space-8) * 2);
|
|
40
|
+
color: var(--text-body);
|
|
41
|
+
font-size: var(--text-base);
|
|
42
|
+
&[data-ads-property="background-color"] {
|
|
43
|
+
border: var(--border-w) solid var(--border-default);
|
|
44
|
+
border-radius: var(--radius-md);
|
|
45
|
+
background-color: var(--ux-token-preview-value);
|
|
46
|
+
}
|
|
47
|
+
&[data-ads-property="color"] { color: var(--ux-token-preview-value); font-size: calc(var(--text-base) * 2); line-height: 1; }
|
|
48
|
+
&[data-ads-property="width"] {
|
|
49
|
+
width: var(--ux-token-preview-value);
|
|
50
|
+
min-height: var(--space-8);
|
|
51
|
+
background: var(--accent);
|
|
52
|
+
}
|
|
53
|
+
&[data-ads-property="border-radius"] {
|
|
54
|
+
width: calc(var(--space-8) * 3);
|
|
55
|
+
border: var(--focus-w) solid var(--accent);
|
|
56
|
+
border-radius: var(--ux-token-preview-value);
|
|
57
|
+
}
|
|
58
|
+
&[data-ads-property="font-family"] { font-family: var(--ux-token-preview-value); font-size: calc(var(--text-base) * 2); line-height: 1; }
|
|
17
59
|
&[data-ads-property="font-size"] { font-size: var(--ux-token-preview-value); }
|
|
18
|
-
&[data-ads-property="font-weight"] { font-weight: var(--ux-token-preview-value); }
|
|
60
|
+
&[data-ads-property="font-weight"] { font-weight: var(--ux-token-preview-value); font-size: calc(var(--text-base) * 2); line-height: 1; }
|
|
19
61
|
&[data-ads-property="line-height"] { line-height: var(--ux-token-preview-value); }
|
|
20
|
-
&[data-ads-property="
|
|
21
|
-
|
|
62
|
+
&[data-ads-property="box-shadow"] {
|
|
63
|
+
border-radius: var(--radius-md);
|
|
64
|
+
background: var(--bg-surface);
|
|
65
|
+
box-shadow: var(--ux-token-preview-value);
|
|
66
|
+
}
|
|
67
|
+
/* Durations and easing move a dot across the tile. */
|
|
68
|
+
&[data-ads-property="animation-duration"], &[data-ads-property="animation-timing-function"] {
|
|
69
|
+
width: var(--space-8);
|
|
70
|
+
border-radius: 50%;
|
|
71
|
+
background: var(--accent);
|
|
72
|
+
animation-name: ux-token-preview-travel;
|
|
73
|
+
animation-iteration-count: infinite;
|
|
74
|
+
animation-direction: alternate;
|
|
75
|
+
}
|
|
76
|
+
&[data-ads-property="animation-duration"] {
|
|
77
|
+
animation-duration: calc(var(--ux-token-preview-value) * 8);
|
|
78
|
+
animation-timing-function: var(--ease-standard);
|
|
79
|
+
}
|
|
80
|
+
&[data-ads-property="animation-timing-function"] {
|
|
81
|
+
animation-duration: calc(var(--dur-normal) * 6);
|
|
82
|
+
animation-timing-function: var(--ux-token-preview-value);
|
|
83
|
+
}
|
|
84
|
+
&[data-ads-property="z-index"] { z-index: var(--ux-token-preview-value); position: relative; }
|
|
85
|
+
@keyframes ux-token-preview-travel { to { transform: translateX(calc(var(--space-8) * 6)); } }
|
|
22
86
|
`;
|
|
23
|
-
|
|
87
|
+
|
|
88
|
+
function TokenTile({ sample, text }: { sample: TokenSample; text: string }) {
|
|
24
89
|
const ref = useRef<HTMLSpanElement>(null);
|
|
25
|
-
|
|
26
|
-
|
|
90
|
+
const [value, setValue] = useState("");
|
|
91
|
+
useLayoutEffect(() => {
|
|
92
|
+
ref.current?.style.setProperty("--ux-token-preview-value", `var(${sample.token})`);
|
|
93
|
+
// The value as the page computes it now, again when the theme changes.
|
|
94
|
+
const read = () => setValue(getComputedStyle(document.documentElement).getPropertyValue(sample.token).trim());
|
|
95
|
+
read();
|
|
96
|
+
const observer = new MutationObserver(read);
|
|
97
|
+
observer.observe(document.documentElement, { attributes: true, attributeFilter: ["data-theme"] });
|
|
98
|
+
return () => observer.disconnect();
|
|
99
|
+
}, [sample.token]);
|
|
100
|
+
return (
|
|
101
|
+
<article className={cx("ux-token-preview__item", tile)}>
|
|
102
|
+
<span ref={ref} className={cx("ux-token-preview__sample", sampleStyle)} data-ads-token={sample.token} data-ads-property={sample.property}>
|
|
103
|
+
{["background-color", "width", "border-radius", "box-shadow", "animation-duration", "animation-timing-function"].includes(sample.property) ? "" : text}
|
|
104
|
+
</span>
|
|
105
|
+
<code className={cx("ux-token-preview__name", label)}>{sample.token}</code>
|
|
106
|
+
<small className={label}>{value}</small>
|
|
107
|
+
</article>
|
|
108
|
+
);
|
|
27
109
|
}
|
|
28
|
-
|
|
110
|
+
|
|
111
|
+
/** Project-owned review UI: one tile per token. Values always come from the real foundation CSS. */
|
|
29
112
|
export function TokenPreview({ title, samples, text }: TokenPreviewProps) {
|
|
30
|
-
return
|
|
113
|
+
return (
|
|
114
|
+
<section aria-label={title} className={cx("ux-token-preview", grid)}>
|
|
115
|
+
<h1 className={heading}>{title}</h1>
|
|
116
|
+
{samples.map(sample => <TokenTile key={`${sample.token}:${sample.property}`} sample={sample} text={text} />)}
|
|
117
|
+
</section>
|
|
118
|
+
);
|
|
31
119
|
}
|
package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Color.ads.fixture.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const fixture = {
|
|
2
|
+
"title": "Color",
|
|
3
|
+
"text": "Aa",
|
|
4
|
+
samples: [
|
|
5
|
+
{"token": "--accent", "property": "background-color", "probe": "rgb(31, 97, 163)"},
|
|
6
|
+
{"token": "--accent-fg", "property": "background-color", "probe": "rgb(31, 97, 163)"},
|
|
7
|
+
{"token": "--accent-hover", "property": "background-color", "probe": "rgb(31, 97, 163)"},
|
|
8
|
+
{"token": "--bg-canvas", "property": "background-color", "probe": "rgb(31, 97, 163)"},
|
|
9
|
+
{"token": "--bg-hover", "property": "background-color", "probe": "rgb(31, 97, 163)"},
|
|
10
|
+
{"token": "--bg-surface", "property": "background-color", "probe": "rgb(31, 97, 163)"},
|
|
11
|
+
{"token": "--border-default", "property": "background-color", "probe": "rgb(31, 97, 163)"},
|
|
12
|
+
{"token": "--border-focus", "property": "background-color", "probe": "rgb(31, 97, 163)"},
|
|
13
|
+
{"token": "--text-body", "property": "color", "probe": "rgb(31, 97, 163)"},
|
|
14
|
+
{"token": "--text-inverse", "property": "color", "probe": "rgb(31, 97, 163)"},
|
|
15
|
+
{"token": "--text-muted", "property": "color", "probe": "rgb(31, 97, 163)"},
|
|
16
|
+
{"token": "--text-strong", "property": "color", "probe": "rgb(31, 97, 163)"},
|
|
17
|
+
]
|
|
18
|
+
} as const;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { TokenPreview } from "@ds/review";
|
|
2
|
-
import { fixture } from "./
|
|
2
|
+
import { fixture } from "./Color.ads.fixture";
|
|
3
3
|
export const scenario = { title: fixture.title, covers: ["TokenPreview"], samples: fixture.samples };
|
|
4
4
|
export default function Scenario() { return <TokenPreview {...fixture} />; }
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
export const fixture = {
|
|
2
|
-
"title": "
|
|
2
|
+
"title": "Space, type & motion",
|
|
3
3
|
"text": "Aa",
|
|
4
4
|
samples: [
|
|
5
|
-
{"token": "--accent", "property": "background-color", "probe": "rgb(31, 97, 163)"},
|
|
6
|
-
{"token": "--accent-fg", "property": "background-color", "probe": "rgb(31, 97, 163)"},
|
|
7
|
-
{"token": "--accent-hover", "property": "background-color", "probe": "rgb(31, 97, 163)"},
|
|
8
|
-
{"token": "--bg-canvas", "property": "background-color", "probe": "rgb(31, 97, 163)"},
|
|
9
|
-
{"token": "--bg-hover", "property": "background-color", "probe": "rgb(31, 97, 163)"},
|
|
10
|
-
{"token": "--bg-surface", "property": "background-color", "probe": "rgb(31, 97, 163)"},
|
|
11
|
-
{"token": "--border-default", "property": "background-color", "probe": "rgb(31, 97, 163)"},
|
|
12
|
-
{"token": "--border-focus", "property": "background-color", "probe": "rgb(31, 97, 163)"},
|
|
13
5
|
{"token": "--border-w", "property": "width", "probe": "13.375px"},
|
|
14
6
|
{"token": "--dur-fast", "property": "animation-duration", "probe": "0.375s"},
|
|
15
7
|
{"token": "--dur-normal", "property": "animation-duration", "probe": "0.375s"},
|
|
@@ -33,12 +25,8 @@ export const fixture = {
|
|
|
33
25
|
{"token": "--space-6", "property": "width", "probe": "13.375px"},
|
|
34
26
|
{"token": "--space-8", "property": "width", "probe": "13.375px"},
|
|
35
27
|
{"token": "--text-base", "property": "font-size", "probe": "41.375px"},
|
|
36
|
-
{"token": "--text-body", "property": "color", "probe": "rgb(31, 97, 163)"},
|
|
37
|
-
{"token": "--text-inverse", "property": "color", "probe": "rgb(31, 97, 163)"},
|
|
38
28
|
{"token": "--text-lg", "property": "font-size", "probe": "41.375px"},
|
|
39
|
-
{"token": "--text-muted", "property": "color", "probe": "rgb(31, 97, 163)"},
|
|
40
29
|
{"token": "--text-sm", "property": "font-size", "probe": "41.375px"},
|
|
41
|
-
{"token": "--text-strong", "property": "color", "probe": "rgb(31, 97, 163)"},
|
|
42
30
|
{"token": "--text-xl", "property": "font-size", "probe": "41.375px"},
|
|
43
31
|
{"token": "--weight-medium", "property": "font-weight", "probe": "327"},
|
|
44
32
|
{"token": "--weight-normal", "property": "font-weight", "probe": "327"},
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TokenPreview } from "@ds/review";
|
|
2
|
+
import { fixture } from "./SpaceTypeMotion.ads.fixture";
|
|
3
|
+
export const scenario = { title: fixture.title, covers: ["TokenPreview"], samples: fixture.samples };
|
|
4
|
+
export default function Scenario() { return <TokenPreview {...fixture} />; }
|