Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add first-class support for height media/container queries #13389

Open
wants to merge 4 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
46 changes: 46 additions & 0 deletions packages/tailwindcss/src/__snapshots__/intellisense.test.ts.snap
Expand Up @@ -2327,6 +2327,15 @@ exports[`getVariants 1`] = `
"sm",
],
},
{
"hasDash": true,
"isArbitrary": true,
"name": "max-h",
"selectors": [Function],
"values": [
"sm",
],
},
{
"hasDash": true,
"isArbitrary": false,
Expand All @@ -2343,6 +2352,22 @@ exports[`getVariants 1`] = `
"sm",
],
},
{
"hasDash": true,
"isArbitrary": false,
"name": "h-sm",
"selectors": [Function],
"values": [],
},
{
"hasDash": true,
"isArbitrary": true,
"name": "min-h",
"selectors": [Function],
"values": [
"sm",
],
},
{
"hasDash": true,
"isArbitrary": true,
Expand All @@ -2368,6 +2393,27 @@ exports[`getVariants 1`] = `
"4",
],
},
{
"hasDash": true,
"isArbitrary": true,
"name": "@max-h",
"selectors": [Function],
"values": [],
},
{
"hasDash": true,
"isArbitrary": true,
"name": "@-h",
"selectors": [Function],
"values": [],
},
{
"hasDash": true,
"isArbitrary": true,
"name": "@min-h",
"selectors": [Function],
"values": [],
},
{
"hasDash": true,
"isArbitrary": false,
Expand Down
176 changes: 175 additions & 1 deletion packages/tailwindcss/src/variants.test.ts
Expand Up @@ -998,7 +998,7 @@ test('sorting stacked min-* and max-* variants', () => {
}
@tailwind utilities;
`,
['min-sm:max-xl:flex', 'min-md:max-xl:flex', 'min-xs:max-xl:flex'],
['min-sm:max-xl:flex', 'min-md:max-xl:flex', 'min-xs:max-xl:flex', 'min-h-xs:max-xl:flex'],
),
).toMatchInlineSnapshot(`
":root {
Expand Down Expand Up @@ -1031,6 +1031,14 @@ test('sorting stacked min-* and max-* variants', () => {
display: flex;
}
}
}

@media (width < 1280px) {
@media (height >= 280px) {
.min-h-xs\\:max-xl\\:flex {
display: flex;
}
}
}"
`)
})
Expand Down Expand Up @@ -1062,6 +1070,21 @@ test('min, max and unprefixed breakpoints', () => {
'min-sm:flex',
'sm:flex',
'lg:flex',
'h-sm:flex',
'h-lg:flex',
'min-h-lg:flex',
'max-h-lg:flex',
'h-sm:md:flex',
'h-lg:min-md:flex',
'h-lg:max-lg:flex',
'min-h-lg:md:flex',
'max-h-lg:lg:flex',
'min-h-lg:max-md:flex',
'max-h-lg:min-lg:flex',
'min-lg:max-h-md:flex',
'max-lg:min-h-lg:flex',
'min-[900px]:max-h-[700px]:flex',
'max-[700px]:min-h-[900px]:flex',
],
),
).toMatchInlineSnapshot(`
Expand Down Expand Up @@ -1095,6 +1118,12 @@ test('min, max and unprefixed breakpoints', () => {
}
}

@media (height < 1024px) {
.max-h-lg\\:flex {
display: flex;
}
}

@media (width >= 640px) {
.min-sm\\:flex {
display: flex;
Expand Down Expand Up @@ -1125,16 +1154,122 @@ test('min, max and unprefixed breakpoints', () => {
}
}

@media (height < 700px) {
@media (width >= 900px) {
.min-\\[900px\\]\\:max-h-\\[700px\\]\\:flex {
display: flex;
}
}
}

@media (width >= 1024px) {
.lg\\:flex {
display: flex;
}
}

@media (width >= 1024px) {
@media (height < 1024px) {
.max-h-lg\\:lg\\:flex {
display: flex;
}
}
}

@media (width >= 1024px) {
.min-lg\\:flex {
display: flex;
}
}

@media (width >= 1024px) {
@media (height < 1024px) {
.max-h-lg\\:min-lg\\:flex {
display: flex;
}
}
}

@media (height < 768px) {
@media (width >= 1024px) {
.min-lg\\:max-h-md\\:flex {
display: flex;
}
}
}

@media (height >= 1024px) {
.h-lg\\:flex {
display: flex;
}
}

@media (width < 1024px) {
@media (height >= 1024px) {
.h-lg\\:max-lg\\:flex {
display: flex;
}
}
}

@media (width >= 768px) {
@media (height >= 1024px) {
.h-lg\\:min-md\\:flex {
display: flex;
}
}
}

@media (height >= 640px) {
.h-sm\\:flex {
display: flex;
}
}

@media (width >= 768px) {
@media (height >= 640px) {
.h-sm\\:md\\:flex {
display: flex;
}
}
}

@media (height >= 900px) {
@media (width < 700px) {
.max-\\[700px\\]\\:min-h-\\[900px\\]\\:flex {
display: flex;
}
}
}

@media (height >= 1024px) {
.min-h-lg\\:flex {
display: flex;
}
}

@media (height >= 1024px) {
@media (width < 1024px) {
.max-lg\\:min-h-lg\\:flex {
display: flex;
}
}
}

@media (width < 768px) {
@media (height >= 1024px) {
.min-h-lg\\:max-md\\:flex {
display: flex;
}
}
}

@media (width >= 768px) {
@media (height >= 1024px) {
.min-h-lg\\:md\\:flex {
display: flex;
}
}
}"
`)
})
Expand Down Expand Up @@ -1570,6 +1705,21 @@ test('container queries', () => {
'@max-lg/name:flex',
'@max-[123px]:flex',
'@max-[456px]/name:flex',

'@h-lg:flex',
'@h-lg/name:flex',
'@h-[123px]:flex',
'@h-[456px]/name:flex',

'@min-h-lg:flex',
'@min-h-lg/name:flex',
'@min-h-[123px]:flex',
'@min-h-[456px]/name:flex',

'@max-h-lg:flex',
'@max-h-lg/name:flex',
'@max-h-[123px]:flex',
'@max-h-[456px]/name:flex',
],
),
).toMatchInlineSnapshot(`
Expand Down Expand Up @@ -1647,6 +1797,30 @@ test('container queries', () => {
.\\@min-lg\\/name\\:flex {
display: flex;
}
}

@container name (height < 456px) {
.\\@max-h-\\[456px\\]\\/name\\:flex {
display: flex;
}
}

@container (height < 123px) {
.\\@max-h-\\[123px\\]\\:flex {
display: flex;
}
}

@container (height >= 123px) {
.\\@min-h-\\[123px\\]\\:flex {
display: flex;
}
}

@container name (height >= 456px) {
.\\@min-h-\\[456px\\]\\/name\\:flex {
display: flex;
}
}"
`)
})
Expand Down