Skip to content

Commit bbdaa69

Browse files
committed
wrap new scrollbar utilities in feature flag
1 parent 9c86a5a commit bbdaa69

2 files changed

Lines changed: 30 additions & 27 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export const enableContainerSizeUtility = process.env.FEATURES_ENV !== 'stable'
2+
export const enableScrollbarUtilities = process.env.FEATURES_ENV !== 'stable'

packages/tailwindcss/src/utilities.ts

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from './ast'
1313
import type { Candidate, CandidateModifier, NamedUtilityValue } from './candidate'
1414
import type { DesignSystem } from './design-system'
15-
import { enableContainerSizeUtility } from './feature-flags'
15+
import { enableContainerSizeUtility, enableScrollbarUtilities } from './feature-flags'
1616
import type { Theme, ThemeKey } from './theme'
1717
import { compareBreakpoints } from './utils/compare-breakpoints'
1818
import { DefaultMap } from './utils/default-map'
@@ -2209,35 +2209,37 @@ export function createUtilities(theme: Theme) {
22092209
staticUtility('scroll-auto', [['scroll-behavior', 'auto']])
22102210
staticUtility('scroll-smooth', [['scroll-behavior', 'smooth']])
22112211

2212-
staticUtility('scrollbar-auto', [['scrollbar-width', 'auto']])
2213-
staticUtility('scrollbar-thin', [['scrollbar-width', 'thin']])
2214-
staticUtility('scrollbar-none', [['scrollbar-width', 'none']])
2212+
if (enableScrollbarUtilities) {
2213+
staticUtility('scrollbar-auto', [['scrollbar-width', 'auto']])
2214+
staticUtility('scrollbar-thin', [['scrollbar-width', 'thin']])
2215+
staticUtility('scrollbar-none', [['scrollbar-width', 'none']])
22152216

2216-
{
2217-
let scrollbarColorProperties = () => {
2218-
return atRoot([
2219-
property('--tw-scrollbar-thumb', '#0000', '<color>'),
2220-
property('--tw-scrollbar-track', '#0000', '<color>'),
2221-
])
2222-
}
2217+
{
2218+
let scrollbarColorProperties = () => {
2219+
return atRoot([
2220+
property('--tw-scrollbar-thumb', '#0000', '<color>'),
2221+
property('--tw-scrollbar-track', '#0000', '<color>'),
2222+
])
2223+
}
22232224

2224-
colorUtility('scrollbar-thumb', {
2225-
themeKeys: ['--scrollbar-thumb-color', '--color'],
2226-
handle: (value) => [
2227-
scrollbarColorProperties(),
2228-
decl('--tw-scrollbar-thumb', value),
2229-
decl('scrollbar-color', 'var(--tw-scrollbar-thumb) var(--tw-scrollbar-track)'),
2230-
],
2231-
})
2225+
colorUtility('scrollbar-thumb', {
2226+
themeKeys: ['--scrollbar-thumb-color', '--color'],
2227+
handle: (value) => [
2228+
scrollbarColorProperties(),
2229+
decl('--tw-scrollbar-thumb', value),
2230+
decl('scrollbar-color', 'var(--tw-scrollbar-thumb) var(--tw-scrollbar-track)'),
2231+
],
2232+
})
22322233

2233-
colorUtility('scrollbar-track', {
2234-
themeKeys: ['--scrollbar-track-color', '--color'],
2235-
handle: (value) => [
2236-
scrollbarColorProperties(),
2237-
decl('--tw-scrollbar-track', value),
2238-
decl('scrollbar-color', 'var(--tw-scrollbar-thumb) var(--tw-scrollbar-track)'),
2239-
],
2240-
})
2234+
colorUtility('scrollbar-track', {
2235+
themeKeys: ['--scrollbar-track-color', '--color'],
2236+
handle: (value) => [
2237+
scrollbarColorProperties(),
2238+
decl('--tw-scrollbar-track', value),
2239+
decl('scrollbar-color', 'var(--tw-scrollbar-thumb) var(--tw-scrollbar-track)'),
2240+
],
2241+
})
2242+
}
22412243
}
22422244

22432245
staticUtility('truncate', [

0 commit comments

Comments
 (0)