@cupra/ui-react 2.0.0-canary.4 → 2.0.0-canary.6

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 +55 -0
  2. package/package.json +7 -3
package/README.md CHANGED
@@ -22,6 +22,59 @@ This library currently provides **official support for React 18**.
22
22
 
23
23
  Projects using other React versions may still install and use the library, but behaviour is not guaranteed until official support is released.
24
24
 
25
+ ### TypeScript and module resolution
26
+
27
+ This library is **bundler-first**.
28
+
29
+ #### Subpath imports (recommended)
30
+
31
+ Importing components via subpaths (for example `@cupra/ui-react/Accordion`) requires
32
+ TypeScript to use **bundler-based module resolution**:
33
+
34
+ - **TypeScript ≥ 5**
35
+ - `"moduleResolution": "bundler"`
36
+
37
+ This matches how modern bundlers resolve modules and enables the best DX,
38
+ including proper tree-shaking and code-splitting.
39
+
40
+ Minimal required `tsconfig.json` setting:
41
+
42
+ ```
43
+ {
44
+ "compilerOptions": {
45
+ "moduleResolution": "bundler"
46
+ }
47
+ }
48
+ ```
49
+
50
+ ---
51
+
52
+ #### Root imports (compatibility mode)
53
+
54
+ If your project cannot use `moduleResolution: "bundler"`, you can still consume
55
+ the library using **root imports**:
56
+
57
+ ```
58
+ import { Accordion, IconButton } from "@cupra/ui-react";
59
+ ```
60
+
61
+ This mode works with legacy or constrained TypeScript setups, but has the
62
+ following trade-offs:
63
+
64
+ - Subpath imports are not available
65
+ - Reduced tree-shaking and chunking opportunities
66
+ - All components are imported from the package entry point
67
+
68
+ Root imports are supported as a fallback, but **subpath imports are recommended
69
+ whenever possible**.
70
+
71
+ ---
72
+
73
+ #### Notes
74
+
75
+ - Subpath imports are intentionally designed for bundler-based environments.
76
+ - The library does not attempt to enforce Node-style module resolution.
77
+ - No additional runtime configuration is required when using a modern bundler.
25
78
  ## Installation
26
79
 
27
80
  ### Install the package
@@ -119,6 +172,8 @@ npm install @cupra/ui-react@0.1.4-canary.2
119
172
  Import components via subpaths. Do not import from the package index:
120
173
  - @cupra/ui-react → React wrappers built on top of the Web Components (e.g. `import { Button } from '@cupra/ui-react/Button'`)
121
174
 
175
+ If you see TypeScript errors like `TS2307: Cannot find module '@cupra/ui-react/Accordion'`, check your `tsconfig` and apply one of the configurations from the section above. With TS 4.9 + `node`, the library publishes `typesVersions` to resolve subpath typings, but the recommendation is to use `bundler` (TS ≥ 5) or `node16`/`nodenext`.
176
+
122
177
  Wrap your React app with `ThemeProvider`.
123
178
  The provider requires **three props**:
124
179
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cupra/ui-react",
3
- "version": "2.0.0-canary.4",
3
+ "version": "2.0.0-canary.6",
4
4
  "description": "React components library",
5
5
  "author": "SEAT S.A.",
6
6
  "license": "SEAT S.A. Library EULA 1.0",
@@ -16,7 +16,10 @@
16
16
  "import": "./dist/components/*/*.js",
17
17
  "types": "./dist/components/*/*.d.ts"
18
18
  },
19
- "./hooks/*": "./dist/hooks/*.js"
19
+ "./hooks/*": {
20
+ "import": "./dist/hooks/*.js",
21
+ "types": "./dist/hooks/*.d.ts"
22
+ }
20
23
  },
21
24
  "files": [
22
25
  "LICENSE",
@@ -44,7 +47,8 @@
44
47
  "peerDependencies": {
45
48
  "react": ">= 18.3.1 < 20",
46
49
  "react-dom": ">= 18.3.1 < 20",
47
- "@cupra/ui-kit": "1.1.0-canary.4"
50
+ "@cupra/ui-kit": "1.1.0-canary.4",
51
+ "typescript": ">=5.0.0"
48
52
  },
49
53
  "dependencies": {
50
54
  "styled-components": "^6.1.16"