Skip to content

Commit d177f4c

Browse files
committed
use isAlpha(…)
1 parent 2770263 commit d177f4c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/tailwindcss/src/variants.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import type { Theme } from './theme'
1616
import { compareBreakpoints } from './utils/compare-breakpoints'
1717
import { DefaultMap } from './utils/default-map'
1818
import { isPositiveInteger } from './utils/infer-data-type'
19+
import { isAlpha } from './utils/is-alpha'
1920
import { segment } from './utils/segment'
2021

2122
type VariantFn<T extends Variant['kind']> = (
@@ -714,9 +715,9 @@ export function createVariants(theme: Theme): Variants {
714715
variants.functional('in', (ruleNode, variant) => {
715716
if (!variant.value || variant.modifier) return null
716717

717-
// Named values should be alphanumeric. This prevents `in-foo-bar` from
718-
// being used as a variant.
719-
if (variant.value.kind === 'named' && !/^[a-zA-Z]+$/i.test(variant.value.value)) {
718+
// Named values should be alpha (tag selector). This prevents `in-foo-bar`
719+
// from being used as a variant.
720+
if (variant.value.kind === 'named' && !isAlpha(variant.value.value)) {
720721
return null
721722
}
722723

0 commit comments

Comments
 (0)