@reqvire-org/ads 0.3.43 → 0.3.45
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 +32 -10
- package/dist/assets.mjs +49 -3
- package/dist/brand-assets.mjs +174 -7
- package/dist/check.mjs +4 -2
- package/dist/cli.mjs +21 -9
- package/dist/config.mjs +60 -3
- package/dist/create.mjs +48 -0
- package/dist/image-size.mjs +28 -0
- package/dist/index.mjs +1 -0
- package/dist/init.mjs +2 -2
- package/dist/mcp/server.mjs +3 -1
- package/dist/mcp/skills.mjs +1 -1
- package/dist/preview-bun.mjs +4 -2
- package/dist/scenario-groups.mjs +2 -2
- package/dist/scenario-registry.mjs +3 -3
- package/dist/scenarios-compiler.mjs +1 -1
- package/dist/scenarios.mjs +4 -2
- package/dist/showcase/client.bundle.js +22 -22
- package/dist/showcase/draft-navigation.js +1 -1
- package/dist/showcase/index.html +1 -0
- package/dist/skills/ads-break-ui/SKILL.md +1 -1
- package/dist/skills/ads-designer/README.md +2 -2
- package/dist/skills/ads-designer/SKILL.md +44 -54
- package/dist/skills/ads-designer/references/branding.md +104 -0
- package/dist/skills/ads-designer/references/cli.md +5 -4
- package/dist/skills/ads-import/SKILL.md +1 -1
- package/dist/skills/ads-import/references/branding.md +13 -5
- package/dist/skills/ads-import/references/cli.md +5 -4
- package/dist/skills/ads-motion/SKILL.md +1 -1
- package/dist/skills/ads-port/SKILL.md +1 -1
- package/dist/skills/ads-port/references/cli.md +5 -4
- package/dist/{bootstrap-ds-preact → starters/preact}/ds.config.json +2 -1
- package/dist/{bootstrap-ds → starters/react}/ADS.md +2 -2
- package/dist/{bootstrap-ds → starters/react}/README.md +18 -22
- package/dist/starters/react/design-system/assets/brand/README.md +36 -0
- package/dist/starters/react/design-system/assets/brand/app-icon.svg +4 -0
- package/dist/starters/react/design-system/assets/brand/logo.dark.svg +6 -0
- package/dist/starters/react/design-system/assets/brand/logo.svg +6 -0
- package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.fixture.ts +7 -0
- package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.scenario.tsx +4 -0
- package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.fixture.ts +7 -0
- package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.scenario.tsx +4 -0
- package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.fixture.ts +1 -0
- package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.scenario.tsx +12 -0
- package/dist/starters/react/design-system/components/Content/Logo/Logo.tsx +41 -0
- package/dist/starters/react/design-system/components/Content/Logo/README.md +10 -0
- package/dist/{bootstrap-ds → starters/react}/design-system/index.ts +1 -0
- package/dist/starters/react/design-system/review/brand-preview/BrandPreview.tsx +115 -0
- package/dist/{bootstrap-ds → starters/react}/design-system/review/index.ts +1 -0
- package/dist/{skills/ads-designer/assets/bootstrap-ds → starters/react}/ds.config.json +2 -1
- package/dist/{bootstrap-ds → starters/react}/tsconfig.build.json +2 -1
- package/dist/task-cache.mjs +1 -1
- package/dist/token-fixtures.mjs +1 -1
- package/dist/units.mjs +6 -6
- package/dist/validation.mjs +1 -1
- package/docs/ADS.md +9 -6
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/CHANGELOG.md +59 -12
- package/docs/GUIDE.md +61 -18
- package/package.json +3 -5
- package/dist/bootstrap-ds/design-system/assets/brand/README.md +0 -29
- package/dist/bootstrap-ds/ds.config.json +0 -19
- package/dist/skills/ads-designer/assets/bootstrap-ds/ADS.md +0 -258
- package/dist/skills/ads-designer/assets/bootstrap-ds/README.md +0 -120
- package/dist/skills/ads-designer/assets/bootstrap-ds/biome.css.json +0 -21
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/brand/README.md +0 -29
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/fonts/.gitkeep +0 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/Button.ads.fixture.ts +0 -1
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/Button.ads.scenario.tsx +0 -13
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/Button.tsx +0 -49
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/README.md +0 -12
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/README.md +0 -14
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/TextField.ads.fixture.ts +0 -6
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +0 -13
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/TextField.tsx +0 -57
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/Search/SearchPage/README.md +0 -4
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.fixture.ts +0 -7
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.scenario.tsx +0 -16
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/controllers/.gitkeep +0 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/index.ts +0 -7
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/README.md +0 -12
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.ads.fixture.ts +0 -1
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.ads.scenario.tsx +0 -11
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.tsx +0 -41
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/demo-frame/DemoFrame.tsx +0 -29
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/index.ts +0 -3
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/token-preview/TokenPreview.tsx +0 -119
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/showcase/mcp/index.html +0 -1
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/showcase/mcp/main.tsx +0 -8
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/styles.css +0 -5
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Color.ads.fixture.ts +0 -18
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Color.ads.scenario.tsx +0 -4
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/SpaceTypeMotion.ads.fixture.ts +0 -36
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/SpaceTypeMotion.ads.scenario.tsx +0 -4
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/base.css +0 -30
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/colors.css +0 -29
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/elevation.css +0 -15
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/spacing.css +0 -15
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/typography.css +0 -13
- package/dist/skills/ads-designer/assets/bootstrap-ds/gitignore.template +0 -8
- package/dist/skills/ads-designer/assets/bootstrap-ds/package-lock.json +0 -4660
- package/dist/skills/ads-designer/assets/bootstrap-ds/package.json +0 -42
- package/dist/skills/ads-designer/assets/bootstrap-ds/scripts/build-mcp-previews.mjs +0 -3
- package/dist/skills/ads-designer/assets/bootstrap-ds/src/vite-env.d.ts +0 -7
- package/dist/skills/ads-designer/assets/bootstrap-ds/tsconfig.build.json +0 -19
- package/dist/skills/ads-designer/assets/bootstrap-ds/tsconfig.json +0 -35
- package/dist/skills/ads-designer/assets/bootstrap-ds/vite.config.ts +0 -23
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/review/demo-frame/DemoFrame.tsx +0 -29
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/review/token-preview/TokenPreview.tsx +0 -119
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/showcase/mcp/main.tsx +0 -6
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/ds.config.json +0 -19
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/package.json +0 -38
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/src/vite-env.d.ts +0 -7
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/tsconfig.json +0 -36
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/vite.config.ts +0 -23
- /package/dist/{bootstrap-ds-preact → starters/preact}/design-system/review/demo-frame/DemoFrame.tsx +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/design-system/review/screen-frame/ScreenFrame.tsx +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/design-system/review/token-preview/TokenPreview.tsx +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/design-system/showcase/mcp/main.tsx +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/package.json +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/src/vite-env.d.ts +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/tsconfig.json +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/vite.config.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/biome.css.json +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/assets/fonts/.gitkeep +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Actions/Button/Button.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Actions/Button/Button.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Actions/Button/Button.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Actions/Button/README.md +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Forms/TextField/README.md +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Forms/TextField/TextField.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Forms/TextField/TextField.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/composition/Search/SearchPage/README.md +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/composition/Search/SearchPage/SearchPage.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/composition/Search/SearchPage/SearchPage.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/controllers/.gitkeep +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/patterns/Search/SearchBar/README.md +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/patterns/Search/SearchBar/SearchBar.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/patterns/Search/SearchBar/SearchBar.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/patterns/Search/SearchBar/SearchBar.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/review/demo-frame/DemoFrame.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/review/screen-frame/ScreenFrame.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/review/token-preview/TokenPreview.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/showcase/mcp/index.html +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/showcase/mcp/main.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/styles.css +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/Color.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/Color.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/SpaceTypeMotion.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/SpaceTypeMotion.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/base.css +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/colors.css +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/elevation.css +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/spacing.css +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/typography.css +0 -0
- /package/dist/{bootstrap-ds → starters/react}/gitignore.template +0 -0
- /package/dist/{bootstrap-ds → starters/react}/package-lock.json +0 -0
- /package/dist/{bootstrap-ds → starters/react}/package.json +0 -0
- /package/dist/{bootstrap-ds → starters/react}/scripts/build-mcp-previews.mjs +0 -0
- /package/dist/{bootstrap-ds → starters/react}/src/vite-env.d.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/tsconfig.json +0 -0
- /package/dist/{bootstrap-ds → starters/react}/vite.config.ts +0 -0
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"framework": "react",
|
|
3
|
-
"behaviorLibraries": [],
|
|
4
|
-
"acceptance": { "checks": [], "behaviorChecks": false },
|
|
5
|
-
"validation": { "checks": [], "behaviorChecks": true, "inputs": [] },
|
|
6
|
-
"mcp": {
|
|
7
|
-
"previewManifest": ".ds/preview/manifest.json"
|
|
8
|
-
},
|
|
9
|
-
"boundaries": {
|
|
10
|
-
"styleWrites": [
|
|
11
|
-
{
|
|
12
|
-
"file": "design-system/review/token-preview/TokenPreview.tsx",
|
|
13
|
-
"properties": [
|
|
14
|
-
"--ux-token-preview-value"
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
]
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
# Design-system contract
|
|
2
|
-
|
|
3
|
-
This is the local contract for the copied starter. The project owns its source,
|
|
4
|
-
token values, and branding. Tool updates preserve those values and customized
|
|
5
|
-
code; source and theme imports are explicit operations.
|
|
6
|
-
|
|
7
|
-
For the architectural rationale, see the
|
|
8
|
-
[ADS architecture](https://github.com/reqvire-org/ads/blob/main/docs/ARCHITECTURE.md).
|
|
9
|
-
The rules and commands needed to use this starter are included locally.
|
|
10
|
-
|
|
11
|
-
## Ownership
|
|
12
|
-
|
|
13
|
-
| Layer | Owns | Location |
|
|
14
|
-
|-------|------|----------|
|
|
15
|
-
| Tokens | Colors, typography, spacing, radii, motion, elevation | `tokens/` |
|
|
16
|
-
| Primitives | Generic controls, states, interaction and accessibility | `components/` |
|
|
17
|
-
| Patterns | Reusable layout and composition | `patterns/` |
|
|
18
|
-
| Scenarios | Colocated development entries and inputs | Beside their owner; larger entries in `composition/` |
|
|
19
|
-
| Showcase host | Navigation and MCP client | Packaged ADS tooling |
|
|
20
|
-
| Preview compiler adapter | Framework mount/unmount and foundation imports | `showcase/mcp/` |
|
|
21
|
-
| Application | Domain data, routing, effects and callbacks | Consuming application |
|
|
22
|
-
|
|
23
|
-
The starter declares React in `ds.config.json`. Keep that choice, JSX, runtime
|
|
24
|
-
dependencies and the preview mount adapter consistent. Init records a choice for
|
|
25
|
-
an unconfigured project; it does not convert copied React source to Preact.
|
|
26
|
-
|
|
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.
|
|
29
|
-
Keep the ADS in root `design-system/`, beside application `src/`.
|
|
30
|
-
Keep public exports in `design-system/index.ts`; consumers use its `@ds` alias.
|
|
31
|
-
`styles.css` is the foundation CSS entry and contains token imports only.
|
|
32
|
-
|
|
33
|
-
## Visual and interaction policy
|
|
34
|
-
|
|
35
|
-
Use semantic CSS tokens for visual values. Raw values belong in the token files.
|
|
36
|
-
Projects sharing this ADS use the same token names, meanings, and value types;
|
|
37
|
-
their concrete values and theme overrides can differ. Reuse existing local values
|
|
38
|
-
when importing components/patterns. Existing font, text, spacing and other roles
|
|
39
|
-
take precedence over divergent upstream constants. Add genuinely missing shared
|
|
40
|
-
decisions, and import source token values only when adopting that theme is requested.
|
|
41
|
-
Shared token names and prefixes follow the ADS contract. All design values live
|
|
42
|
-
in the shared foundation; reuse meaningful project roles before adding new ones.
|
|
43
|
-
Components own `--ds-*` mappings and runtime mechanics, patterns own `--ux-*`, and
|
|
44
|
-
the showcase owns `--showcase-*`. These variables consume shared Data; they do
|
|
45
|
-
not create independent token catalogues. Private value sheets and namespace
|
|
46
|
-
registrations are not supported. Shared token files cannot assign runtime state
|
|
47
|
-
variables. Every shared token needs a real sample in a shared token scenario.
|
|
48
|
-
|
|
49
|
-
Foundation roles are enforced by `foundation-role`, `foundation-selector` and
|
|
50
|
-
`foundation-import`, alongside the regular token checks. Shared definitions
|
|
51
|
-
belong on the document root or explicit root themes; ordinary declarations belong
|
|
52
|
-
in `base.css`, and font-face descriptors in optional `fonts.css`. The entry imports
|
|
53
|
-
canonical sheets; those sheets cannot import another styling layer. Component
|
|
54
|
-
classes, IDs, data/ARIA hooks, contextual selectors, keyframes and scoped UI rules
|
|
55
|
-
are rejected in the foundation, including nested functional selectors. Raw visual
|
|
56
|
-
values and undefined token references are checked in native defaults too; literal
|
|
57
|
-
font-face metadata keeps its separate asset role.
|
|
58
|
-
|
|
59
|
-
`base.css` has three closed roles:
|
|
60
|
-
|
|
61
|
-
- Document defaults: root/body typography, canvas colors and theme behavior,
|
|
62
|
-
global text selection and document scrollbars.
|
|
63
|
-
- Native resets: permitted normalization properties and values, such as zero
|
|
64
|
-
spacing, inherited control typography, list resets and responsive replaced media.
|
|
65
|
-
- Global accessibility: universal `:focus-visible` outline rules, and reduced-motion
|
|
66
|
-
overrides inside `@media (prefers-reduced-motion: reduce)`.
|
|
67
|
-
|
|
68
|
-
The `foundation-role` check validates every selector branch, property and value.
|
|
69
|
-
Native selectors are not a bypass: token-backed button backgrounds, flex/grid
|
|
70
|
-
layout, component-specific focus rules and hover/disabled skins are rejected.
|
|
71
|
-
Shared token definitions belong in value sheets, not `base.css`. No project token
|
|
72
|
-
names are embedded in this policy. A zero-specificity `:where()` wrapper does not
|
|
73
|
-
change ownership. Put component design and animation in Linaria owners, and
|
|
74
|
-
scenario layout variations in typed review-helper props. Browser review
|
|
75
|
-
still checks the effects and accessibility of permitted defaults.
|
|
76
|
-
|
|
77
|
-
Own primitive markup, focus, hover, selected, disabled, loading, and motion in
|
|
78
|
-
the primitive. Use typed props for variations. Keep reusable structure and skin
|
|
79
|
-
in colocated Linaria blocks using `css` and `cx` from `@linaria/atomic`.
|
|
80
|
-
Linaria is required for component and pattern styling. This starter already
|
|
81
|
-
configures extraction in both builds; `ads init` does not install or configure it.
|
|
82
|
-
|
|
83
|
-
Use `ads-*` classes and `--ds-*` variables for primitives, and `ux-*` for patterns,
|
|
84
|
-
including the ADS-owned frame. Scenario files define no CSS or custom
|
|
85
|
-
class names and must not target component internals. Avoid inline visual styles and arbitrary visual
|
|
86
|
-
string props. Omit `style` from inherited DOM prop types. Document narrow measured
|
|
87
|
-
geometry exceptions if a component needs them.
|
|
88
|
-
|
|
89
|
-
Use semantic HTML and test relevant keyboard/focus behavior. Motion should
|
|
90
|
-
consume duration/easing tokens and respect reduced motion. Brand changes belong
|
|
91
|
-
in tokens or documented component hooks. The starter uses system fonts and has
|
|
92
|
-
no icon component; add a shared icon primitive when it is needed.
|
|
93
|
-
|
|
94
|
-
## Showcase
|
|
95
|
-
|
|
96
|
-
The showcase is a minimal shell plus an MCP client and Apps host, shipped with
|
|
97
|
-
ADS tooling. It discovers token/component/pattern/composition
|
|
98
|
-
scenarios from MCP tool results, invokes preview tools and responds to resource
|
|
99
|
-
notifications. The project does not author a second catalogue or browser app.
|
|
100
|
-
|
|
101
|
-
`ads mcp` starts the loopback website alongside stdio. Open the URL returned by
|
|
102
|
-
`ads_status`. Without an agent connection, `ads showcase` starts the same runtime
|
|
103
|
-
for browser use. Both transports share one configured preview compiler.
|
|
104
|
-
|
|
105
|
-
The shell owns section tabs, collapsible navigation, theme controls and the App
|
|
106
|
-
slot. Components, patterns, token values, scenarios, fixtures and their Linaria
|
|
107
|
-
styles remain project-owned. Only the sandboxed App loads and applies project
|
|
108
|
-
runtime, CSS and fonts, through MCP resources. App presentation comes from the
|
|
109
|
-
selected compiled scenario; reusable review layouts live in development-only `review/` through its separate public entry. Do not recreate
|
|
110
|
-
production widgets inside the client or scenario.
|
|
111
|
-
|
|
112
|
-
There are four sections: Tokens, Components, Patterns and Composition. There are
|
|
113
|
-
no required `TokensPage`/`ComponentsPage`/`PatternsPage`/`CompositionPage` files.
|
|
114
|
-
Legacy custom browsing pages remain checked when present, but new projects use
|
|
115
|
-
the built-in client. Its tooling CSS is separate from the project style contract.
|
|
116
|
-
|
|
117
|
-
The shared resource compiler builds one graph for all discovered scenarios on
|
|
118
|
-
first demand. Selections reuse the App and load their dependency closure. The
|
|
119
|
-
project's `mountScenario(Scenario, container)` adapter returns an unmount callback
|
|
120
|
-
that releases owned roots, listeners, timers, portals and workers. Switching or
|
|
121
|
-
rebuilding a scenario resets its state while retaining unchanged shared modules.
|
|
122
|
-
Host context selects the project theme; it does not replace the project's skin.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
Colocate development entries and fixture inputs:
|
|
126
|
-
|
|
127
|
-
```text
|
|
128
|
-
design-system/
|
|
129
|
-
tokens/
|
|
130
|
-
typography.css
|
|
131
|
-
Typography.ads.scenario.tsx
|
|
132
|
-
Typography.ads.fixture.ts
|
|
133
|
-
components/core/Button/
|
|
134
|
-
Button.tsx
|
|
135
|
-
Button.ads.scenario.tsx
|
|
136
|
-
Button.ads.fixture.ts
|
|
137
|
-
patterns/Editor/
|
|
138
|
-
Editor.tsx
|
|
139
|
-
Editor.ads.scenario.tsx
|
|
140
|
-
Editor.ads.fixture.ts
|
|
141
|
-
composition/Workspace/
|
|
142
|
-
Workspace.ads.scenario.tsx
|
|
143
|
-
Workspace.ads.fixture.ts
|
|
144
|
-
showcase/mcp/ Project compiler adapter
|
|
145
|
-
main.tsx
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
Use `<Owner>.ads.scenario.tsx` and `<Owner>.ads.fixture.ts` for new entries.
|
|
149
|
-
The scenario exports a default independently mountable view and literal metadata
|
|
150
|
-
`export const scenario = { title: "Button states", covers: ["Button"] };`.
|
|
151
|
-
Token entries under the configured token directory declare
|
|
152
|
-
`export const scenario = { title: fixture.title, covers: ["TokenSamples"], samples: fixture.samples };`.
|
|
153
|
-
`TokenSamples` is any project-owned development-only review renderer, not a required name.
|
|
154
|
-
Its colocated fixture declares literal `samples: [{ token, property, probe }]`.
|
|
155
|
-
Each token must exist and have sample coverage; duplicate bindings, missing probes,
|
|
156
|
-
empty covers and value-only inspectors fail. The default entry passes the declared
|
|
157
|
-
samples to a rendered public review renderer's `samples` prop. No token-name/property mapping
|
|
158
|
-
or sample values are embedded in the tool. Display values come from foundation CSS;
|
|
159
|
-
probes are isolated verification inputs owned by the fixture.
|
|
160
|
-
|
|
161
|
-
The renderer marks the actual styled element with `data-ads-token` and
|
|
162
|
-
`data-ads-property`. In a browser, the App validates the declared property/value and
|
|
163
|
-
probe using `CSS.supports`, checks the sample is rendered, then temporarily changes
|
|
164
|
-
that token to its fixture probe. Its computed sample property must respond. Values
|
|
165
|
-
are restored before yielding to painting; hardcoded lookalikes fail. Source gates
|
|
166
|
-
prove the contract structure, not successful rendering. The browser check covers
|
|
167
|
-
the mounted scenario and theme; visual quality and other states still need review.
|
|
168
|
-
|
|
169
|
-
It imports real public UI through `@ds` and its local fixture. The adapter supplies
|
|
170
|
-
initial state, callbacks and simulated services. The default entry needs no
|
|
171
|
-
mandatory caller inputs or prior page initialization. Related parts may share a
|
|
172
|
-
scenario containing their required public parent. Larger composition scenarios
|
|
173
|
-
reuse production screen patterns; that screen reuse remains skill guidance.
|
|
174
|
-
|
|
175
|
-
IDs derive from the ADS-relative path: `components/core/Button/Button.ads.scenario.tsx` and
|
|
176
|
-
`components/core/Button.ads.scenario.tsx` both identify `components/core/Button`.
|
|
177
|
-
Use one form per owner. Renaming moves the ID. No manually assigned ID or parallel
|
|
178
|
-
registry is maintained. New fixture files use `<Owner>.ads.fixture.ts`; extra development
|
|
179
|
-
adapters use `<Owner>.ads.helpers.ts`. An empty fixture is valid without inputs.
|
|
180
|
-
Keep all `.ads.` files outside production imports and exports.
|
|
181
|
-
|
|
182
|
-
`scenario-contract`, `scenario-render` and `scenario-coverage` checks require valid
|
|
183
|
-
entries and reachable public render references for every public renderable
|
|
184
|
-
component/pattern, including unused exports and Linaria styled exports. Types, constants and utility functions
|
|
185
|
-
are excluded. Coverage is a static source policy; it does not prove runtime
|
|
186
|
-
mounting, correct props, every branch/state or visual parity. The older
|
|
187
|
-
`showcase-coverage` policy also checks application render references.
|
|
188
|
-
|
|
189
|
-
`token-scenario-reference` rejects undeclared token names in metadata and reachable
|
|
190
|
-
inputs. `token-scenario-render` rejects claimed tokens with no reachable input
|
|
191
|
-
reference; `token-scenario-coverage` requires every discovered shared token
|
|
192
|
-
to have coverage. A new or removed token therefore needs a scenario/fixture
|
|
193
|
-
update. All three are errors in `ads check`, run by `lint:ds` and the build.
|
|
194
|
-
Coverage is static reachability, not proof that every branch actually renders
|
|
195
|
-
or applies the right CSS property. Browser review still verifies the samples.
|
|
196
|
-
|
|
197
|
-
Scenarios and fixture helpers are development-only wherever colocated. Runtime
|
|
198
|
-
source and the public barrel cannot import or re-export them. Showcase/scenario
|
|
199
|
-
code defines no CSS, custom classes or standalone native controls; use public ADS
|
|
200
|
-
APIs. A single direct native child can supply semantics to a public runtime slot
|
|
201
|
-
when source tracing proves that owner clones the exact child with its own props.
|
|
202
|
-
An `asChild` flag alone is not evidence; scenario styling remains forbidden.
|
|
203
|
-
Neither ADS implementations nor scenarios import application code. Live business
|
|
204
|
-
data belongs to application adapters; ADS receives inputs or injected callbacks.
|
|
205
|
-
Direct global `fetch`, XHR, WebSocket and EventSource use is rejected. Renderer
|
|
206
|
-
workers, lazy imports and injected services remain supported; custom HTTP clients
|
|
207
|
-
and computed API access need project checks and review.
|
|
208
|
-
|
|
209
|
-
Tests may import local fixtures. Load real foundation CSS in DOM/browser tests
|
|
210
|
-
instead of assigning shared tokens in JavaScript. Full application harnesses
|
|
211
|
-
belong in application test support. Run ADS/project checks before application,
|
|
212
|
-
preview builds; review meaningful states in both themes and sizes.
|
|
213
|
-
|
|
214
|
-
## Branding
|
|
215
|
-
|
|
216
|
-
Keep original artwork, variants, usage, credits, and licenses in
|
|
217
|
-
`design-system/assets/brand/`. This starter has only guidance there, no artwork.
|
|
218
|
-
Font assets belong in `assets/fonts/`; add optional `tokens/fonts.css` first in
|
|
219
|
-
the import-only foundation entry. The fixed import order is fonts (when
|
|
220
|
-
present), colors, typography, spacing, elevation, base.
|
|
221
|
-
|
|
222
|
-
Select an SVG with `assets.iconSource` in `ds.config.json`, relative to the ADS
|
|
223
|
-
folder. Initialized builds run checks and Oxlint, then `ads assets`, then existing
|
|
224
|
-
build steps. Standard icons go into ignored `.ds/assets/`; integrate that
|
|
225
|
-
directory with the application's asset mount and reject duplicate paths.
|
|
226
|
-
Application metadata and custom platform exports remain project-owned. See
|
|
227
|
-
[brand guidance](design-system/assets/brand/README.md).
|
|
228
|
-
|
|
229
|
-
## Component guides and rules
|
|
230
|
-
|
|
231
|
-
Keep detailed API, examples, interactions, token hooks, tests, and source credits
|
|
232
|
-
in a README beside the component. When adapting another library, record its
|
|
233
|
-
version, author, links, concrete influences, and agreed differences. Shared
|
|
234
|
-
architecture belongs here rather than duplicating each component contract.
|
|
235
|
-
|
|
236
|
-
General Oxlint and Biome CSS checks are included. They do not enforce the entire
|
|
237
|
-
ownership or token contract. Add component-local lint only for concrete,
|
|
238
|
-
statically provable misuse; register tooling centrally and keep it outside the
|
|
239
|
-
runtime barrel. Core checks must work without any particular component library.
|
|
240
|
-
Use configured token and ownership guards as the system grows; bring applicable
|
|
241
|
-
component-specific rules with an external item and register them in project
|
|
242
|
-
tooling. Configure project plugins, rules, and scoped `oxlint.overrides` in
|
|
243
|
-
`ds.config.json`. Overrides configure Oxlint, not independent `ads check` policies.
|
|
244
|
-
Use explicit `boundaries` for documented renderer properties and non-state hooks.
|
|
245
|
-
|
|
246
|
-
## Verification
|
|
247
|
-
|
|
248
|
-
Run `npm run build` after adding or changing components. Add meaningful tests
|
|
249
|
-
for stateful behavior, accessibility, gestures, or async lifecycle where needed.
|
|
250
|
-
Run `npm run dev` to inspect the real showcase. A screenshot alone does not
|
|
251
|
-
verify interaction or animation. Generated output and dependencies are not source.
|
|
252
|
-
|
|
253
|
-
Shared behavior may live in `controllers/<Name>/`; private controllers stay with
|
|
254
|
-
their component/pattern. Use the configured framework and declared dependencies.
|
|
255
|
-
Behavior contracts/checks are development-only, and scenario `exercises` links
|
|
256
|
-
public hooks to demonstrations separately from rendered `covers`. Read the
|
|
257
|
-
installed ADS package's `docs/BEHAVIORS.md` or MCP `ads://guides/behaviors` before
|
|
258
|
-
registering guarantees, profiles and verification.
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
# Starter native design system
|
|
2
|
-
|
|
3
|
-
This private React or Preact TypeScript workspace contains semantic CSS tokens, a project-owned
|
|
4
|
-
token review renderer, a public barrel, Linaria extraction and a preview compiler
|
|
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.
|
|
11
|
-
|
|
12
|
-
Read the local [contract](ADS.md) and the
|
|
13
|
-
[architecture](https://github.com/reqvire-org/ads/blob/main/docs/ARCHITECTURE.md).
|
|
14
|
-
|
|
15
|
-
## Start
|
|
16
|
-
|
|
17
|
-
Copy the contents of `bootstrap-ds/`, including dotfiles, into a new project.
|
|
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
|
|
23
|
-
Node/npm build pipeline. Use a current ADS release.
|
|
24
|
-
|
|
25
|
-
```sh
|
|
26
|
-
npx @reqvire-org/ads init --framework react # or preact
|
|
27
|
-
npm install
|
|
28
|
-
npm run build
|
|
29
|
-
npm run dev:showcase
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
For unreleased tooling, run init using the real local package:
|
|
33
|
-
|
|
34
|
-
```sh
|
|
35
|
-
ads_tool_package="/absolute/path/to/reqvire-org-ads-0.3.1.tgz"
|
|
36
|
-
npx --yes --package "$ads_tool_package" ads init --framework react --tool-package "$ads_tool_package"
|
|
37
|
-
npm install
|
|
38
|
-
npm run build
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
For a new Bun workspace, declare Bun in `packageManager`, omit the copied npm
|
|
42
|
-
lockfile and translate nested npm scripts to `bun --bun run`. Initialize with
|
|
43
|
-
`bunx @reqvire-org/ads init`. Init detects existing
|
|
44
|
-
Bun projects and preserves their scripts/lockfiles. Use `bun install` and
|
|
45
|
-
`bun --bun run build`/`bun --bun run dev:showcase`. Node is unnecessary with Bun
|
|
46
|
-
1.4.1+. ADS supplies its Bun preview compiler independently of the project build.
|
|
47
|
-
|
|
48
|
-
For an existing application, merge only the ADS source and required extraction,
|
|
49
|
-
aliases and preview adapter. Preserve its framework, entry points and build.
|
|
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.
|
|
54
|
-
Init adds missing foundation files and connects architectural checks; it does
|
|
55
|
-
not configure Linaria or generate product component source. Generated `.ds/` files are
|
|
56
|
-
ignored; original artwork and provenance belong in `assets/brand/`.
|
|
57
|
-
|
|
58
|
-
## Inspect and add UI
|
|
59
|
-
|
|
60
|
-
When an agent already runs `ads mcp`, open its `ads_status.showcaseUrl`. MCP starts
|
|
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.
|
|
63
|
-
Its shell is minimal: tabs, collapsible left menu, theme switch and App slot.
|
|
64
|
-
Its MCP client discovers entries, invokes preview tools and follows notifications.
|
|
65
|
-
There are no required TokensPage/ComponentsPage/PatternsPage/CompositionPage
|
|
66
|
-
files, and no separate project browser app to implement or rebuild.
|
|
67
|
-
|
|
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;
|
|
71
|
-
the development-only `TokenPreview` renderer, exported through `@ds/review`, owns their presentation and applies the real CSS
|
|
72
|
-
variables. Add/remove samples alongside token definitions. `ads check` rejects
|
|
73
|
-
missing coverage and invented names; the App verifies the declared CSS bindings
|
|
74
|
-
in the browser. Extend or replace the project-owned review renderer as your tokens evolve.
|
|
75
|
-
`ads_prepare_token_samples` can prepare a fixture patch from explicit project
|
|
76
|
-
property/probe bindings. It preserves existing samples and reports unmapped tokens;
|
|
77
|
-
it does not guess how a new value should look. Design values belong in the shared
|
|
78
|
-
foundation. Component/pattern variables map shared roles; they do not define
|
|
79
|
-
independent token catalogues. See [ADS.md](ADS.md).
|
|
80
|
-
|
|
81
|
-
Create a component under `design-system/components/`, export it through `@ds`,
|
|
82
|
-
and colocate `<Owner>.ads.scenario.tsx` plus `<Owner>.ads.fixture.ts`. Reusable compositions belong under `patterns/`; larger
|
|
83
|
-
scenarios live under `composition/`. Each entry mounts independently with its
|
|
84
|
-
fixture inputs and state/callback adapter. Use public ADS APIs and owned Linaria
|
|
85
|
-
styles, keeping business data/services in the application.
|
|
86
|
-
|
|
87
|
-
`ds.config.json` selects ADS's native Bun compiler. MCP prewarms discovered
|
|
88
|
-
views sequentially, prioritizes foreground selections, and watches owner code,
|
|
89
|
-
styles, fixtures and assets. The App loads the selected dependency closure and
|
|
90
|
-
reuses unchanged runtime/CSS/font resources across selections. The MCP client
|
|
91
|
-
refreshes successful revisions inside that App; failures show diagnostics and
|
|
92
|
-
stale retained output. Changing a selected view's dependency closure unmounts its previous state;
|
|
93
|
-
background warming retains unchanged mounted views. `showcase/mcp/main.tsx` exports `mountScenario(Scenario, container)` and
|
|
94
|
-
returns an unmount callback; it is not the shell. Keep the saved `framework`,
|
|
95
|
-
compiler and mount adapter consistent.
|
|
96
|
-
Managed sessions own their graph output; standalone prebuilds cannot replace it.
|
|
97
|
-
Verified generated graph snapshots preserve warm-start reuse across sessions.
|
|
98
|
-
|
|
99
|
-
The application and previews use the same foundation CSS and Linaria pipeline.
|
|
100
|
-
The source barrel loads the foundation once. The private `build:lib` script uses
|
|
101
|
-
Vite library mode plus declarations as a source compile check; this is not a
|
|
102
|
-
published UI library. General CSS checks use pinned Biome; architectural and
|
|
103
|
-
registered component checks come from initialized ADS tooling.
|
|
104
|
-
|
|
105
|
-
Detailed public API, behavior, tokens, tests, credits and notices belong in each
|
|
106
|
-
owner's local README. The starter values and system fonts are defaults; the
|
|
107
|
-
receiving project owns their identity. Import/adapt additional source explicitly
|
|
108
|
-
from a user-selected external repository, preserving revisions and licenses.
|
|
109
|
-
|
|
110
|
-
## Validation
|
|
111
|
-
|
|
112
|
-
`npm run build` runs lint, type checking and the public-source compile check.
|
|
113
|
-
`npm run build:showcase` optionally prebuilds the shared preview graph; normal
|
|
114
|
-
inspection builds it automatically, then loads selected entries. Browser review
|
|
115
|
-
still checks layout, accessibility, keyboard/focus, states, themes and motion. A clean
|
|
116
|
-
build or delivered HTML alone does not establish those behaviors.
|
|
117
|
-
Opt-in MCP editing uses owner Git patches. `ads_prepare_patch` creates a temporary
|
|
118
|
-
owner draft/diff; `ads_apply_transaction` validates bounded coupled owner patches
|
|
119
|
-
against one final candidate. Preparation changes no live source. Keep all guards
|
|
120
|
-
and review the rendered result after applying.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://biomejs.dev/schemas/2.5.15/schema.json",
|
|
3
|
-
"files": {
|
|
4
|
-
"includes": ["design-system/**/*.css"]
|
|
5
|
-
},
|
|
6
|
-
"formatter": { "enabled": false },
|
|
7
|
-
"assist": { "enabled": false },
|
|
8
|
-
"linter": {
|
|
9
|
-
"enabled": true,
|
|
10
|
-
"rules": {
|
|
11
|
-
"preset": "none",
|
|
12
|
-
"suspicious": {
|
|
13
|
-
"noDuplicateFontNames": "error",
|
|
14
|
-
"noDuplicateProperties": "error"
|
|
15
|
-
},
|
|
16
|
-
"nursery": {
|
|
17
|
-
"noDuplicateSelectors": "error"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# Project branding
|
|
2
|
-
|
|
3
|
-
Keep original logos, app icons, and artwork variants here. This starter contains
|
|
4
|
-
no artwork. Record each asset's purpose, suitable backgrounds, usage, source
|
|
5
|
-
credits, and applicable licenses when adding it.
|
|
6
|
-
|
|
7
|
-
UI branding uses the project-owned shared roles in `tokens/`: change values such as
|
|
8
|
-
`--accent`, `--font-sans`, and `--radius-md`. Components own `--ds-*` variables;
|
|
9
|
-
patterns and development review helpers own `--ux-*`; the showcase owns
|
|
10
|
-
`--showcase-*`. Do not introduce a
|
|
11
|
-
brand-prefixed token vocabulary or override component state variables.
|
|
12
|
-
|
|
13
|
-
Put licensed font files in `assets/fonts/` and their declarations in
|
|
14
|
-
`tokens/fonts.css`. Keep that optional import first in `styles.css`.
|
|
15
|
-
|
|
16
|
-
To generate web icons, set `assets.iconSource` in the project's `ds.config.json`
|
|
17
|
-
to the SVG path relative to the ADS folder, for example:
|
|
18
|
-
|
|
19
|
-
```json
|
|
20
|
-
{ "assets": { "iconSource": "assets/brand/app-icon.svg" } }
|
|
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.
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const fixture = { title: "Button", primary: "Save", secondary: "Cancel", disabled: "Unavailable" } as const;
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
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` | — |
|
|
@@ -1,14 +0,0 @@
|
|
|
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` | — |
|
|
@@ -1,6 +0,0 @@
|
|
|
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;
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
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;
|