@easygov/web-components 0.6.0 → 0.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 CHANGED
@@ -38,12 +38,49 @@ import "@easygov/web-components/footer"; // registers <eg-easygov-footer>
38
38
  ```
39
39
 
40
40
  Import only the subpath(s) you need — an app using just the footer never pulls in the header's
41
- code. Both share one common chunk (React, the design tokens' fonts/CSS, `@easygov/react-components`
41
+ code. Both share one common chunk (React, the design tokens' CSS, `@easygov/react-components`
42
42
  itself), so it's fetched once regardless of how many elements you import.
43
43
 
44
- Each element renders into an open shadow root with the design system's styles and fonts attached
45
- automatically — no separate stylesheet or font import required, unlike
46
- `@easygov/react-components`.
44
+ Each element renders into an open shadow root with the design system's styles attached
45
+ automatically — no separate stylesheet import required, unlike `@easygov/react-components`.
46
+ The font is the exception, see [Font](#font).
47
+
48
+ ### Font
49
+
50
+ The elements use the font family `"Clash Grotesk Variable"` (Clash Grotesk, Indian Type
51
+ Foundry). Its licence (ITF FFL v2.0) does not allow redistributing the font file through a
52
+ public package, so **this package ships no font files and no `@font-face`**. Without the font
53
+ the elements fall back to the system font.
54
+
55
+ Download the font yourself from [Fontshare](https://www.fontshare.com/fonts/clash-grotesk),
56
+ host the unmodified `ClashGrotesk-Variable.woff2` in your app, and declare it in the **host
57
+ page's** CSS (font faces declared in the page are available inside the shadow roots) with
58
+ exactly this family name:
59
+
60
+ ```css
61
+ @font-face {
62
+ font-family: "Clash Grotesk Variable";
63
+ src: url("/fonts/ClashGrotesk-Variable.woff2") format("woff2");
64
+ font-weight: 200 700;
65
+ font-display: swap;
66
+ }
67
+ ```
68
+
69
+ Optionally preload it to avoid a late font swap:
70
+
71
+ ```html
72
+ <link rel="preload" href="/fonts/ClashGrotesk-Variable.woff2" as="font" type="font/woff2" crossorigin />
73
+ ```
74
+
75
+ ### Color contexts
76
+
77
+ The design system has three color contexts, `.eg-context-bright`, `.eg-context-subtle` and
78
+ `.eg-context-dark`: content inside a container with one of these classes recolors to that context,
79
+ the innermost class wins when they nest, and Bright is the default. The elements set their
80
+ contexts themselves inside their shadow roots (the header is Bright, the footer Dark with a Bright
81
+ partner band); a context class in the host page does not reach into a shadow root and has no
82
+ effect on them. Popups (such as the header's language and navigation menus) render in a portal and
83
+ always use the default (bright) context.
47
84
 
48
85
  ### `<eg-easygov-header>`
49
86