refactor(ui): replace Tailwind utilities with local styles

This commit is contained in:
2026-08-09 13:58:13 +05:30
parent ff62918dbb
commit 5c2c6a0a8f
11 changed files with 473 additions and 184 deletions
+38
View File
@@ -3080,6 +3080,25 @@ test("layout components ship their own styles instead of Tailwind utilities", ()
}
});
test("remaining utility-styled components use local BEM styles", () => {
const migrated = ["List", "InputNumber", "Marquee", "TextLink", "Map", "SearchBox", "Timeline"];
const utilityMarkup =
/class(?::[^=\s]+)?=['"][^'"]*\b(?:flex|grid|w-full|items-center|justify-between|gap-[0-9]|p[xytrbl]?-[0-9]|m[xytrbl]?-[0-9]|text-(?:xs|sm|lg|xl)|rounded-(?:md|lg|xl|2xl|full)|border-[lrtbxy]?|bg-\[|shadow-(?:sm|lg)|size-[0-9])\b/;
for (const name of migrated) {
const source = readFileSync(uiComponentPath(name), "utf8");
const markup = source.split(/^\s{2,4}style \{/m)[0] ?? source;
expect({ name, hasStyleBlock: /^\s{2,4}style \{/m.test(source) }).toEqual({
name,
hasStyleBlock: true,
});
expect({ name, utilityMarkup: utilityMarkup.test(markup) }).toEqual({
name,
utilityMarkup: false,
});
}
});
test("every wire color token a component references is defined by the theme", () => {
/*
* Ten tokens were referenced by components and defined by nothing:
@@ -3179,6 +3198,25 @@ test("no component gains an output that nothing ever emits", () => {
expect(offenders).not.toContain("CustomScrollbar.scroll");
});
test("list selects items without hrefs as well as navigation items", async () => {
const source = readFileSync(uiComponentPath("List"), "utf8");
const dom = mountHtml(
await renderComponent(source, {
title: "Actions",
items: [{ label: "Run report" }],
}),
);
const root = dom.querySelector('[data-ui-component="List"]') as HTMLElement;
const events: Array<{ item: { label: string }; index: number }> = [];
root.addEventListener("select", (event) => {
events.push((event as CustomEvent).detail);
});
(root.querySelector("li") as HTMLElement).click();
expect(events).toEqual([{ item: { label: "Run report" }, index: 0 }]);
});
test("a declared output is never emitted as a hand-built CustomEvent", () => {
/*
* The failure this prevents is silent in both directions: the component