Skip to content

Commit d6fb336

Browse files
committed
feat: box-sizing
1 parent b3faba3 commit d6fb336

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/__tests__/vendor/tailwind/layout.test.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,12 @@ describe("Layout - Box Decoration Break", () => {
188188
describe("Layout - Box Sizing", () => {
189189
test("box-border", async () => {
190190
expect(await renderCurrentTest()).toStrictEqual({
191-
props: {},
192-
warnings: { properties: ["box-sizing"] },
191+
props: { style: { boxSizing: "border-box" } },
193192
});
194193
});
195194
test("box-content", async () => {
196195
expect(await renderCurrentTest()).toStrictEqual({
197-
props: {},
198-
warnings: { properties: ["box-sizing"] },
196+
props: { style: { boxSizing: "content-box" } },
199197
});
200198
});
201199
});

src/compiler/declarations.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ const parsers: {
148148
"border-width": parseBorderWidth,
149149
"bottom": parseSizeDeclaration,
150150
"box-shadow": parseBoxShadow,
151+
"box-sizing": parseBoxSizing,
151152
"caret-color": parseColorOrAutoDeclaration,
152153
"color": parseFontColorDeclaration,
153154
"column-gap": parseGap,
@@ -2360,6 +2361,18 @@ export function parseBoxShadow(
23602361
}
23612362
}
23622363

2364+
export function parseBoxSizing(
2365+
declaration: DeclarationType<"box-sizing">,
2366+
builder: StylesheetBuilder,
2367+
) {
2368+
if (["border-box", "content-box"].includes(declaration.value)) {
2369+
return declaration.value;
2370+
}
2371+
2372+
builder.addWarning("value", declaration.value);
2373+
return undefined;
2374+
}
2375+
23632376
export function parseDisplay(
23642377
{ value }: DeclarationType<"display">,
23652378
builder: StylesheetBuilder,

0 commit comments

Comments
 (0)