Style v2 with tailwind-variants/lite
The numbered v2 token scales (text-1…9, rounded-1…6, shadow-1…6) share a prefix with the color/utility namespaces, and tailwind-merge (which tailwind-variants runs by default) cannot tell a numeric text-3 from a color step, so it silently dropped the size whenever a text-<color> was present. Switch the v2 kit to the merge-free tailwind-variants/lite entrypoint (added in v3): upgrade tailwind-variants to ^3.2.2, import tv/VariantProps from tailwind-variants/lite in the typography primitives, and drop the per-call twMerge:false. The legacy v1 kit stays on tailwind-variants (merge intact). Document the rationale in ui.md and add a packages/ui/src/v2 ESLint guard that forbids tailwind-variants, tailwind-merge, and clsx. Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
@@ -68,6 +68,34 @@ export default defineConfig([
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
// The v2 kit styles with tailwind-variants/lite (no tailwind-merge): the
|
||||
// numbered scales (text-1…9, rounded-1…6, shadow-1…6) collide with the
|
||||
// color/utility namespaces and tailwind-merge would drop the scale class.
|
||||
files: ["packages/ui/src/v2/**"],
|
||||
rules: {
|
||||
"no-restricted-imports": [
|
||||
"error",
|
||||
{
|
||||
paths: [
|
||||
{
|
||||
name: "tailwind-variants",
|
||||
message:
|
||||
"Import from tailwind-variants/lite (no tailwind-merge) in v2.",
|
||||
},
|
||||
{
|
||||
name: "tailwind-merge",
|
||||
message: "The v2 kit does not use tailwind-merge.",
|
||||
},
|
||||
{
|
||||
name: "clsx",
|
||||
message: "The v2 kit does not use clsx; style via tailwind-variants/lite.",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: reactDirs,
|
||||
ignores: ["packages/ui/tailwind.config.js"],
|
||||
|
||||
Reference in New Issue
Block a user