Skip to content

Commit 85dc3db

Browse files
Add new transition-discrete and transition-normal utilities (#15051)
This PR adds two new utilities for the `transition-behavior` property: | Name | Definition | | --- | --- | | `transition-discrete` | `transition-behavior: allow-discrete` | | `transition-normal` | `transition-behavior: normal` | # Test plan Not a lot too test here, but verified in the browser that these properties generate correct CSS: <img width="301" alt="image" src="https://github.com/user-attachments/assets/db314750-e129-47d6-b605-d3b367ae81a4"> <img width="253" alt="image" src="https://github.com/user-attachments/assets/24da5a6e-0b6a-48aa-a042-5ec19773bc6b"> --------- Co-authored-by: Adam Wathan <[email protected]>
1 parent 75deeca commit 85dc3db

File tree

5 files changed

+21
-0
lines changed

5 files changed

+21
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
- Bundle `@tailwindcss/forms`, `@tailwindcss/typography`, and `@tailwindcss/aspect-ratio` with the standalone CLI ([#15028](https://github.com/tailwindlabs/tailwindcss/pull/15028))
1616
- Allow `addUtilities()` and `addComponents()` to work with child combinators and other complex selectors ([#15029](https://github.com/tailwindlabs/tailwindcss/pull/15029))
1717
- Support colors that use `<alpha-value>` in JS configs and plugins ([#15033](https://github.com/tailwindlabs/tailwindcss/pull/15033))
18+
- Add new `transition-discrete` and `transition-normal` utilities for `transition-behavior` ([#15051](https://github.com/tailwindlabs/tailwindcss/pull/15051))
1819
- _Upgrade (experimental)_: Migrate `[&>*]` to the `*` variant ([#15022](https://github.com/tailwindlabs/tailwindcss/pull/15022))
1920
- _Upgrade (experimental)_: Migrate `[&_*]` to the `**` variant ([#15022](https://github.com/tailwindlabs/tailwindcss/pull/15022))
2021
- _Upgrade (experimental)_: Warn when trying to migrating a project that is not on Tailwind CSS v3 ([#15015](https://github.com/tailwindlabs/tailwindcss/pull/15015))

packages/tailwindcss/src/__snapshots__/intellisense.test.ts.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7176,7 +7176,9 @@ exports[`getClassList 1`] = `
71767176
"transition",
71777177
"transition-all",
71787178
"transition-colors",
7179+
"transition-discrete",
71797180
"transition-none",
7181+
"transition-normal",
71807182
"transition-opacity",
71817183
"transition-shadow",
71827184
"transition-transform",

packages/tailwindcss/src/property-order.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ export default [
339339
'backdrop-filter',
340340

341341
'transition-property',
342+
'transition-behavior',
342343
'transition-delay',
343344
'transition-duration',
344345
'transition-timing-function',

packages/tailwindcss/src/utilities.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14463,6 +14463,20 @@ test('transition', async () => {
1446314463
).toEqual('')
1446414464
})
1446514465

14466+
test('transition-behavior', async () => {
14467+
expect(await run(['transition-discrete', 'transition-normal'])).toMatchInlineSnapshot(`
14468+
".transition-discrete {
14469+
transition-behavior: allow-discrete;
14470+
}
14471+
14472+
.transition-normal {
14473+
transition-behavior: normal;
14474+
}"
14475+
`)
14476+
14477+
expect(await run(['-transition-discrete', '-transition-normal'])).toEqual('')
14478+
})
14479+
1446614480
test('delay', async () => {
1446714481
expect(await run(['delay-123', 'delay-200', 'delay-[300ms]'])).toMatchInlineSnapshot(`
1446814482
".delay-123 {

packages/tailwindcss/src/utilities.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3552,6 +3552,9 @@ export function createUtilities(theme: Theme) {
35523552
],
35533553
})
35543554

3555+
staticUtility('transition-discrete', [['transition-behavior', 'allow-discrete']])
3556+
staticUtility('transition-normal', [['transition-behavior', 'normal']])
3557+
35553558
functionalUtility('delay', {
35563559
handleBareValue: ({ value }) => {
35573560
if (!isPositiveInteger(value)) return null

0 commit comments

Comments
 (0)