react-mcu 1.0.8 → 1.0.10

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
@@ -2,15 +2,17 @@
2
2
  [![](https://img.shields.io/badge/chromatic-171c23.svg?logo=chromatic)](https://www.chromatic.com/library?appId=695eb517cb602e59b4cc045c&branch=main)
3
3
  [![](https://img.shields.io/badge/storybook-171c23.svg?logo=storybook)](https://main--695eb517cb602e59b4cc045c.chromatic.com)
4
4
 
5
- It injects `--mcu-*` CSS variables into the page, based on
6
- [m3 color system](https://m3.material.io/styles/color/system/overview).
5
+ [Material Design colors](https://m3.material.io/styles/color/system/overview) for React.
6
+
7
+ It injects `--mcu-*` CSS variables into the page.
7
8
 
8
9
  https://github.com/user-attachments/assets/5b67c961-d7a4-4b64-9356-4ada26bc9be4
9
10
 
10
- M3 reference:
11
- |builder|roles|
12
- |-|-|
13
- |[<img width="2836" height="2266" alt="CleanShot 2026-01-14 at 08 58 40@2x" src="https://github.com/user-attachments/assets/e4b47c00-716f-4b08-b393-de306d5ce302" />](https://material-foundation.github.io/material-theme-builder/)|[<img width="2836" height="2266" alt="CleanShot 2026-01-14 at 09 01 23@2x" src="https://github.com/user-attachments/assets/826e502d-e173-43c4-807a-53d0ba075a88" />](https://m3.material.io/styles/color/roles)|
11
+ m3 references:
12
+
13
+ | builder | roles |
14
+ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
15
+ | [<img width="2836" height="2266" alt="CleanShot 2026-01-14 at 08 58 40@2x" src="https://github.com/user-attachments/assets/e4b47c00-716f-4b08-b393-de306d5ce302" />](https://material-foundation.github.io/material-theme-builder/) | [<img width="2836" height="2266" alt="CleanShot 2026-01-14 at 09 01 23@2x" src="https://github.com/user-attachments/assets/826e502d-e173-43c4-807a-53d0ba075a88" />](https://m3.material.io/styles/color/roles) |
14
16
 
15
17
  # Usage
16
18
 
@@ -39,11 +41,19 @@ import { Mcu } from "react-mcu";
39
41
  </Mcu>
40
42
  ```
41
43
 
44
+ > [!TIP]
45
+ >
46
+ > Typically wrapping `{children}` in a
47
+ > [layout](https://nextjs.org/docs/app/getting-started/layouts-and-pages#creating-a-layout).
48
+
42
49
  > [!NOTE]
43
50
  >
44
- > CSS varnames are always kebab-cased, `myCustomColor1` → `--mcu-my-custom-color-1`
51
+ > CSS varnames are always kebab-cased, `myCustomColor1` →
52
+ > `--mcu-my-custom-color-1`
53
+
54
+ ## `useMcu`
45
55
 
46
- A `useMcu` hook is also provided:
56
+ A hook is also provided:
47
57
 
48
58
  ```tsx
49
59
  import { useMcu } from "react-mcu";
@@ -59,7 +69,7 @@ return (
59
69
 
60
70
  ## Tailwind
61
71
 
62
- Compatible with Tailwind through
72
+ Compatible through
63
73
  [theme variables](https://tailwindcss.com/docs/theme):
64
74
 
65
75
  https://github.com/abernier/react-mcu/blob/f981087651d77f6b11fc76cb783a5220a1b56e87/src/tailwind.css#L3-L76
@@ -75,6 +85,72 @@ Or simply:
75
85
  > Do not forget to manually add your custom colors, as in:
76
86
  > https://github.com/abernier/react-mcu/blob/f981087651d77f6b11fc76cb783a5220a1b56e87/src/tailwind.css#L52-L75
77
87
 
88
+ ## shadcn
89
+
90
+ Pre-requisites:
91
+
92
+ - You should use [`tailwind.cssVariables`](https://ui.shadcn.com/docs/theming#css-variables)
93
+
94
+ Simply override/remap
95
+ [shadcn's CSS variables](https://ui.shadcn.com/docs/theming#list-of-variables):
96
+
97
+ ```css
98
+ :root {
99
+ /* ... */
100
+ }
101
+ .dark {
102
+ /* ... */
103
+ }
104
+
105
+ :root,
106
+ .dark {
107
+ --background: var(--mcu-surface);
108
+ --foreground: var(--mcu-on-surface);
109
+ --card: var(--mcu-surface-container-low);
110
+ --card-foreground: var(--mcu-on-surface);
111
+ --popover: var(--mcu-surface-container-high);
112
+ --popover-foreground: var(--mcu-on-surface);
113
+ --primary: var(--mcu-primary);
114
+ --primary-foreground: var(--mcu-on-primary);
115
+ --secondary: var(--mcu-secondary-container);
116
+ --secondary-foreground: var(--mcu-on-secondary-container);
117
+ --muted: var(--mcu-surface-container-highest);
118
+ --muted-foreground: var(--mcu-on-surface-variant);
119
+ --accent: var(--mcu-secondary-container);
120
+ --accent-foreground: var(--mcu-on-secondary-container);
121
+ --destructive: var(--mcu-error);
122
+ --border: var(--mcu-outline-variant);
123
+ --input: var(--mcu-outline);
124
+ --ring: var(--mcu-primary);
125
+ --chart-1: var(--mcu-primary-fixed);
126
+ --chart-2: var(--mcu-secondary-fixed);
127
+ --chart-3: var(--mcu-tertiary-fixed);
128
+ --chart-4: var(--mcu-primary-fixed-dim);
129
+ --chart-5: var(--mcu-secondary-fixed-dim);
130
+ --sidebar: var(--mcu-surface-container-low);
131
+ --sidebar-foreground: var(--mcu-on-surface);
132
+ --sidebar-primary: var(--mcu-primary);
133
+ --sidebar-primary-foreground: var(--mcu-on-primary);
134
+ --sidebar-accent: var(--mcu-secondary-container);
135
+ --sidebar-accent-foreground: var(--mcu-on-secondary-container);
136
+ --sidebar-border: var(--mcu-outline-variant);
137
+ --sidebar-ring: var(--mcu-primary);
138
+ }
139
+ ```
140
+
141
+ <details>
142
+ <summary>mapping details</summary>
143
+ see:
144
+
145
+ - https://chatgpt.com/share/6899f20a-422c-8011-a072-62fb649589a0
146
+ - https://gemini.google.com/share/51e072b6f1d2
147
+ </details>
148
+
149
+ > [!IMPORTANT]
150
+ >
151
+ > Make sure `:root, .dark { ... }` comes AFTER `.root { ... } .dark { ... }` to
152
+ > take precedence.
153
+
78
154
  # Dev
79
155
 
80
156
  ## INSTALL
package/dist/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  // src/Mcu.tsx
2
4
  import {
3
5
  argbFromHex,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-mcu",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "A React component library",
5
5
  "keywords": [
6
6
  "react",