Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#69] Tailwind 4 upgrade #81

Merged
merged 6 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions config/tailwind/container.js

This file was deleted.

34 changes: 17 additions & 17 deletions config/tailwind/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ export default plugin(({ addComponents }) => {
'dialog-backdrop-out var(--dialog-transition-duration, 300ms) cubic-bezier(0.2, 0, 0.13, 1) forwards',
},
},
// Animation Keyframes
'@keyframes dialog-in': {
'0%': { transform: 'translateY(2rem)', opacity: 0 },
'100%': { transform: 'translateY(0px)', opacity: 1 },
},
'@keyframes dialog-out': {
'0%': { transform: 'scale(1)', opacity: 1 },
'100%': { transform: 'scale(0.9)', opacity: 0 },
},
'@keyframes dialog-backdrop-in': {
'0%': { opacity: 0 },
'100%': { opacity: 1 },
},
'@keyframes dialog-backdrop-out': {
'0%': { opacity: 1 },
'100%': { opacity: 0 },
},
},
// Animation Keyframes
'@keyframes dialog-in': {
'0%': { transform: 'translateY(2rem)', opacity: '0' },
'100%': { transform: 'translateY(0px)', opacity: '1' },
},
'@keyframes dialog-out': {
'0%': { transform: 'scale(1)', opacity: '1' },
'100%': { transform: 'scale(0.9)', opacity: '0' },
},
'@keyframes dialog-backdrop-in': {
'0%': { opacity: '0' },
'100%': { opacity: '1' },
},
'@keyframes dialog-backdrop-out': {
'0%': { opacity: '1' },
'100%': { opacity: '0' },
Comment on lines +26 to +42
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CleanShot 2025-02-20 at 06 59 39@2x

These keyframes weren't ending up in the final CSS and I was also getting some Typescript errors.

I don't think nesting keyframes within a class is technically valid. Seems like TW4 must be a bit more strict.

The issue was resolved by moving them outside of .dialog and making the opacity values strings.

},
})
})
11 changes: 8 additions & 3 deletions config/tailwind/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,14 @@ export default plugin(({ addComponents }) => {
},
},
// required field styles
'&[data-required] label .field-label::after': {
'@apply content-["*"] text-red-600 align-super text-xs ml-2 font-medium dark:text-red-300':
{},
'&[data-required] label .field-label': {
'&::after': {
'@apply content-["*"] text-red-600 align-super text-xs ml-2 font-medium':
{},
},
'.dark &::after': {
'@apply text-red-300': {},
},
Comment on lines +68 to +75
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Nesting dark:text-red-300 inside of the ::after selector was throwing the above error.

TW 4 docs recommend this setting to restore the TW 3 "selector" strategy for dark mode.

@custom-variant dark (&:where(.dark, .dark *));

However, I don't think TW3 used :where().

where() seems to confuse TW's compiler when it's nested inside of ::after

},
'&[data-required="long"] label .field-label::after': {
'@apply content-["*Required"]': {},
Expand Down
Loading