@cupra/ui-react 2.0.0-canary.260 → 2.0.0-canary.262
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 +41 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -249,7 +249,7 @@ The provider requires **three required props plus one optional**:
|
|
|
249
249
|
| Prop | Type | Required | Description |
|
|
250
250
|
|----------------------|---------|----------|-------------------------------------------------------------------------------------------------------------------|
|
|
251
251
|
| `theme` | string | Yes | Visual theme identifier (e.g. `cupra-diagonal`) |
|
|
252
|
-
| `load-fonts` | boolean | Yes | Auto-load
|
|
252
|
+
| `load-fonts` | boolean | Yes | Auto-load `fonts.css`, the stylesheet that declares the theme's `@font-face` rules |
|
|
253
253
|
| `load-styles` | boolean | Yes | Auto-load `theme.css`, the stylesheet the `ui-kit` components require |
|
|
254
254
|
| `load-unused-styles` | boolean | No, defaults to `true` | Auto-load `unused-styles.css`, the theme's `--ds-` tokens that `ui-kit` doesn't consume internally, only needed if your own CSS reads raw tokens |
|
|
255
255
|
|
|
@@ -275,7 +275,9 @@ read raw tokens. If your own CSS does read raw tokens, load `unused-styles.css`
|
|
|
275
275
|
export function App() {
|
|
276
276
|
return (
|
|
277
277
|
<>
|
|
278
|
-
|
|
278
|
+
{/* One preload per critical font weight, see Fonts below */}
|
|
279
|
+
<link rel="preload" as="font" type="font/woff2" href="https://ds-assets.cupra.com/fonts/[theme]/[font-file].woff2" crossOrigin="anonymous" />
|
|
280
|
+
<link rel="stylesheet" href="https://ds-assets.cupra.com/[version]/styles/[theme]/fonts.css" />
|
|
279
281
|
<link rel="stylesheet" href="https://ds-assets.cupra.com/[version]/styles/[theme]/theme.css" />
|
|
280
282
|
{/* Lower priority; only needed if your own CSS reads raw --ds- tokens directly */}
|
|
281
283
|
<link
|
|
@@ -312,6 +314,43 @@ read raw tokens. If your own CSS does read raw tokens, load `unused-styles.css`
|
|
|
312
314
|
|
|
313
315
|
---
|
|
314
316
|
|
|
317
|
+
## Fonts
|
|
318
|
+
|
|
319
|
+
Each theme publishes `fonts.css` next to `theme.css`. It only declares the theme's `@font-face` rules
|
|
320
|
+
(woff2, `font-display: fallback`), so the browser downloads just the weights a page renders and only
|
|
321
|
+
swaps the typeface within the first ~3 seconds: later, text doesn't shift. `ThemeProvider` adds it while `load-fonts`
|
|
322
|
+
is `true`; with `load-fonts={false}` link it yourself, as in Option A. That is also the setup for
|
|
323
|
+
server-side rendering, since no JavaScript is needed to load the fonts.
|
|
324
|
+
|
|
325
|
+
**Preload the critical weights.** With `fallback` the browser waits about 100 ms for a font, then shows the
|
|
326
|
+
fallback typeface and swaps to the real one if it arrives within ~3 seconds. After that it keeps the
|
|
327
|
+
fallback for that page view and uses the real one on the next, cached, navigation. While `load-fonts` is `true`, `ThemeProvider` preloads the Regular and Medium weights of the
|
|
328
|
+
theme next to `fonts.css`, while its content waits for `theme.css`. With `load-fonts={false}` or
|
|
329
|
+
server-side rendering, add the preloads to your `<head>` yourself. Adding them there also helps with
|
|
330
|
+
`ThemeProvider`: the download starts before the JavaScript loads, and the provider skips any preload
|
|
331
|
+
already present. In Next.js, render the `<link>` in the root layout; React 19 hoists it to the `<head>`.
|
|
332
|
+
|
|
333
|
+
```tsx
|
|
334
|
+
<link
|
|
335
|
+
rel="preload"
|
|
336
|
+
as="font"
|
|
337
|
+
type="font/woff2"
|
|
338
|
+
href="https://ds-assets.cupra.com/fonts/[theme]/[font-file].woff2"
|
|
339
|
+
crossOrigin="anonymous"
|
|
340
|
+
/>
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
- Preload only the weights rendered above the fold, usually Regular and Medium. Every preload competes
|
|
344
|
+
with other critical requests.
|
|
345
|
+
- Keep `crossOrigin`, even on the same origin. Fonts are fetched in CORS mode, and a preload without it
|
|
346
|
+
is not reused: the font downloads twice.
|
|
347
|
+
- The `href` must match the URL in `fonts.css` exactly.
|
|
348
|
+
|
|
349
|
+
| Theme | `font-family` | Font files (`[font-file]`) |
|
|
350
|
+
|---------|--------|-----------------------------------------------|
|
|
351
|
+
| `seat` | `seat` | `SeatBcn-Book` (350), `SeatBcn-Regular` (400), `SeatBcn-Medium` (500), `SeatBcn-Bold` (700), `SeatBcn-Black` (900) |
|
|
352
|
+
| `cupra-diagonal` | `cupra-screen` | `CupraScreen-Light` (300), `CupraScreen-Book` (350), `CupraScreen-Regular` (400), `CupraScreen-Medium` (500) |
|
|
353
|
+
|
|
315
354
|
## Icons
|
|
316
355
|
|
|
317
356
|
Icons must always be consumed through the `<Icon>` React component — never by loading SVG files directly from the CDN.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cupra/ui-react",
|
|
3
|
-
"version": "2.0.0-canary.
|
|
3
|
+
"version": "2.0.0-canary.262",
|
|
4
4
|
"description": "React components library",
|
|
5
5
|
"author": "SEAT S.A.",
|
|
6
6
|
"license": "SEAT S.A. Library EULA 1.0",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
}
|
|
51
51
|
],
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@cupra/ui-kit": "2.0.0-canary.
|
|
53
|
+
"@cupra/ui-kit": "2.0.0-canary.246",
|
|
54
54
|
"react": ">= 18.3.1 < 20",
|
|
55
55
|
"react-dom": ">= 18.3.1 < 20",
|
|
56
56
|
"typescript": ">=5.0.0"
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"storybook": "^10.6.2",
|
|
75
75
|
"typescript": "^5.9.3",
|
|
76
76
|
"vite": "^8.3.3",
|
|
77
|
-
"@cupra/ui-kit": "2.0.0-canary.
|
|
77
|
+
"@cupra/ui-kit": "2.0.0-canary.246"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
|
80
80
|
"build": "rm -rf dist && pnpm --filter @cupra/ui-kit build:react && tsc --declaration --emitDeclarationOnly && BUILD_FORMAT=esm vite build --emptyOutDir false && BUILD_FORMAT=cjs vite build --emptyOutDir false",
|