From 3fb6902f08fc7b4e3cee5a52ae32b3c37dc16729 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Fri, 15 Nov 2024 18:02:57 +0100 Subject: [PATCH] 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! --- CHANGELOG.md | 4 ++++ .../tailwindcss/src/__snapshots__/intellisense.test.ts.snap | 1 + packages/tailwindcss/src/utilities.ts | 6 ++---- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dafd6313..e5dbf0cd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Ensure `flex` is suggested ([#15014](https://github.com/tailwindlabs/tailwindcss/pull/15014)) + ### Changed - Bring back support for color opacity modifiers to read from `--opacity-*` theme values ([#14278](https://github.com/tailwindlabs/tailwindcss/pull/14278)) diff --git a/packages/tailwindcss/src/__snapshots__/intellisense.test.ts.snap b/packages/tailwindcss/src/__snapshots__/intellisense.test.ts.snap index 0ccdfa905..0f4b57365 100644 --- a/packages/tailwindcss/src/__snapshots__/intellisense.test.ts.snap +++ b/packages/tailwindcss/src/__snapshots__/intellisense.test.ts.snap @@ -3718,6 +3718,7 @@ exports[`getClassList 1`] = ` "fill-transparent/95", "fill-transparent/100", "fixed", + "flex", "flex-auto", "flex-col", "flex-col-reverse", diff --git a/packages/tailwindcss/src/utilities.ts b/packages/tailwindcss/src/utilities.ts index 2e2397cae..b03b51074 100644 --- a/packages/tailwindcss/src/utilities.ts +++ b/packages/tailwindcss/src/utilities.ts @@ -812,6 +812,7 @@ export function createUtilities(theme: Theme) { staticUtility('table-row-group', [['display', 'table-row-group']]) staticUtility('table-row', [['display', 'table-row']]) staticUtility('flow-root', [['display', 'flow-root']]) + staticUtility('flex', [['display', 'flex']]) staticUtility('grid', [['display', 'grid']]) staticUtility('inline-grid', [['display', 'inline-grid']]) staticUtility('contents', [['display', 'contents']]) @@ -932,10 +933,7 @@ export function createUtilities(theme: Theme) { // generate `flex: 1`. Our `functionalUtility` helper can't handle two properties // using the same namespace, so we handle this one manually. utilities.functional('flex', (candidate) => { - if (!candidate.value) { - if (candidate.modifier) return - return [decl('display', 'flex')] - } + if (!candidate.value) return if (candidate.value.kind === 'arbitrary') { if (candidate.modifier) return