nwl-components 1.7.1 → 1.8.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/README.md +44 -1
- package/dist/nwl-components.es.js +668 -668
- package/dist/nwl-components.umd.js +5 -5
- package/dist/sort/style.css +137 -3
- package/dist/style.css +1 -1
- package/dist/tokens.css +133 -0
- package/package.json +12 -2
- package/sort/style.css +137 -3
- package/tokens.css +133 -0
package/README.md
CHANGED
|
@@ -143,13 +143,56 @@ render();
|
|
|
143
143
|
- For template strings: `renderSortIcon(direction)` (the SVG) and `ariaSort(direction)`.
|
|
144
144
|
|
|
145
145
|
The headers' look is in `nwl-components/sort/style.css`, which has only the
|
|
146
|
-
`th.nwl-sortable` and `.nwl-sort-*` rules
|
|
146
|
+
`th.nwl-sortable` and `.nwl-sort-*` rules, after the design tokens they read (`:root` custom
|
|
147
|
+
properties, see "Design tokens"; 6 kB in all). Load that file, not `dist/style.css`, on a
|
|
147
148
|
page not built with nwl-components: `dist/style.css` has global rules (`*` sets the font
|
|
148
149
|
size and colour of every element). With a bundler, `import 'nwl-components/sort/style.css'`
|
|
149
150
|
(webpack 4 included); otherwise link `node_modules/nwl-components/dist/sort/style.css`.
|
|
150
151
|
`dist/style.css` keeps the same rules for `SortableTh`. Story: `Common/PlainSort`.
|
|
151
152
|
Since 1.6.0.
|
|
152
153
|
|
|
154
|
+
## Design tokens
|
|
155
|
+
|
|
156
|
+
The library's colours, fonts, font sizes and corner radii are CSS custom properties, defined
|
|
157
|
+
in `src/styles/tokens.css` (`:root` rules only) in two tiers:
|
|
158
|
+
|
|
159
|
+
- the raw palette (`--nwl-grey-44`, `--nwl-white`, `--nwl-cyan`, …): the only place with hex
|
|
160
|
+
values;
|
|
161
|
+
- the semantic tokens, to use in components and app CSS: backgrounds (`--nwl-bg`,
|
|
162
|
+
`--nwl-bg-surface`, `--nwl-bg-elevated`, …), borders (`--nwl-border`, …), text
|
|
163
|
+
(`--nwl-text`, `--nwl-text-2`, `--nwl-text-3`, …), accent, links and status colours
|
|
164
|
+
(`--nwl-danger`, `--nwl-success`, `--nwl-warning`), font families (`--nwl-font-body`,
|
|
165
|
+
`--nwl-font-display`, `--nwl-font-mono`), sizes (`--nwl-text-xs` … `--nwl-text-hero`;
|
|
166
|
+
body text is `--nwl-text-md`), weights, line heights, spacing (`--nwl-space-1` …
|
|
167
|
+
`--nwl-space-16`), radii (`--nwl-radius-sm`, `--nwl-radius-md`) and shadows.
|
|
168
|
+
|
|
169
|
+
Their values are those the NAAT apps have today, so loading them changes nothing on screen.
|
|
170
|
+
Storybook's `Library/Tokens` page lists every token with a sample.
|
|
171
|
+
|
|
172
|
+
`dist/style.css` and `nwl-components/sort/style.css` each include the tokens, so a page that
|
|
173
|
+
loads either needs nothing else. To use the tokens in an app's own CSS without those files:
|
|
174
|
+
|
|
175
|
+
```js
|
|
176
|
+
import 'nwl-components/tokens.css'; // with a bundler (webpack 4 included)
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
```html
|
|
180
|
+
<!-- a page with no bundle: serve or copy node_modules/nwl-components/dist/tokens.css -->
|
|
181
|
+
<link rel="stylesheet" href="/lib/nwl-components/tokens.css">
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
```css
|
|
185
|
+
.my-panel {
|
|
186
|
+
background: var(--nwl-bg-surface);
|
|
187
|
+
border: 1px solid var(--nwl-border);
|
|
188
|
+
border-radius: var(--nwl-radius-sm);
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Loading the tokens twice on a page (e.g. `tokens.css` and `dist/style.css`) is harmless.
|
|
193
|
+
`npm run lint` fails on a hex colour in `src/**/*.{vue,css}` outside `tokens.css`, and on a
|
|
194
|
+
`var(--nwl-…)` that `tokens.css` doesn't define. Since 1.8.0.
|
|
195
|
+
|
|
153
196
|
## Single File Components
|
|
154
197
|
|
|
155
198
|
This project makes use of Vue SFCs: _Single File Components_, that have the `.vue` extension.
|