@cupra/ui-react 2.0.0-canary.242 → 2.0.0-canary.244

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.
Files changed (2) hide show
  1. package/README.md +27 -9
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -244,15 +244,26 @@ If your TypeScript setup does not support bundler-based module resolution, use r
244
244
 
245
245
  Wrap your React application with `ThemeProvider`.
246
246
 
247
- The provider requires **three props**:
247
+ The provider requires **three required props plus one optional**:
248
248
 
249
- | Prop | Type | Required | Description |
250
- |-------------|---------|----------|-----------------------------------------------|
251
- | `theme` | string | Yes | Visual theme identifier (e.g. cupra-diagonal) |
252
- | `loadFonts` | boolean | Yes | Auto-load DS-UI font files |
253
- | `loadStyles`| boolean | Yes | Auto-load DS-UI CSS |
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 |
254
255
 
255
- If `loadFonts` or `loadStyles` are `false`, you must manually include the corresponding `<link>` tags.
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.
258
+
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`.
256
267
 
257
268
  ### Option A — Manual CSS and font links
258
269
 
@@ -266,7 +277,14 @@ If `loadFonts` or `loadStyles` are `false`, you must manually include the corres
266
277
  <>
267
278
  <link rel="preload" as="font" type="font/woff2" href="https://ds-assets.cupra.com/fonts/[theme]/[font-file]" crossOrigin="anonymous" />
268
279
  <link rel="stylesheet" href="https://ds-assets.cupra.com/[version]/styles/[theme]/theme.css" />
269
- <ThemeProvider theme="[theme]" loadFonts={false} loadStyles={false}>
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}>
270
288
  <Button variant="destructive" icon-name="filters-background">
271
289
  Click me
272
290
  </Button>
@@ -285,7 +303,7 @@ If `loadFonts` or `loadStyles` are `false`, you must manually include the corres
285
303
 
286
304
  export function App() {
287
305
  return (
288
- <ThemeProvider theme="cupra-diagonal" loadFonts={true} loadStyles={true}>
306
+ <ThemeProvider theme="cupra-diagonal" load-fonts={true} load-styles={true} load-unused-styles={true}>
289
307
  <Button variant="primary">Button</Button>
290
308
  </ThemeProvider>
291
309
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cupra/ui-react",
3
- "version": "2.0.0-canary.242",
3
+ "version": "2.0.0-canary.244",
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.227",
53
+ "@cupra/ui-kit": "2.0.0-canary.229",
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.227"
77
+ "@cupra/ui-kit": "2.0.0-canary.229"
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",