@nova-design-system/nova-base 3.29.0 → 3.31.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
@@ -36,54 +36,47 @@ Include the tokens CSS in your project (two themes are available: Spark and Ocea
36
36
  @import '@nova-design-system/nova-base/dist/css/ocean.css';
37
37
  ```
38
38
 
39
- ### Recommended Approach: Using Tailwind CSS with Nova Theme and Plugin
39
+ ### Recommended Approach: Using Tailwind CSS v4 with Nova Theme and Plugin
40
40
 
41
- The recommended approach is to set up Tailwind CSS and use our tokens, `novaTailwindTheme`, and `novaTailwindPlugin` for the Tailwind configuration. This method provides a smaller CSS bundle and access to more utilities than the precompiled CSS.
41
+ The recommended approach is to set up Tailwind CSS v4 and use the Nova theme and plugin via CSS directives. This method provides a smaller CSS bundle and access to more utilities than the precompiled CSS.
42
42
 
43
43
  #### Prerequisites
44
44
 
45
- Ensure that Tailwind CSS is installed in your project. If not, you can install it by following the [Tailwind CSS installation guide](https://tailwindcss.com/docs/installation).
45
+ Ensure that Tailwind CSS v4 is installed in your project. If not, you can install it by following the [Tailwind CSS installation guide](https://tailwindcss.com/docs/installation).
46
46
 
47
- #### Tailwind Configuration
47
+ #### CSS Configuration
48
48
 
49
- After setting up Tailwind CSS, add the following to your `tailwind.config.js`:
49
+ Tailwind CSS v4 uses a CSS-first configuration. In your main CSS file, import Tailwind and configure the Nova plugin and theme:
50
50
 
51
- ```js
52
- import {
53
- novaTailwindTheme,
54
- novaTailwindPlugin,
55
- } from '@nova-design-system/nova-base/theme';
56
-
57
- /** @type {import('tailwindcss').Config} */
58
- export default {
59
- // ...
60
- theme: novaTailwindTheme,
61
- plugins: [novaTailwindPlugin],
62
- };
63
- ```
51
+ ```css
52
+ /* Import the theme tokens */
53
+ @import '@nova-design-system/nova-base/dist/css/spark.css';
54
+ /* Or: @import '@nova-design-system/nova-base/dist/css/ocean.css'; */
64
55
 
65
- The `novaTailwindTheme` maps our CSS variable tokens to utilities, ensuring consistent styling across your project. The `novaTailwindPlugin` adds additional base styles, components, and utilities.
56
+ @import "tailwindcss";
66
57
 
67
- #### Importing Theme Tokens in CSS
58
+ @plugin "@nova-design-system/nova-base/theme/plugin";
59
+ @config "./tailwind.config.ts";
60
+ ```
68
61
 
69
- In your CSS file, along with the default Tailwind imports, you should import the tokens for the theme:
62
+ Then create a minimal `tailwind.config.ts` with the Nova theme:
70
63
 
71
- ```css
72
- /* Import the theme tokens */
73
- @import '@nova-design-system/nova-base/dist/css/spark.css';
64
+ ```ts
65
+ import type { Config } from 'tailwindcss';
66
+ import { novaTailwindTheme } from '@nova-design-system/nova-base/theme';
74
67
 
75
- /* Tailwind CSS imports */
76
- @tailwind base;
77
- @tailwind components;
78
- @tailwind utilities;
68
+ const config: Config = {
69
+ theme: novaTailwindTheme,
70
+ };
79
71
 
80
- /* Or, for the Ocean theme */
81
- /* @import '@nova-design-system/nova-base/dist/css/ocean.css'; */
72
+ export default config;
82
73
  ```
83
74
 
75
+ The `novaTailwindTheme` maps Nova CSS variable tokens to Tailwind utilities. The `novaTailwindPlugin` (loaded via `@plugin`) adds base styles, components, and custom utilities like `text-high`, `bg-level-00`, and typography classes.
76
+
84
77
  #### Benefits of Using Tailwind CSS with Nova Theme and Plugin
85
78
 
86
- - **Smaller CSS Bundle:** By configuring Tailwind CSS with our theme and plugin, you eliminate unused styles, resulting in a significantly smaller CSS file.
79
+ - **Smaller CSS Bundle:** Tailwind CSS v4 only generates CSS for classes actually used in your source files, resulting in a significantly smaller output.
87
80
  - **More Utilities:** Gain access to a wider range of utilities beyond those included in the precompiled CSS.
88
81
  - **Customization:** Tailwind CSS allows you to customize and extend your styles as needed.
89
82
 
@@ -97,4 +90,4 @@ import '@nova-design-system/nova-base/dist/css/spark.css';
97
90
  import '@nova-design-system/nova-base/dist/css/nova-utils.css';
98
91
  ```
99
92
 
100
- **Note:** The precompiled CSS includes a whitelist of Tailwind classes and is quite large. This approach is only recommended if you cannot set up Tailwind CSS yourself.
93
+ **Note:** The precompiled CSS includes a broad set of pre-generated Tailwind utility classes and is quite large. This approach is only recommended if you cannot set up Tailwind CSS yourself.