react-mcu 1.0.10 → 1.1.1
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 +7 -6
- package/dist/index.d.ts +14 -1
- package/dist/index.js +187 -47
- package/dist/tailwind.css +98 -7
- package/package.json +4 -4
- package/src/tailwind.css +98 -7
package/README.md
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
[](https://www.chromatic.com/library?appId=695eb517cb602e59b4cc045c&branch=main)
|
|
3
3
|
[](https://main--695eb517cb602e59b4cc045c.chromatic.com)
|
|
4
4
|
|
|
5
|
-
[Material Design colors](https://m3.material.io/styles/color/system/overview)
|
|
5
|
+
[Material Design colors](https://m3.material.io/styles/color/system/overview)
|
|
6
|
+
for React.
|
|
6
7
|
|
|
7
8
|
It injects `--mcu-*` CSS variables into the page.
|
|
8
9
|
|
|
@@ -69,10 +70,9 @@ return (
|
|
|
69
70
|
|
|
70
71
|
## Tailwind
|
|
71
72
|
|
|
72
|
-
Compatible through
|
|
73
|
-
[theme variables](https://tailwindcss.com/docs/theme):
|
|
73
|
+
Compatible through [theme variables](https://tailwindcss.com/docs/theme):
|
|
74
74
|
|
|
75
|
-
https://github.com/abernier/react-mcu/blob/
|
|
75
|
+
https://github.com/abernier/react-mcu/blob/688c789e322ed3858b51389b33eb7ea342bba81e/src/tailwind.css#L3-L186
|
|
76
76
|
|
|
77
77
|
Or simply:
|
|
78
78
|
|
|
@@ -83,13 +83,14 @@ Or simply:
|
|
|
83
83
|
> [!IMPORTANT]
|
|
84
84
|
>
|
|
85
85
|
> Do not forget to manually add your custom colors, as in:
|
|
86
|
-
> https://github.com/abernier/react-mcu/blob/
|
|
86
|
+
> https://github.com/abernier/react-mcu/blob/688c789e322ed3858b51389b33eb7ea342bba81e/src/tailwind.css#L126-L185
|
|
87
87
|
|
|
88
88
|
## shadcn
|
|
89
89
|
|
|
90
90
|
Pre-requisites:
|
|
91
91
|
|
|
92
|
-
- You should use
|
|
92
|
+
- You should use
|
|
93
|
+
[`tailwind.cssVariables`](https://ui.shadcn.com/docs/theming#css-variables)
|
|
93
94
|
|
|
94
95
|
Simply override/remap
|
|
95
96
|
[shadcn's CSS variables](https://ui.shadcn.com/docs/theming#list-of-variables):
|
package/dist/index.d.ts
CHANGED
|
@@ -28,9 +28,22 @@ type McuConfig = {
|
|
|
28
28
|
* When true, stays true to input colors without harmonization.
|
|
29
29
|
* When false (default), colors may be adjusted for better harmonization.
|
|
30
30
|
* Corresponds to "Color match - Stay true to my color inputs" in Material Theme Builder.
|
|
31
|
+
*
|
|
32
|
+
* @default false
|
|
33
|
+
* @deprecated Not yet implemented. This prop is currently ignored.
|
|
31
34
|
*/
|
|
32
35
|
colorMatch?: boolean;
|
|
33
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Array of custom colors to include in the generated palette.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* customColors={[
|
|
42
|
+
* { name: "brand", hex: "#FF5733", blend: true },
|
|
43
|
+
* { name: "success", hex: "#28A745", blend: false }
|
|
44
|
+
* ]}
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
34
47
|
customColors?: HexCustomColor[];
|
|
35
48
|
};
|
|
36
49
|
declare const schemesMap: {
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// src/Mcu.tsx
|
|
4
4
|
import {
|
|
5
5
|
argbFromHex,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
Blend,
|
|
7
|
+
DynamicColor,
|
|
8
8
|
DynamicScheme,
|
|
9
9
|
Hct,
|
|
10
10
|
hexFromArgb as hexFromArgb2,
|
|
@@ -15,7 +15,8 @@ import {
|
|
|
15
15
|
SchemeMonochrome,
|
|
16
16
|
SchemeNeutral,
|
|
17
17
|
SchemeTonalSpot,
|
|
18
|
-
SchemeVibrant
|
|
18
|
+
SchemeVibrant,
|
|
19
|
+
TonalPalette
|
|
19
20
|
} from "@material/material-color-utilities";
|
|
20
21
|
import { kebabCase, upperFirst } from "lodash-es";
|
|
21
22
|
import { useMemo as useMemo2 } from "react";
|
|
@@ -111,6 +112,26 @@ var DEFAULT_SCHEME = "tonalSpot";
|
|
|
111
112
|
var DEFAULT_CONTRAST = 0;
|
|
112
113
|
var DEFAULT_COLOR_MATCH = false;
|
|
113
114
|
var DEFAULT_CUSTOM_COLORS = [];
|
|
115
|
+
var STANDARD_TONES = [
|
|
116
|
+
0,
|
|
117
|
+
5,
|
|
118
|
+
10,
|
|
119
|
+
15,
|
|
120
|
+
20,
|
|
121
|
+
25,
|
|
122
|
+
30,
|
|
123
|
+
35,
|
|
124
|
+
40,
|
|
125
|
+
50,
|
|
126
|
+
60,
|
|
127
|
+
70,
|
|
128
|
+
80,
|
|
129
|
+
90,
|
|
130
|
+
95,
|
|
131
|
+
98,
|
|
132
|
+
99,
|
|
133
|
+
100
|
|
134
|
+
];
|
|
114
135
|
var Variant = {
|
|
115
136
|
MONOCHROME: 0,
|
|
116
137
|
NEUTRAL: 1,
|
|
@@ -249,22 +270,56 @@ function toRecord(arr, getEntry) {
|
|
|
249
270
|
{}
|
|
250
271
|
);
|
|
251
272
|
}
|
|
252
|
-
function
|
|
273
|
+
function getPalette(palettes, colorName) {
|
|
274
|
+
const palette = palettes[colorName];
|
|
275
|
+
if (!palette) {
|
|
276
|
+
throw new Error(
|
|
277
|
+
`Custom color palette not found for '${colorName}'. This is likely a bug in the implementation.`
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
return palette;
|
|
281
|
+
}
|
|
282
|
+
function mergeBaseAndCustomColors(scheme, customColors, colorPalettes) {
|
|
253
283
|
const baseVars = toRecord(tokenNames, (tokenName) => {
|
|
254
284
|
const dynamicColor = MaterialDynamicColors[tokenName];
|
|
255
285
|
const argb = dynamicColor.getArgb(scheme);
|
|
256
286
|
return [tokenName, argb];
|
|
257
287
|
});
|
|
258
288
|
const customVars = {};
|
|
259
|
-
const isDark = scheme.isDark;
|
|
260
289
|
customColors.forEach((color) => {
|
|
261
|
-
const customColorGroup = customColor(sourceArgb, color);
|
|
262
|
-
const colorGroup = isDark ? customColorGroup.dark : customColorGroup.light;
|
|
263
290
|
const colorname = color.name;
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
291
|
+
const colorDynamicColor = new DynamicColor(
|
|
292
|
+
colorname,
|
|
293
|
+
(s) => getPalette(colorPalettes, colorname),
|
|
294
|
+
(s) => s.isDark ? 80 : 40,
|
|
295
|
+
// Same as primary
|
|
296
|
+
false
|
|
297
|
+
);
|
|
298
|
+
const onColorDynamicColor = new DynamicColor(
|
|
299
|
+
`on${upperFirst(colorname)}`,
|
|
300
|
+
(s) => getPalette(colorPalettes, colorname),
|
|
301
|
+
(s) => s.isDark ? 20 : 100,
|
|
302
|
+
// Same as onPrimary
|
|
303
|
+
false
|
|
304
|
+
);
|
|
305
|
+
const containerDynamicColor = new DynamicColor(
|
|
306
|
+
`${colorname}Container`,
|
|
307
|
+
(s) => getPalette(colorPalettes, colorname),
|
|
308
|
+
(s) => s.isDark ? 30 : 90,
|
|
309
|
+
// Same as primaryContainer
|
|
310
|
+
false
|
|
311
|
+
);
|
|
312
|
+
const onContainerDynamicColor = new DynamicColor(
|
|
313
|
+
`on${upperFirst(colorname)}Container`,
|
|
314
|
+
(s) => getPalette(colorPalettes, colorname),
|
|
315
|
+
(s) => s.isDark ? 90 : 30,
|
|
316
|
+
// Same as onPrimaryContainer
|
|
317
|
+
false
|
|
318
|
+
);
|
|
319
|
+
customVars[colorname] = colorDynamicColor.getArgb(scheme);
|
|
320
|
+
customVars[`on${upperFirst(colorname)}`] = onColorDynamicColor.getArgb(scheme);
|
|
321
|
+
customVars[`${colorname}Container`] = containerDynamicColor.getArgb(scheme);
|
|
322
|
+
customVars[`on${upperFirst(colorname)}Container`] = onContainerDynamicColor.getArgb(scheme);
|
|
268
323
|
});
|
|
269
324
|
return { ...baseVars, ...customVars };
|
|
270
325
|
}
|
|
@@ -273,6 +328,30 @@ var cssVar = (colorName, colorValue) => {
|
|
|
273
328
|
const value = hexFromArgb2(colorValue);
|
|
274
329
|
return `${name}:${value};`;
|
|
275
330
|
};
|
|
331
|
+
var generateTonalPaletteVars = (paletteName, palette) => {
|
|
332
|
+
return STANDARD_TONES.map((tone) => {
|
|
333
|
+
const color = palette.tone(tone);
|
|
334
|
+
return cssVar(`${paletteName}-${tone}`, color);
|
|
335
|
+
}).join(" ");
|
|
336
|
+
};
|
|
337
|
+
function createColorPalette(colorDef, baseScheme, effectiveSourceForHarmonization) {
|
|
338
|
+
const colorArgb = argbFromHex(colorDef.hex);
|
|
339
|
+
const harmonizedArgb = colorDef.blend ? Blend.harmonize(colorArgb, effectiveSourceForHarmonization) : colorArgb;
|
|
340
|
+
const hct = Hct.fromInt(harmonizedArgb);
|
|
341
|
+
let targetChroma;
|
|
342
|
+
if (colorDef.core && colorDef.chromaSource) {
|
|
343
|
+
if (colorDef.chromaSource === "neutral") {
|
|
344
|
+
targetChroma = baseScheme.neutralPalette.chroma;
|
|
345
|
+
} else if (colorDef.chromaSource === "neutralVariant") {
|
|
346
|
+
targetChroma = baseScheme.neutralVariantPalette.chroma;
|
|
347
|
+
} else {
|
|
348
|
+
targetChroma = baseScheme.primaryPalette.chroma;
|
|
349
|
+
}
|
|
350
|
+
} else {
|
|
351
|
+
targetChroma = baseScheme.primaryPalette.chroma;
|
|
352
|
+
}
|
|
353
|
+
return TonalPalette.fromHueAndChroma(hct.hue, targetChroma);
|
|
354
|
+
}
|
|
276
355
|
var toCssVars = (mergedColors) => {
|
|
277
356
|
return Object.entries(mergedColors).map(([name, value]) => cssVar(name, value)).join(" ");
|
|
278
357
|
};
|
|
@@ -289,61 +368,122 @@ function generateCss({
|
|
|
289
368
|
colorMatch = DEFAULT_COLOR_MATCH,
|
|
290
369
|
customColors: hexCustomColors = DEFAULT_CUSTOM_COLORS
|
|
291
370
|
}) {
|
|
292
|
-
const hasCoreColors = primary ?? secondary ?? tertiary ?? neutral ?? neutralVariant ?? error;
|
|
293
|
-
console.log("MCU generateCss", { hasCoreColors });
|
|
294
371
|
const sourceArgb = argbFromHex(hexSource);
|
|
372
|
+
const effectiveSource = primary || hexSource;
|
|
373
|
+
const effectiveSourceArgb = argbFromHex(effectiveSource);
|
|
374
|
+
const effectiveSourceForHarmonization = primary ? argbFromHex(primary) : sourceArgb;
|
|
375
|
+
const SchemeClass = schemesMap[scheme];
|
|
376
|
+
const primaryHct = Hct.fromInt(effectiveSourceArgb);
|
|
377
|
+
const baseScheme = new SchemeClass(primaryHct, false, contrast);
|
|
378
|
+
const allColors = [
|
|
379
|
+
// Core colors (hex may be undefined)
|
|
380
|
+
{
|
|
381
|
+
name: "primary",
|
|
382
|
+
hex: primary,
|
|
383
|
+
core: true,
|
|
384
|
+
chromaSource: "primary"
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
name: "secondary",
|
|
388
|
+
hex: secondary,
|
|
389
|
+
core: true,
|
|
390
|
+
chromaSource: "primary"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
name: "tertiary",
|
|
394
|
+
hex: tertiary,
|
|
395
|
+
core: true,
|
|
396
|
+
chromaSource: "primary"
|
|
397
|
+
},
|
|
398
|
+
{ name: "error", hex: error, core: true, chromaSource: "primary" },
|
|
399
|
+
{
|
|
400
|
+
name: "neutral",
|
|
401
|
+
hex: neutral,
|
|
402
|
+
core: true,
|
|
403
|
+
chromaSource: "neutral"
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
name: "neutralVariant",
|
|
407
|
+
hex: neutralVariant,
|
|
408
|
+
core: true,
|
|
409
|
+
chromaSource: "neutralVariant"
|
|
410
|
+
},
|
|
411
|
+
//
|
|
412
|
+
// Custom colors
|
|
413
|
+
//
|
|
414
|
+
...hexCustomColors.map((c) => ({
|
|
415
|
+
name: c.name,
|
|
416
|
+
hex: c.hex,
|
|
417
|
+
blend: c.blend,
|
|
418
|
+
core: false
|
|
419
|
+
}))
|
|
420
|
+
];
|
|
421
|
+
const definedColors = allColors.filter(
|
|
422
|
+
(c) => c.hex !== void 0
|
|
423
|
+
);
|
|
424
|
+
const colorPalettes = Object.fromEntries(
|
|
425
|
+
definedColors.map((colorDef) => [
|
|
426
|
+
colorDef.name,
|
|
427
|
+
createColorPalette(colorDef, baseScheme, effectiveSourceForHarmonization)
|
|
428
|
+
])
|
|
429
|
+
);
|
|
295
430
|
const createSchemes = (baseConfig) => [
|
|
296
431
|
new DynamicScheme({ ...baseConfig, isDark: false }),
|
|
297
432
|
new DynamicScheme({ ...baseConfig, isDark: true })
|
|
298
433
|
];
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
variant,
|
|
315
|
-
contrastLevel: contrast,
|
|
316
|
-
primaryPalette: corePalette.a1,
|
|
317
|
-
secondaryPalette: corePalette.a2,
|
|
318
|
-
tertiaryPalette: corePalette.a3,
|
|
319
|
-
neutralPalette: corePalette.n1,
|
|
320
|
-
neutralVariantPalette: corePalette.n2
|
|
321
|
-
});
|
|
322
|
-
} else {
|
|
323
|
-
const SchemeClass = schemesMap[scheme];
|
|
324
|
-
const hct = Hct.fromInt(sourceArgb);
|
|
325
|
-
lightScheme = new SchemeClass(hct, false, contrast);
|
|
326
|
-
darkScheme = new SchemeClass(hct, true, contrast);
|
|
434
|
+
const variant = schemeToVariant[scheme];
|
|
435
|
+
const [lightScheme, darkScheme] = createSchemes({
|
|
436
|
+
sourceColorArgb: effectiveSourceArgb,
|
|
437
|
+
variant,
|
|
438
|
+
contrastLevel: contrast,
|
|
439
|
+
primaryPalette: colorPalettes["primary"] || baseScheme.primaryPalette,
|
|
440
|
+
secondaryPalette: colorPalettes["secondary"] || baseScheme.secondaryPalette,
|
|
441
|
+
tertiaryPalette: colorPalettes["tertiary"] || baseScheme.tertiaryPalette,
|
|
442
|
+
neutralPalette: colorPalettes["neutral"] || baseScheme.neutralPalette,
|
|
443
|
+
neutralVariantPalette: colorPalettes["neutralVariant"] || baseScheme.neutralVariantPalette
|
|
444
|
+
});
|
|
445
|
+
const errorPalette = colorPalettes["error"];
|
|
446
|
+
if (errorPalette) {
|
|
447
|
+
lightScheme.errorPalette = errorPalette;
|
|
448
|
+
darkScheme.errorPalette = errorPalette;
|
|
327
449
|
}
|
|
328
|
-
const customColors =
|
|
329
|
-
|
|
330
|
-
|
|
450
|
+
const customColors = definedColors.filter((c) => !c.core).map((c) => ({
|
|
451
|
+
name: c.name,
|
|
452
|
+
blend: c.blend ?? false,
|
|
453
|
+
value: argbFromHex(c.hex)
|
|
331
454
|
}));
|
|
332
455
|
const mergedColorsLight = mergeBaseAndCustomColors(
|
|
333
456
|
lightScheme,
|
|
334
457
|
customColors,
|
|
335
|
-
|
|
458
|
+
colorPalettes
|
|
336
459
|
);
|
|
337
460
|
const mergedColorsDark = mergeBaseAndCustomColors(
|
|
338
461
|
darkScheme,
|
|
339
462
|
customColors,
|
|
340
|
-
|
|
463
|
+
colorPalettes
|
|
341
464
|
);
|
|
342
465
|
const lightVars = toCssVars(mergedColorsLight);
|
|
343
466
|
const darkVars = toCssVars(mergedColorsDark);
|
|
467
|
+
const allTonalVars = [
|
|
468
|
+
// Core colors from the scheme
|
|
469
|
+
generateTonalPaletteVars("primary", lightScheme.primaryPalette),
|
|
470
|
+
generateTonalPaletteVars("secondary", lightScheme.secondaryPalette),
|
|
471
|
+
generateTonalPaletteVars("tertiary", lightScheme.tertiaryPalette),
|
|
472
|
+
generateTonalPaletteVars("error", lightScheme.errorPalette),
|
|
473
|
+
generateTonalPaletteVars("neutral", lightScheme.neutralPalette),
|
|
474
|
+
generateTonalPaletteVars(
|
|
475
|
+
"neutral-variant",
|
|
476
|
+
lightScheme.neutralVariantPalette
|
|
477
|
+
),
|
|
478
|
+
// Custom colors from our unified palette map
|
|
479
|
+
...customColors.map((customColorObj) => {
|
|
480
|
+
const palette = getPalette(colorPalettes, customColorObj.name);
|
|
481
|
+
return generateTonalPaletteVars(kebabCase(customColorObj.name), palette);
|
|
482
|
+
})
|
|
483
|
+
].join(" ");
|
|
344
484
|
return {
|
|
345
485
|
css: `
|
|
346
|
-
:root { ${lightVars} }
|
|
486
|
+
:root { ${lightVars} ${allTonalVars} }
|
|
347
487
|
.dark { ${darkVars} }
|
|
348
488
|
`,
|
|
349
489
|
mergedColorsLight,
|
package/dist/tailwind.css
CHANGED
|
@@ -49,6 +49,80 @@
|
|
|
49
49
|
--color-scrim: var(--mcu-scrim);
|
|
50
50
|
--color-shadow: var(--mcu-shadow);
|
|
51
51
|
|
|
52
|
+
/* Shades */
|
|
53
|
+
|
|
54
|
+
--color-primary-50: var(--mcu-primary-95);
|
|
55
|
+
--color-primary-100: var(--mcu-primary-90);
|
|
56
|
+
--color-primary-200: var(--mcu-primary-80);
|
|
57
|
+
--color-primary-300: var(--mcu-primary-70);
|
|
58
|
+
--color-primary-400: var(--mcu-primary-60);
|
|
59
|
+
--color-primary-500: var(--mcu-primary-50);
|
|
60
|
+
--color-primary-600: var(--mcu-primary-40);
|
|
61
|
+
--color-primary-700: var(--mcu-primary-30);
|
|
62
|
+
--color-primary-800: var(--mcu-primary-20);
|
|
63
|
+
--color-primary-900: var(--mcu-primary-10);
|
|
64
|
+
--color-primary-950: var(--mcu-primary-5);
|
|
65
|
+
|
|
66
|
+
--color-secondary-50: var(--mcu-secondary-95);
|
|
67
|
+
--color-secondary-100: var(--mcu-secondary-90);
|
|
68
|
+
--color-secondary-200: var(--mcu-secondary-80);
|
|
69
|
+
--color-secondary-300: var(--mcu-secondary-70);
|
|
70
|
+
--color-secondary-400: var(--mcu-secondary-60);
|
|
71
|
+
--color-secondary-500: var(--mcu-secondary-50);
|
|
72
|
+
--color-secondary-600: var(--mcu-secondary-40);
|
|
73
|
+
--color-secondary-700: var(--mcu-secondary-30);
|
|
74
|
+
--color-secondary-800: var(--mcu-secondary-20);
|
|
75
|
+
--color-secondary-900: var(--mcu-secondary-10);
|
|
76
|
+
--color-secondary-950: var(--mcu-secondary-5);
|
|
77
|
+
|
|
78
|
+
--color-tertiary-50: var(--mcu-tertiary-95);
|
|
79
|
+
--color-tertiary-100: var(--mcu-tertiary-90);
|
|
80
|
+
--color-tertiary-200: var(--mcu-tertiary-80);
|
|
81
|
+
--color-tertiary-300: var(--mcu-tertiary-70);
|
|
82
|
+
--color-tertiary-400: var(--mcu-tertiary-60);
|
|
83
|
+
--color-tertiary-500: var(--mcu-tertiary-50);
|
|
84
|
+
--color-tertiary-600: var(--mcu-tertiary-40);
|
|
85
|
+
--color-tertiary-700: var(--mcu-tertiary-30);
|
|
86
|
+
--color-tertiary-800: var(--mcu-tertiary-20);
|
|
87
|
+
--color-tertiary-900: var(--mcu-tertiary-10);
|
|
88
|
+
--color-tertiary-950: var(--mcu-tertiary-5);
|
|
89
|
+
|
|
90
|
+
--color-error-50: var(--mcu-error-95);
|
|
91
|
+
--color-error-100: var(--mcu-error-90);
|
|
92
|
+
--color-error-200: var(--mcu-error-80);
|
|
93
|
+
--color-error-300: var(--mcu-error-70);
|
|
94
|
+
--color-error-400: var(--mcu-error-60);
|
|
95
|
+
--color-error-500: var(--mcu-error-50);
|
|
96
|
+
--color-error-600: var(--mcu-error-40);
|
|
97
|
+
--color-error-700: var(--mcu-error-30);
|
|
98
|
+
--color-error-800: var(--mcu-error-20);
|
|
99
|
+
--color-error-900: var(--mcu-error-10);
|
|
100
|
+
--color-error-950: var(--mcu-error-5);
|
|
101
|
+
|
|
102
|
+
--color-neutral-50: var(--mcu-neutral-95);
|
|
103
|
+
--color-neutral-100: var(--mcu-neutral-90);
|
|
104
|
+
--color-neutral-200: var(--mcu-neutral-80);
|
|
105
|
+
--color-neutral-300: var(--mcu-neutral-70);
|
|
106
|
+
--color-neutral-400: var(--mcu-neutral-60);
|
|
107
|
+
--color-neutral-500: var(--mcu-neutral-50);
|
|
108
|
+
--color-neutral-600: var(--mcu-neutral-40);
|
|
109
|
+
--color-neutral-700: var(--mcu-neutral-30);
|
|
110
|
+
--color-neutral-800: var(--mcu-neutral-20);
|
|
111
|
+
--color-neutral-900: var(--mcu-neutral-10);
|
|
112
|
+
--color-neutral-950: var(--mcu-neutral-5);
|
|
113
|
+
|
|
114
|
+
--color-neutral-variant-50: var(--mcu-neutral-variant-95);
|
|
115
|
+
--color-neutral-variant-100: var(--mcu-neutral-variant-90);
|
|
116
|
+
--color-neutral-variant-200: var(--mcu-neutral-variant-80);
|
|
117
|
+
--color-neutral-variant-300: var(--mcu-neutral-variant-70);
|
|
118
|
+
--color-neutral-variant-400: var(--mcu-neutral-variant-60);
|
|
119
|
+
--color-neutral-variant-500: var(--mcu-neutral-variant-50);
|
|
120
|
+
--color-neutral-variant-600: var(--mcu-neutral-variant-40);
|
|
121
|
+
--color-neutral-variant-700: var(--mcu-neutral-variant-30);
|
|
122
|
+
--color-neutral-variant-800: var(--mcu-neutral-variant-20);
|
|
123
|
+
--color-neutral-variant-900: var(--mcu-neutral-variant-10);
|
|
124
|
+
--color-neutral-variant-950: var(--mcu-neutral-variant-5);
|
|
125
|
+
|
|
52
126
|
/*
|
|
53
127
|
* Custom colors
|
|
54
128
|
*/
|
|
@@ -59,6 +133,18 @@
|
|
|
59
133
|
--color-on-myCustomColor1-container: var(
|
|
60
134
|
--mcu-on-my-custom-color-1-container
|
|
61
135
|
);
|
|
136
|
+
/* Shades */
|
|
137
|
+
--color-myCustomColor1-50: var(--mcu-my-custom-color-1-95);
|
|
138
|
+
--color-myCustomColor1-100: var(--mcu-my-custom-color-1-90);
|
|
139
|
+
--color-myCustomColor1-200: var(--mcu-my-custom-color-1-80);
|
|
140
|
+
--color-myCustomColor1-300: var(--mcu-my-custom-color-1-70);
|
|
141
|
+
--color-myCustomColor1-400: var(--mcu-my-custom-color-1-60);
|
|
142
|
+
--color-myCustomColor1-500: var(--mcu-my-custom-color-1-50);
|
|
143
|
+
--color-myCustomColor1-600: var(--mcu-my-custom-color-1-40);
|
|
144
|
+
--color-myCustomColor1-700: var(--mcu-my-custom-color-1-30);
|
|
145
|
+
--color-myCustomColor1-800: var(--mcu-my-custom-color-1-20);
|
|
146
|
+
--color-myCustomColor1-900: var(--mcu-my-custom-color-1-10);
|
|
147
|
+
--color-myCustomColor1-950: var(--mcu-my-custom-color-1-5);
|
|
62
148
|
|
|
63
149
|
--color-myCustomColor2: var(--mcu-my-custom-color-2);
|
|
64
150
|
--color-on-myCustomColor2: var(--mcu-on-my-custom-color-2);
|
|
@@ -66,11 +152,16 @@
|
|
|
66
152
|
--color-on-myCustomColor2-container: var(
|
|
67
153
|
--mcu-on-my-custom-color-2-container
|
|
68
154
|
);
|
|
69
|
-
|
|
70
|
-
--color-
|
|
71
|
-
--color-
|
|
72
|
-
--color-
|
|
73
|
-
--color-
|
|
74
|
-
|
|
75
|
-
);
|
|
155
|
+
/* Shades */
|
|
156
|
+
--color-myCustomColor2-50: var(--mcu-my-custom-color-2-95);
|
|
157
|
+
--color-myCustomColor2-100: var(--mcu-my-custom-color-2-90);
|
|
158
|
+
--color-myCustomColor2-200: var(--mcu-my-custom-color-2-80);
|
|
159
|
+
--color-myCustomColor2-300: var(--mcu-my-custom-color-2-70);
|
|
160
|
+
--color-myCustomColor2-400: var(--mcu-my-custom-color-2-60);
|
|
161
|
+
--color-myCustomColor2-500: var(--mcu-my-custom-color-2-50);
|
|
162
|
+
--color-myCustomColor2-600: var(--mcu-my-custom-color-2-40);
|
|
163
|
+
--color-myCustomColor2-700: var(--mcu-my-custom-color-2-30);
|
|
164
|
+
--color-myCustomColor2-800: var(--mcu-my-custom-color-2-20);
|
|
165
|
+
--color-myCustomColor2-900: var(--mcu-my-custom-color-2-10);
|
|
166
|
+
--color-myCustomColor2-950: var(--mcu-my-custom-color-2-5);
|
|
76
167
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-mcu",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "A React component library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -66,14 +66,14 @@
|
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"build": "tsup",
|
|
69
|
-
"
|
|
70
|
-
"
|
|
69
|
+
"lgtm": "pnpm run build && pnpm run check-format && pnpm run check-exports && pnpm run typecheck && pnpm run test",
|
|
70
|
+
"typecheck": "tsc",
|
|
71
71
|
"test": "vitest run",
|
|
72
72
|
"format": "prettier --write .",
|
|
73
73
|
"check-format": "prettier --check .",
|
|
74
74
|
"check-exports": "attw --pack . --ignore-rules cjs-resolves-to-esm no-resolution",
|
|
75
75
|
"release": "pnpm run build && changeset publish",
|
|
76
|
-
"local-release": "pnpm run
|
|
76
|
+
"local-release": "pnpm run lgtm && changeset version && changeset publish",
|
|
77
77
|
"storybook": "storybook dev -p 6006",
|
|
78
78
|
"build-storybook": "storybook build",
|
|
79
79
|
"chromatic": "chromatic --project-token $CHROMATIC_PROJECT_TOKEN",
|
package/src/tailwind.css
CHANGED
|
@@ -49,6 +49,80 @@
|
|
|
49
49
|
--color-scrim: var(--mcu-scrim);
|
|
50
50
|
--color-shadow: var(--mcu-shadow);
|
|
51
51
|
|
|
52
|
+
/* Shades */
|
|
53
|
+
|
|
54
|
+
--color-primary-50: var(--mcu-primary-95);
|
|
55
|
+
--color-primary-100: var(--mcu-primary-90);
|
|
56
|
+
--color-primary-200: var(--mcu-primary-80);
|
|
57
|
+
--color-primary-300: var(--mcu-primary-70);
|
|
58
|
+
--color-primary-400: var(--mcu-primary-60);
|
|
59
|
+
--color-primary-500: var(--mcu-primary-50);
|
|
60
|
+
--color-primary-600: var(--mcu-primary-40);
|
|
61
|
+
--color-primary-700: var(--mcu-primary-30);
|
|
62
|
+
--color-primary-800: var(--mcu-primary-20);
|
|
63
|
+
--color-primary-900: var(--mcu-primary-10);
|
|
64
|
+
--color-primary-950: var(--mcu-primary-5);
|
|
65
|
+
|
|
66
|
+
--color-secondary-50: var(--mcu-secondary-95);
|
|
67
|
+
--color-secondary-100: var(--mcu-secondary-90);
|
|
68
|
+
--color-secondary-200: var(--mcu-secondary-80);
|
|
69
|
+
--color-secondary-300: var(--mcu-secondary-70);
|
|
70
|
+
--color-secondary-400: var(--mcu-secondary-60);
|
|
71
|
+
--color-secondary-500: var(--mcu-secondary-50);
|
|
72
|
+
--color-secondary-600: var(--mcu-secondary-40);
|
|
73
|
+
--color-secondary-700: var(--mcu-secondary-30);
|
|
74
|
+
--color-secondary-800: var(--mcu-secondary-20);
|
|
75
|
+
--color-secondary-900: var(--mcu-secondary-10);
|
|
76
|
+
--color-secondary-950: var(--mcu-secondary-5);
|
|
77
|
+
|
|
78
|
+
--color-tertiary-50: var(--mcu-tertiary-95);
|
|
79
|
+
--color-tertiary-100: var(--mcu-tertiary-90);
|
|
80
|
+
--color-tertiary-200: var(--mcu-tertiary-80);
|
|
81
|
+
--color-tertiary-300: var(--mcu-tertiary-70);
|
|
82
|
+
--color-tertiary-400: var(--mcu-tertiary-60);
|
|
83
|
+
--color-tertiary-500: var(--mcu-tertiary-50);
|
|
84
|
+
--color-tertiary-600: var(--mcu-tertiary-40);
|
|
85
|
+
--color-tertiary-700: var(--mcu-tertiary-30);
|
|
86
|
+
--color-tertiary-800: var(--mcu-tertiary-20);
|
|
87
|
+
--color-tertiary-900: var(--mcu-tertiary-10);
|
|
88
|
+
--color-tertiary-950: var(--mcu-tertiary-5);
|
|
89
|
+
|
|
90
|
+
--color-error-50: var(--mcu-error-95);
|
|
91
|
+
--color-error-100: var(--mcu-error-90);
|
|
92
|
+
--color-error-200: var(--mcu-error-80);
|
|
93
|
+
--color-error-300: var(--mcu-error-70);
|
|
94
|
+
--color-error-400: var(--mcu-error-60);
|
|
95
|
+
--color-error-500: var(--mcu-error-50);
|
|
96
|
+
--color-error-600: var(--mcu-error-40);
|
|
97
|
+
--color-error-700: var(--mcu-error-30);
|
|
98
|
+
--color-error-800: var(--mcu-error-20);
|
|
99
|
+
--color-error-900: var(--mcu-error-10);
|
|
100
|
+
--color-error-950: var(--mcu-error-5);
|
|
101
|
+
|
|
102
|
+
--color-neutral-50: var(--mcu-neutral-95);
|
|
103
|
+
--color-neutral-100: var(--mcu-neutral-90);
|
|
104
|
+
--color-neutral-200: var(--mcu-neutral-80);
|
|
105
|
+
--color-neutral-300: var(--mcu-neutral-70);
|
|
106
|
+
--color-neutral-400: var(--mcu-neutral-60);
|
|
107
|
+
--color-neutral-500: var(--mcu-neutral-50);
|
|
108
|
+
--color-neutral-600: var(--mcu-neutral-40);
|
|
109
|
+
--color-neutral-700: var(--mcu-neutral-30);
|
|
110
|
+
--color-neutral-800: var(--mcu-neutral-20);
|
|
111
|
+
--color-neutral-900: var(--mcu-neutral-10);
|
|
112
|
+
--color-neutral-950: var(--mcu-neutral-5);
|
|
113
|
+
|
|
114
|
+
--color-neutral-variant-50: var(--mcu-neutral-variant-95);
|
|
115
|
+
--color-neutral-variant-100: var(--mcu-neutral-variant-90);
|
|
116
|
+
--color-neutral-variant-200: var(--mcu-neutral-variant-80);
|
|
117
|
+
--color-neutral-variant-300: var(--mcu-neutral-variant-70);
|
|
118
|
+
--color-neutral-variant-400: var(--mcu-neutral-variant-60);
|
|
119
|
+
--color-neutral-variant-500: var(--mcu-neutral-variant-50);
|
|
120
|
+
--color-neutral-variant-600: var(--mcu-neutral-variant-40);
|
|
121
|
+
--color-neutral-variant-700: var(--mcu-neutral-variant-30);
|
|
122
|
+
--color-neutral-variant-800: var(--mcu-neutral-variant-20);
|
|
123
|
+
--color-neutral-variant-900: var(--mcu-neutral-variant-10);
|
|
124
|
+
--color-neutral-variant-950: var(--mcu-neutral-variant-5);
|
|
125
|
+
|
|
52
126
|
/*
|
|
53
127
|
* Custom colors
|
|
54
128
|
*/
|
|
@@ -59,6 +133,18 @@
|
|
|
59
133
|
--color-on-myCustomColor1-container: var(
|
|
60
134
|
--mcu-on-my-custom-color-1-container
|
|
61
135
|
);
|
|
136
|
+
/* Shades */
|
|
137
|
+
--color-myCustomColor1-50: var(--mcu-my-custom-color-1-95);
|
|
138
|
+
--color-myCustomColor1-100: var(--mcu-my-custom-color-1-90);
|
|
139
|
+
--color-myCustomColor1-200: var(--mcu-my-custom-color-1-80);
|
|
140
|
+
--color-myCustomColor1-300: var(--mcu-my-custom-color-1-70);
|
|
141
|
+
--color-myCustomColor1-400: var(--mcu-my-custom-color-1-60);
|
|
142
|
+
--color-myCustomColor1-500: var(--mcu-my-custom-color-1-50);
|
|
143
|
+
--color-myCustomColor1-600: var(--mcu-my-custom-color-1-40);
|
|
144
|
+
--color-myCustomColor1-700: var(--mcu-my-custom-color-1-30);
|
|
145
|
+
--color-myCustomColor1-800: var(--mcu-my-custom-color-1-20);
|
|
146
|
+
--color-myCustomColor1-900: var(--mcu-my-custom-color-1-10);
|
|
147
|
+
--color-myCustomColor1-950: var(--mcu-my-custom-color-1-5);
|
|
62
148
|
|
|
63
149
|
--color-myCustomColor2: var(--mcu-my-custom-color-2);
|
|
64
150
|
--color-on-myCustomColor2: var(--mcu-on-my-custom-color-2);
|
|
@@ -66,11 +152,16 @@
|
|
|
66
152
|
--color-on-myCustomColor2-container: var(
|
|
67
153
|
--mcu-on-my-custom-color-2-container
|
|
68
154
|
);
|
|
69
|
-
|
|
70
|
-
--color-
|
|
71
|
-
--color-
|
|
72
|
-
--color-
|
|
73
|
-
--color-
|
|
74
|
-
|
|
75
|
-
);
|
|
155
|
+
/* Shades */
|
|
156
|
+
--color-myCustomColor2-50: var(--mcu-my-custom-color-2-95);
|
|
157
|
+
--color-myCustomColor2-100: var(--mcu-my-custom-color-2-90);
|
|
158
|
+
--color-myCustomColor2-200: var(--mcu-my-custom-color-2-80);
|
|
159
|
+
--color-myCustomColor2-300: var(--mcu-my-custom-color-2-70);
|
|
160
|
+
--color-myCustomColor2-400: var(--mcu-my-custom-color-2-60);
|
|
161
|
+
--color-myCustomColor2-500: var(--mcu-my-custom-color-2-50);
|
|
162
|
+
--color-myCustomColor2-600: var(--mcu-my-custom-color-2-40);
|
|
163
|
+
--color-myCustomColor2-700: var(--mcu-my-custom-color-2-30);
|
|
164
|
+
--color-myCustomColor2-800: var(--mcu-my-custom-color-2-20);
|
|
165
|
+
--color-myCustomColor2-900: var(--mcu-my-custom-color-2-10);
|
|
166
|
+
--color-myCustomColor2-950: var(--mcu-my-custom-color-2-5);
|
|
76
167
|
}
|