@cupra/ui-react 2.0.0-canary.243 → 2.0.0-canary.245
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 +25 -14
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -246,18 +246,24 @@ Wrap your React application with `ThemeProvider`.
|
|
|
246
246
|
|
|
247
247
|
The provider requires **three required props plus one optional**:
|
|
248
248
|
|
|
249
|
-
| Prop
|
|
250
|
-
|
|
251
|
-
| `theme`
|
|
252
|
-
| `
|
|
253
|
-
| `
|
|
254
|
-
| `
|
|
249
|
+
| Prop | Type | Required | Description |
|
|
250
|
+
|----------------------|---------|----------|-------------------------------------------------------------------------------------------------------------------|
|
|
251
|
+
| `theme` | string | Yes | Visual theme identifier (e.g. `cupra-diagonal`) |
|
|
252
|
+
| `load-fonts` | boolean | Yes | Auto-load DS-UI font files |
|
|
253
|
+
| `load-styles` | boolean | Yes | Auto-load `theme.css`, the stylesheet the `ui-kit` components require |
|
|
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
|
|
|
256
|
-
|
|
256
|
+
`ThemeProvider` forwards its props directly to the underlying `<ds-theme-provider>` Web Component, so
|
|
257
|
+
prop names match its HTML attributes (kebab-case), not idiomatic React camelCase.
|
|
257
258
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
If `load-fonts`, `load-styles` or `load-unused-styles` are `false`, you must manually include the corresponding `<link>` tags.
|
|
260
|
+
|
|
261
|
+
**Performance note:** For optimal behaviour, disable `load-styles` and `load-unused-styles` and load both
|
|
262
|
+
stylesheets manually, controlling their priority: `theme.css` as a normal, high-priority stylesheet link
|
|
263
|
+
(always required), and `unused-styles.css` added with lower priority — for example with `rel="preload"`
|
|
264
|
+
and `as="style"`, turned into a stylesheet once loaded via `onLoad` — or omitted entirely if you don't
|
|
265
|
+
read raw tokens. If your own CSS does read raw tokens, load `unused-styles.css` with the same priority as
|
|
266
|
+
`theme.css`.
|
|
261
267
|
|
|
262
268
|
### Option A — Manual CSS and font links
|
|
263
269
|
|
|
@@ -271,9 +277,14 @@ both with the same priority.
|
|
|
271
277
|
<>
|
|
272
278
|
<link rel="preload" as="font" type="font/woff2" href="https://ds-assets.cupra.com/fonts/[theme]/[font-file]" crossOrigin="anonymous" />
|
|
273
279
|
<link rel="stylesheet" href="https://ds-assets.cupra.com/[version]/styles/[theme]/theme.css" />
|
|
274
|
-
{/*
|
|
275
|
-
<link
|
|
276
|
-
|
|
280
|
+
{/* Lower priority; only needed if your own CSS reads raw --ds- tokens directly */}
|
|
281
|
+
<link
|
|
282
|
+
rel="preload"
|
|
283
|
+
as="style"
|
|
284
|
+
href="https://ds-assets.cupra.com/[version]/styles/[theme]/unused-styles.css"
|
|
285
|
+
onLoad={(e) => { e.currentTarget.rel = "stylesheet"; }}
|
|
286
|
+
/>
|
|
287
|
+
<ThemeProvider theme="[theme]" load-fonts={false} load-styles={false} load-unused-styles={false}>
|
|
277
288
|
<Button variant="destructive" icon-name="filters-background">
|
|
278
289
|
Click me
|
|
279
290
|
</Button>
|
|
@@ -292,7 +303,7 @@ both with the same priority.
|
|
|
292
303
|
|
|
293
304
|
export function App() {
|
|
294
305
|
return (
|
|
295
|
-
<ThemeProvider theme="cupra-diagonal"
|
|
306
|
+
<ThemeProvider theme="cupra-diagonal" load-fonts={true} load-styles={true} load-unused-styles={true}>
|
|
296
307
|
<Button variant="primary">Button</Button>
|
|
297
308
|
</ThemeProvider>
|
|
298
309
|
);
|
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.245",
|
|
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.230",
|
|
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.0",
|
|
75
75
|
"typescript": "^5.9.3",
|
|
76
76
|
"vite": "^8.2.2",
|
|
77
|
-
"@cupra/ui-kit": "2.0.0-canary.
|
|
77
|
+
"@cupra/ui-kit": "2.0.0-canary.230"
|
|
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",
|