Skip to content

Commit 3fb6902

Browse files
authored
Make flex a static utility (#15014)
This PR makes `flex` a static utility, which also means that it is located near the other static `display` utilities. This is possible because we changed how `parseCandidate` returns an array of utilities instead of a single utility. This makes the code more consistent and a bit easier to understand. Bonus: turns out that `flex` was never suggested to intellisense, but now it is!
1 parent 5edf6c7 commit 3fb6902

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Ensure `flex` is suggested ([#15014](https://github.com/tailwindlabs/tailwindcss/pull/15014))
13+
1014
### Changed
1115

1216
- Bring back support for color opacity modifiers to read from `--opacity-*` theme values ([#14278](https://github.com/tailwindlabs/tailwindcss/pull/14278))

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3718,6 +3718,7 @@ exports[`getClassList 1`] = `
37183718
"fill-transparent/95",
37193719
"fill-transparent/100",
37203720
"fixed",
3721+
"flex",
37213722
"flex-auto",
37223723
"flex-col",
37233724
"flex-col-reverse",

packages/tailwindcss/src/utilities.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,7 @@ export function createUtilities(theme: Theme) {
812812
staticUtility('table-row-group', [['display', 'table-row-group']])
813813
staticUtility('table-row', [['display', 'table-row']])
814814
staticUtility('flow-root', [['display', 'flow-root']])
815+
staticUtility('flex', [['display', 'flex']])
815816
staticUtility('grid', [['display', 'grid']])
816817
staticUtility('inline-grid', [['display', 'inline-grid']])
817818
staticUtility('contents', [['display', 'contents']])
@@ -932,10 +933,7 @@ export function createUtilities(theme: Theme) {
932933
// generate `flex: 1`. Our `functionalUtility` helper can't handle two properties
933934
// using the same namespace, so we handle this one manually.
934935
utilities.functional('flex', (candidate) => {
935-
if (!candidate.value) {
936-
if (candidate.modifier) return
937-
return [decl('display', 'flex')]
938-
}
936+
if (!candidate.value) return
939937

940938
if (candidate.value.kind === 'arbitrary') {
941939
if (candidate.modifier) return

0 commit comments

Comments
 (0)