Skip to content

Commit

Permalink
Merge pull request #478 from sherlockdoyle/main
Browse files Browse the repository at this point in the history
Adds support for logical border color properties
  • Loading branch information
dcastil authored Oct 3, 2024
2 parents 63b477e + b93b2d9 commit 9ec6338
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/lib/default-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,16 @@ export const getDefaultConfig = () => {
* @see https://tailwindcss.com/docs/border-color
*/
'border-color-y': [{ 'border-y': [borderColor] }],
/**
* Border Color S
* @see https://tailwindcss.com/docs/border-color
*/
'border-color-s': [{ 'border-s': [borderColor] }],
/**
* Border Color E
* @see https://tailwindcss.com/docs/border-color
*/
'border-color-e': [{ 'border-e': [borderColor] }],
/**
* Border Color Top
* @see https://tailwindcss.com/docs/border-color
Expand Down Expand Up @@ -1821,6 +1831,8 @@ export const getDefaultConfig = () => {
'border-w-x': ['border-w-r', 'border-w-l'],
'border-w-y': ['border-w-t', 'border-w-b'],
'border-color': [
'border-color-s',
'border-color-e',
'border-color-t',
'border-color-r',
'border-color-b',
Expand Down
2 changes: 2 additions & 0 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,10 @@ export type DefaultClassGroupIds =
| 'blur'
| 'border-collapse'
| 'border-color-b'
| 'border-color-e'
| 'border-color-l'
| 'border-color-r'
| 'border-color-s'
| 'border-color-t'
| 'border-color-x'
| 'border-color-y'
Expand Down
2 changes: 2 additions & 0 deletions tests/class-map.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ test('class map has correct class groups at first part', () => {
'border-collapse',
'border-color',
'border-color-b',
'border-color-e',
'border-color-l',
'border-color-r',
'border-color-s',
'border-color-t',
'border-color-x',
'border-color-y',
Expand Down
2 changes: 2 additions & 0 deletions tests/per-side-border-colors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ import { twMerge } from '../src'
test('merges classes with per-side border colors correctly', () => {
expect(twMerge('border-t-some-blue border-t-other-blue')).toBe('border-t-other-blue')
expect(twMerge('border-t-some-blue border-some-blue')).toBe('border-some-blue')
expect(twMerge('border-some-blue border-s-some-blue')).toBe('border-some-blue border-s-some-blue')
expect(twMerge('border-e-some-blue border-some-blue')).toBe('border-some-blue')
})

0 comments on commit 9ec6338

Please sign in to comment.