@swell/swell-ui 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +165 -2
- package/package.json +135 -4
- package/resolver.json +111 -0
- package/src/components/core/badge/tokens.json +152 -0
- package/src/components/core/button/tokens.dark.json +16 -0
- package/src/components/core/button/tokens.json +232 -0
- package/src/components/core/card/tokens.json +35 -0
- package/src/components/core/checkbox/tokens.json +15 -0
- package/src/components/core/chip/tokens.json +144 -0
- package/src/components/core/link/tokens.json +24 -0
- package/src/components/core/radio/tokens.dark.json +17 -0
- package/src/components/core/radio/tokens.json +114 -0
- package/src/components/core/status/tokens.dark.json +71 -0
- package/src/components/core/status/tokens.json +135 -0
- package/src/components/core/tabs/tokens.json +80 -0
- package/src/components/core/text/tokens.json +222 -0
- package/src/components/core/thumbnail/tokens.json +46 -0
- package/tokens/border.json +38 -0
- package/tokens/color.dark.json +88 -0
- package/tokens/color.json +115 -0
- package/tokens/control.json +115 -0
- package/tokens/field.dark.json +65 -0
- package/tokens/field.json +158 -0
- package/tokens/focus.json +26 -0
- package/tokens/font.json +117 -0
- package/tokens/motion.json +49 -0
- package/tokens/overlay.json +81 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.1.0] - 2026-11-12
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- The core components: badge, button, card, checkbox, chip, disclosure, divider, input, link, lookup, popover, quantity, radio, select, skeleton, status message, tabs, text, textarea and thumbnail, and `<swell-ui>`, an area of the page with values of its own.
|
|
12
|
+
- Design tokens with defaults, configured from JavaScript with `configure`, `setTheme`, `getConfig` and `onChange`: light and dark themes, areas of the page, and variants of the host's own.
|
|
13
|
+
- The package `@swell/swell-ui`: ES modules with TypeScript declarations, typed React wrappers for React 16.8 and later, of which a bundler keeps only those the host imports, each with its element, type entries for Preact, Solid, Vue and Svelte, editor data for VS Code and JetBrains, the Custom Elements Manifest and the token files.
|
|
14
|
+
- Lazy loading: the entry `@swell/swell-ui` holds the configuration and a loader, and each element loads the first time its tag appears on the page, also inside a shadow root passed to `load`. `load` and `ready`, also on the `SwellUI` global, preload elements and wait for them. The kit the platform serves at `/.swell/ui/v1/index.js` loads an element whose chunk a deploy removed from a fresh copy of its entry.
|
|
15
|
+
- `@swell/swell-ui/elements/<name>`: an entry per element, which defines it eagerly and exports its class.
|
|
16
|
+
- A disabled `<fieldset>` disables every field, select, radio group, quantity, button and chip inside it, which then look as with their own `disabled` attribute; a disabled chip, by its `disabled` attribute or a fieldset, fades its remove button, which takes no focus or press.
|
package/README.md
CHANGED
|
@@ -1,3 +1,166 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Swell UI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Web components for Swell checkout, dashboard, apps and storefronts, styled by the host through design tokens.
|
|
4
|
+
|
|
5
|
+
The components are custom elements (`<swell-button>`, `<swell-input>`, `<swell-checkbox>`, …), so they work with any framework or none. They look finished with no configuration, and each host overrides the design tokens it needs, so the same component looks native in every host.
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
- [Background](#background)
|
|
10
|
+
- [Install](#install)
|
|
11
|
+
- [Usage](#usage)
|
|
12
|
+
- [Loading](#loading)
|
|
13
|
+
- [Frameworks](#frameworks)
|
|
14
|
+
- [Apps and storefronts](#apps-and-storefronts)
|
|
15
|
+
- [Browser support](#browser-support)
|
|
16
|
+
- [API](#api)
|
|
17
|
+
- [Contributing](#contributing)
|
|
18
|
+
- [License](#license)
|
|
19
|
+
|
|
20
|
+
## Background
|
|
21
|
+
|
|
22
|
+
Swell apps add their own UI to the checkout and the dashboard, and that UI has to look like the host around it. The kit gives every host and app the same components, and each host configures their look from JavaScript: the values the components share, such as the palette, the font and the corner radius, and the values of single components, with a light and a dark value for any color. [TOKENS.md](TOKENS.md) describes the tokens.
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
npm install @swell/swell-ui
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Import the kit once. Its entry holds the configuration and the loader, which loads each element the first time its tag appears on the page ([Loading](#loading)):
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
import { configure } from "@swell/swell-ui";
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Every module other than `core` is also an entry of its own, `@swell/swell-ui/<module>`, which defines all of that module's elements at once: `import "@swell/swell-ui/<module>";`.
|
|
37
|
+
|
|
38
|
+
Without a bundler, a page loads the entry the Swell platform serves as a module script ([Apps and storefronts](#apps-and-storefronts)); the entry also sets the `SwellUI` global.
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
Use the elements in plain markup:
|
|
43
|
+
|
|
44
|
+
```html
|
|
45
|
+
<swell-button>Continue</swell-button>
|
|
46
|
+
<swell-button variant="secondary">Edit</swell-button>
|
|
47
|
+
<swell-button variant="secondary" appearance="plain" size="small">Cancel</swell-button>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The kit has no icon set. Put your own icon into a component's `start` or `end` slot; an `<svg>` there takes the component's icon size and the current color, so draw it with `currentColor`:
|
|
51
|
+
|
|
52
|
+
```html
|
|
53
|
+
<swell-input label="Address">
|
|
54
|
+
<svg slot="start" viewBox="0 0 24 24" fill="none" stroke="currentColor" aria-hidden="true">…</svg>
|
|
55
|
+
</swell-input>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Configure their look from JavaScript. The components follow each call, before or after they render:
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
configure({
|
|
62
|
+
color: { accent: { light: "#0a7c4a", dark: "#3ecf8e" } },
|
|
63
|
+
components: {
|
|
64
|
+
button: { border: { radius: "12px" } },
|
|
65
|
+
},
|
|
66
|
+
theme: "system",
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
[TOKENS.md → Configuration](TOKENS.md#configuration) describes the configuration, the theme and the areas of a page that take values of their own, such as an order summary in the brand's colors (`configure(config, id)` and `<swell-ui config="id">`).
|
|
71
|
+
|
|
72
|
+
## Loading
|
|
73
|
+
|
|
74
|
+
The entry, `dist/index.js`, holds the loader and the `SwellUI` global, and imports the configuration from a chunk. Each element is a chunk of its own in `dist/chunks/`, with a content hash in its file name, and the code several elements share sits in chunks there too. A page downloads the entry, the configuration and the chunks of the elements it renders.
|
|
75
|
+
|
|
76
|
+
- The loader watches the document: every kit element on the page when the entry runs, and every one added later, loads its chunk once.
|
|
77
|
+
- Until its chunk loads, a kit element is hidden and keeps its place in the layout. `<swell-ui>` shows its content all along: it renders nothing of its own.
|
|
78
|
+
- A component that renders kit elements in a shadow root of its own passes that root to `load`, which watches it as it watches the document:
|
|
79
|
+
|
|
80
|
+
```js
|
|
81
|
+
SwellUI.load(this.shadowRoot);
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
- `load(tags)` loads elements before they appear, and `ready(tags)` waits until they are defined; `ready()` waits for every kit element on the page now. Both reject when a chunk can't load.
|
|
85
|
+
|
|
86
|
+
```js
|
|
87
|
+
import { load, ready } from "@swell/swell-ui";
|
|
88
|
+
|
|
89
|
+
load(["swell-button", "swell-input"]);
|
|
90
|
+
await ready();
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
- `@swell/swell-ui/elements/<name>` defines the element `swell-<name>` as soon as it is imported, and exports its class: a host imports the elements of its first screen this way and leaves the rest to the loader. The React wrappers import their elements the same way.
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
import "@swell/swell-ui/elements/button";
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
- In the kit the platform serves ([Apps and storefronts](#apps-and-storefronts)), a chunk that fails to load, such as one a deploy replaced while the page was open, makes the loader import a fresh `index.js` once and load the element from it. An element that doesn't load stays undefined and the loader reports it with `console.error`; the rest of the page keeps working.
|
|
100
|
+
|
|
101
|
+
## Frameworks
|
|
102
|
+
|
|
103
|
+
The elements work in any framework, and the package carries the types and editor data for them.
|
|
104
|
+
|
|
105
|
+
- **React**, from 16.8: use the typed wrappers, which set properties and listen to the elements' events. `@swell/swell-ui/react` holds the wrappers of every module; each wrapper defines its element when it is imported, and a bundler keeps only the wrappers the host imports. A handler takes the element as `event.currentTarget`. As on a native field, `onInput` fires on every change of a field's value and `onChange` once the user commits it.
|
|
106
|
+
|
|
107
|
+
```jsx
|
|
108
|
+
import { SwellQuantity } from "@swell/swell-ui/react";
|
|
109
|
+
|
|
110
|
+
<SwellQuantity aria-label="Quantity" value={count} onChange={(event) => setCount(event.currentTarget.value)} />;
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
- **Preact, Solid, Vue and Svelte**: use the elements by their tags and add the framework's type entry to `compilerOptions.types` in `tsconfig.json`, next to the type packages listed there; it types every element's attributes, properties and events:
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{ "compilerOptions": { "types": ["@swell/swell-ui/vue"] } }
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The entries are `@swell/swell-ui/preact`, `/solid`, `/vue` and `/svelte`. Vue renders the elements as custom elements when its compiler option `isCustomElement` returns `true` for tags that start with `swell-`.
|
|
120
|
+
- **Editors**: JetBrains IDEs read the package's `web-types.json` by themselves. VS Code reads its custom data from the workspace settings:
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"html.customData": ["./node_modules/@swell/swell-ui/dist/editors/vscode.html-custom-data.json"],
|
|
125
|
+
"css.customData": ["./node_modules/@swell/swell-ui/dist/editors/vscode.css-custom-data.json"]
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Apps and storefronts
|
|
130
|
+
|
|
131
|
+
The Swell platform serves the kit at `/.swell/ui/v1/index.js`, with its chunks next to it; `v1` is the major version. An app's page in a frame of the checkout or the dashboard, and a merchant's storefront, load it as a module script and use the elements by their tags:
|
|
132
|
+
|
|
133
|
+
```html
|
|
134
|
+
<script type="module" src="/.swell/ui/v1/index.js"></script>
|
|
135
|
+
<swell-text>Total</swell-text>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
An app uses the elements directly, or styles its own markup with the global `--swell-*` CSS variables, such as `--swell-color-accent` and `--swell-border-radius`.
|
|
139
|
+
|
|
140
|
+
## Browser support
|
|
141
|
+
|
|
142
|
+
Swell UI runs in the browser, in Chrome 125, Firefox 126, Safari 17.5 and later. Importing it on a server throws, so a framework that renders on the server imports the kit in the browser only, such as with `dynamic(() => import(…), { ssr: false })` in Next.js. The components rely on custom states (`:state()`), `light-dark()` colors, the Popover API, constructable stylesheets and `ElementInternals`.
|
|
143
|
+
|
|
144
|
+
## API
|
|
145
|
+
|
|
146
|
+
- Components: their attributes, properties, events, slots, parts and states, in the package's `custom-elements.json` (Custom Elements Manifest), generated from the source.
|
|
147
|
+
- The entry's functions, also on the `SwellUI` global: `configure`, `setTheme`, `getConfig`, `onChange` and `version` in [TOKENS.md → Configuration](TOKENS.md#configuration), `load` and `ready` in [Loading](#loading).
|
|
148
|
+
- Tokens and settings: [TOKENS.md](TOKENS.md), the files in [`tokens/`](tokens) and each component's `tokens.json`.
|
|
149
|
+
|
|
150
|
+
## Contributing
|
|
151
|
+
|
|
152
|
+
Ask questions in an issue on GitHub. Changes from the Swell team go through pull requests on GitHub. Each pull request keeps the invariants in [ARCHITECTURE.md](ARCHITECTURE.md) and follows [AGENTS.md](AGENTS.md).
|
|
153
|
+
|
|
154
|
+
A release is published from `main`:
|
|
155
|
+
|
|
156
|
+
1. In [CHANGELOG.md](CHANGELOG.md), move the entries under `[Unreleased]` to a heading for the new version with its date, and commit.
|
|
157
|
+
2. Bump the version by the rules in [ARCHITECTURE.md → Versioning](ARCHITECTURE.md#versioning): `npm version patch`, `minor` or `major`, which commits and tags it.
|
|
158
|
+
3. Run the full check and pack the package: `npm run release`.
|
|
159
|
+
4. Publish the packed file: `npm publish swell-swell-ui-<version>.tgz`. The package is public on npm (`publishConfig.access`), so apps and storefronts install it without a token.
|
|
160
|
+
5. Push the commit and the tag: `git push --follow-tags`.
|
|
161
|
+
|
|
162
|
+
The Swell platform serves the kit at `/.swell/ui/v<major>/` from the version of `@swell/swell-ui` that swell-admin depends on, so a release reaches apps and storefronts once swell-admin takes the new version and deploys.
|
|
163
|
+
|
|
164
|
+
## License
|
|
165
|
+
|
|
166
|
+
UNLICENSED. © Swell. Internal use only.
|
package/package.json
CHANGED
|
@@ -1,6 +1,137 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swell/swell-ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Web components for Swell checkout, dashboard, apps and storefronts, styled by the host through design tokens.",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/types/components/core/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./react": {
|
|
16
|
+
"types": "./dist/react/index.d.ts",
|
|
17
|
+
"default": "./dist/react/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./preact": {
|
|
20
|
+
"types": "./dist/frameworks/preact.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./solid": {
|
|
23
|
+
"types": "./dist/frameworks/solid.d.ts"
|
|
24
|
+
},
|
|
25
|
+
"./vue": {
|
|
26
|
+
"types": "./dist/frameworks/vue.d.ts"
|
|
27
|
+
},
|
|
28
|
+
"./svelte": {
|
|
29
|
+
"types": "./dist/frameworks/svelte.d.ts"
|
|
30
|
+
},
|
|
31
|
+
"./custom-elements.json": "./custom-elements.json",
|
|
32
|
+
"./resolver.json": "./resolver.json",
|
|
33
|
+
"./tokens/*": "./tokens/*",
|
|
34
|
+
"./components/*": "./src/components/*",
|
|
35
|
+
"./web-types.json": "./dist/editors/web-types.json",
|
|
36
|
+
"./vscode.html-custom-data.json": "./dist/editors/vscode.html-custom-data.json",
|
|
37
|
+
"./vscode.css-custom-data.json": "./dist/editors/vscode.css-custom-data.json",
|
|
38
|
+
"./elements/*": {
|
|
39
|
+
"types": "./dist/elements/*.d.ts",
|
|
40
|
+
"default": "./dist/elements/*.js"
|
|
41
|
+
},
|
|
42
|
+
"./*": {
|
|
43
|
+
"types": "./dist/types/components/*/index.d.ts",
|
|
44
|
+
"default": "./dist/*.js"
|
|
45
|
+
},
|
|
46
|
+
"./package.json": "./package.json"
|
|
47
|
+
},
|
|
48
|
+
"sideEffects": [
|
|
49
|
+
"./dist/*.js",
|
|
50
|
+
"./dist/elements/*.js",
|
|
51
|
+
"./dist/chunks/*.js"
|
|
52
|
+
],
|
|
53
|
+
"types": "./dist/types/components/core/index.d.ts",
|
|
54
|
+
"web-types": "./dist/editors/web-types.json",
|
|
55
|
+
"files": [
|
|
56
|
+
"CHANGELOG.md",
|
|
57
|
+
"dist",
|
|
58
|
+
"custom-elements.json",
|
|
59
|
+
"resolver.json",
|
|
60
|
+
"tokens",
|
|
61
|
+
"src/components/**/tokens*.json"
|
|
62
|
+
],
|
|
63
|
+
"engines": {
|
|
64
|
+
"node": ">=22.18"
|
|
65
|
+
},
|
|
66
|
+
"scripts": {
|
|
67
|
+
"typecheck": "tsc --noEmit",
|
|
68
|
+
"lint": "eslint . && stylelint \"src/**/*.css\" --allow-empty-input && prettier --check .",
|
|
69
|
+
"format": "prettier --write . && eslint --fix . && stylelint \"src/**/*.css\" --fix --allow-empty-input",
|
|
70
|
+
"test": "vitest run",
|
|
71
|
+
"tokens": "node scripts/tokens/cli.ts",
|
|
72
|
+
"build": "vite build && tsc -p tsconfig.build.json && node scripts/package/types.ts && npm run analyze && node scripts/package/editors.ts && node scripts/package/react.ts",
|
|
73
|
+
"analyze": "cem analyze --config custom-elements-manifest.config.js",
|
|
74
|
+
"storybook": "npm run analyze && storybook dev -p 6006",
|
|
75
|
+
"build-storybook": "npm run analyze && storybook build",
|
|
76
|
+
"check": "npm run tokens -- --check && npm run typecheck && npm run lint && npm test && npm run build && node scripts/package/check.ts",
|
|
77
|
+
"release": "npm run check && npm pack",
|
|
78
|
+
"pretypecheck": "npm run analyze",
|
|
79
|
+
"pretest": "npm run analyze"
|
|
80
|
+
},
|
|
81
|
+
"peerDependencies": {
|
|
82
|
+
"preact": ">=10",
|
|
83
|
+
"react": ">=16.8",
|
|
84
|
+
"solid-js": ">=1",
|
|
85
|
+
"vue": ">=3.5"
|
|
86
|
+
},
|
|
87
|
+
"peerDependenciesMeta": {
|
|
88
|
+
"preact": {
|
|
89
|
+
"optional": true
|
|
90
|
+
},
|
|
91
|
+
"react": {
|
|
92
|
+
"optional": true
|
|
93
|
+
},
|
|
94
|
+
"solid-js": {
|
|
95
|
+
"optional": true
|
|
96
|
+
},
|
|
97
|
+
"vue": {
|
|
98
|
+
"optional": true
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"devDependencies": {
|
|
102
|
+
"@custom-elements-manifest/analyzer": "0.11.0",
|
|
103
|
+
"@eslint/js": "10.0.1",
|
|
104
|
+
"@storybook/addon-a11y": "10.6.6",
|
|
105
|
+
"@storybook/addon-docs": "10.6.6",
|
|
106
|
+
"@storybook/addon-vitest": "10.6.6",
|
|
107
|
+
"@storybook/web-components-vite": "10.6.6",
|
|
108
|
+
"@types/node": "22.20.5",
|
|
109
|
+
"@types/react": "19.3.0",
|
|
110
|
+
"@types/react-dom": "19.3.0",
|
|
111
|
+
"@vitest/browser": "5.1.0",
|
|
112
|
+
"@vitest/browser-playwright": "5.1.0",
|
|
113
|
+
"@wc-toolkit/jsx-types": "1.8.2",
|
|
114
|
+
"@wc-toolkit/svelte-types": "1.0.3",
|
|
115
|
+
"@wc-toolkit/vuejs-types": "1.0.3",
|
|
116
|
+
"custom-element-jet-brains-integration": "1.8.0",
|
|
117
|
+
"custom-element-vs-code-integration": "1.5.0",
|
|
118
|
+
"eslint": "10.14.0",
|
|
119
|
+
"eslint-config-prettier": "10.1.8",
|
|
120
|
+
"eslint-plugin-storybook": "10.6.6",
|
|
121
|
+
"eslint-plugin-wc": "3.1.0",
|
|
122
|
+
"globals": "17.14.0",
|
|
123
|
+
"lit": "3.3.3",
|
|
124
|
+
"playwright": "1.65.0",
|
|
125
|
+
"prettier": "3.9.10",
|
|
126
|
+
"react": "19.3.1",
|
|
127
|
+
"react-dom": "19.3.1",
|
|
128
|
+
"storybook": "10.6.6",
|
|
129
|
+
"stylelint": "18.0.0",
|
|
130
|
+
"stylelint-config-standard": "41.0.0",
|
|
131
|
+
"typescript": "6.0.3",
|
|
132
|
+
"typescript-eslint": "8.72.1",
|
|
133
|
+
"vite": "8.3.6",
|
|
134
|
+
"vitest": "5.1.0"
|
|
135
|
+
},
|
|
136
|
+
"customElements": "custom-elements.json"
|
|
137
|
+
}
|
package/resolver.json
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Swell UI",
|
|
3
|
+
"version": "2025.10",
|
|
4
|
+
"description": "Swell UI token contract: global groups and components, then the theme.",
|
|
5
|
+
"sets": {
|
|
6
|
+
"global": {
|
|
7
|
+
"description": "Global groups.",
|
|
8
|
+
"sources": [
|
|
9
|
+
{
|
|
10
|
+
"$ref": "tokens/color.json"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"$ref": "tokens/font.json"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"$ref": "tokens/border.json"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"$ref": "tokens/focus.json"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"$ref": "tokens/motion.json"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"$ref": "tokens/control.json"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"$ref": "tokens/field.json"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"$ref": "tokens/overlay.json"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
"components": {
|
|
36
|
+
"description": "Components.",
|
|
37
|
+
"sources": [
|
|
38
|
+
{
|
|
39
|
+
"$ref": "src/components/core/text/tokens.json"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"$ref": "src/components/core/link/tokens.json"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"$ref": "src/components/core/button/tokens.json"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"$ref": "src/components/core/checkbox/tokens.json"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"$ref": "src/components/core/radio/tokens.json"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"$ref": "src/components/core/status/tokens.json"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"$ref": "src/components/core/badge/tokens.json"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"$ref": "src/components/core/chip/tokens.json"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"$ref": "src/components/core/thumbnail/tokens.json"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"$ref": "src/components/core/card/tokens.json"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"$ref": "src/components/core/tabs/tokens.json"
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"modifiers": {
|
|
75
|
+
"theme": {
|
|
76
|
+
"description": "Light or dark theme. Light values are in the base files.",
|
|
77
|
+
"contexts": {
|
|
78
|
+
"light": [],
|
|
79
|
+
"dark": [
|
|
80
|
+
{
|
|
81
|
+
"$ref": "tokens/color.dark.json"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"$ref": "tokens/field.dark.json"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"$ref": "src/components/core/button/tokens.dark.json"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"$ref": "src/components/core/radio/tokens.dark.json"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"$ref": "src/components/core/status/tokens.dark.json"
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
"default": "light"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"resolutionOrder": [
|
|
101
|
+
{
|
|
102
|
+
"$ref": "#/sets/global"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"$ref": "#/sets/components"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"$ref": "#/modifiers/theme"
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
{
|
|
2
|
+
"badge": {
|
|
3
|
+
"$description": "Badges: short labels and counts that are text only. The appearance lays the palette out: filled uses background and foreground, without a border; outline uses border and accent on a transparent background.",
|
|
4
|
+
"$extensions": {
|
|
5
|
+
"is.swell.ui": {
|
|
6
|
+
"attributes": {
|
|
7
|
+
"size": ["xsmall", "small", "large", "xlarge"]
|
|
8
|
+
},
|
|
9
|
+
"settings": {
|
|
10
|
+
"appearance": {
|
|
11
|
+
"description": "How badges are drawn when the element has no appearance attribute.",
|
|
12
|
+
"values": ["filled", "outline"],
|
|
13
|
+
"default": "outline"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"variants": true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"height": {
|
|
20
|
+
"$type": "dimension",
|
|
21
|
+
"$value": {
|
|
22
|
+
"value": 24,
|
|
23
|
+
"unit": "px"
|
|
24
|
+
},
|
|
25
|
+
"$description": "Height and least width of medium badges."
|
|
26
|
+
},
|
|
27
|
+
"font": {
|
|
28
|
+
"size": {
|
|
29
|
+
"$type": "dimension",
|
|
30
|
+
"$value": "{font.footnote.size}",
|
|
31
|
+
"$description": "Font size of medium badges."
|
|
32
|
+
},
|
|
33
|
+
"weight": {
|
|
34
|
+
"$type": "fontWeight",
|
|
35
|
+
"$value": "{font.strong.weight}",
|
|
36
|
+
"$description": "Font weight of medium badges."
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"xsmall": {
|
|
40
|
+
"height": {
|
|
41
|
+
"$type": "dimension",
|
|
42
|
+
"$value": {
|
|
43
|
+
"value": 16,
|
|
44
|
+
"unit": "px"
|
|
45
|
+
},
|
|
46
|
+
"$description": "Height and least width of extra small badges, such as a count on an icon."
|
|
47
|
+
},
|
|
48
|
+
"font": {
|
|
49
|
+
"size": {
|
|
50
|
+
"$type": "dimension",
|
|
51
|
+
"$value": {
|
|
52
|
+
"value": 10,
|
|
53
|
+
"unit": "px"
|
|
54
|
+
},
|
|
55
|
+
"$description": "Font size of extra small badges."
|
|
56
|
+
},
|
|
57
|
+
"weight": {
|
|
58
|
+
"$type": "fontWeight",
|
|
59
|
+
"$value": "{font.bold.weight}",
|
|
60
|
+
"$description": "Font weight of extra small badges."
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"small": {
|
|
65
|
+
"height": {
|
|
66
|
+
"$type": "dimension",
|
|
67
|
+
"$value": {
|
|
68
|
+
"value": 20,
|
|
69
|
+
"unit": "px"
|
|
70
|
+
},
|
|
71
|
+
"$description": "Height and least width of small badges, such as a count."
|
|
72
|
+
},
|
|
73
|
+
"font": {
|
|
74
|
+
"size": {
|
|
75
|
+
"$type": "dimension",
|
|
76
|
+
"$value": {
|
|
77
|
+
"value": 11,
|
|
78
|
+
"unit": "px"
|
|
79
|
+
},
|
|
80
|
+
"$description": "Font size of small badges."
|
|
81
|
+
},
|
|
82
|
+
"weight": {
|
|
83
|
+
"$type": "fontWeight",
|
|
84
|
+
"$value": "{font.bold.weight}",
|
|
85
|
+
"$description": "Font weight of small badges."
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"large": {
|
|
90
|
+
"height": {
|
|
91
|
+
"$type": "dimension",
|
|
92
|
+
"$value": {
|
|
93
|
+
"value": 28,
|
|
94
|
+
"unit": "px"
|
|
95
|
+
},
|
|
96
|
+
"$description": "Height and least width of large badges."
|
|
97
|
+
},
|
|
98
|
+
"font": {
|
|
99
|
+
"size": {
|
|
100
|
+
"$type": "dimension",
|
|
101
|
+
"$value": {
|
|
102
|
+
"value": 13,
|
|
103
|
+
"unit": "px"
|
|
104
|
+
},
|
|
105
|
+
"$description": "Font size of large badges."
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"xlarge": {
|
|
110
|
+
"height": {
|
|
111
|
+
"$type": "dimension",
|
|
112
|
+
"$value": {
|
|
113
|
+
"value": 32,
|
|
114
|
+
"unit": "px"
|
|
115
|
+
},
|
|
116
|
+
"$description": "Height and least width of extra large badges."
|
|
117
|
+
},
|
|
118
|
+
"font": {
|
|
119
|
+
"size": {
|
|
120
|
+
"$type": "dimension",
|
|
121
|
+
"$value": {
|
|
122
|
+
"value": 14,
|
|
123
|
+
"unit": "px"
|
|
124
|
+
},
|
|
125
|
+
"$description": "Font size of extra large badges."
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"color": {
|
|
130
|
+
"background": {
|
|
131
|
+
"$type": "color",
|
|
132
|
+
"$value": "{color.foreground}",
|
|
133
|
+
"$description": "Fill of filled primary badges, such as a count."
|
|
134
|
+
},
|
|
135
|
+
"foreground": {
|
|
136
|
+
"$type": "color",
|
|
137
|
+
"$value": "{color.background}",
|
|
138
|
+
"$description": "Text of filled primary badges."
|
|
139
|
+
},
|
|
140
|
+
"border": {
|
|
141
|
+
"$type": "color",
|
|
142
|
+
"$value": "{color.border}",
|
|
143
|
+
"$description": "Border of outline primary badges."
|
|
144
|
+
},
|
|
145
|
+
"accent": {
|
|
146
|
+
"$type": "color",
|
|
147
|
+
"$value": "{color.foreground}",
|
|
148
|
+
"$description": "Text of outline primary badges."
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|