feat(Datepicker): add outOfMonth styling for days outside current month#1673
feat(Datepicker): add outOfMonth styling for days outside current month#1673NguyenTuMinhLong wants to merge 1 commit intothemesberg:mainfrom
Conversation
|
@NguyenTuMinhLong is attempting to deploy a commit to the Bergside Team on Vercel. A member of the Team first needs to authorize it. |
|
📝 WalkthroughWalkthroughThe datepicker now identifies days falling outside the currently viewed month by comparing each day's month against the viewDate month. A new theme class Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/ui/src/components/Datepicker/Views/Days.tsx`:
- Line 28: The new required property outOfMonth on DatepickerViewsDaysTheme
breaks the public DatepickerTheme shape; make outOfMonth optional (change
outOfMonth: string to outOfMonth?: string) in the DatepickerViewsDaysTheme
declaration so consumers who pass custom DatepickerTheme objects to the exported
DatepickerTheme (via views.days) won’t get TypeScript errors, and ensure any
internal uses handle undefined or provide a default value where referenced.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 22c30170-203e-42fd-8e2b-78877a07a5e4
📒 Files selected for processing (2)
packages/ui/src/components/Datepicker/Views/Days.tsxpackages/ui/src/components/Datepicker/theme.ts
| selected: string; | ||
| disabled: string; | ||
| today: string; | ||
| outOfMonth: string; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify whether DatepickerViewsDaysTheme is publicly exported/consumed.
# Expected:
# - If exported from package barrels, this is a user-facing breaking type change.
# - If internal-only, risk is limited.
rg -n "DatepickerViewsDaysTheme" -C3
rg -n "export .*Datepicker|from \".*Datepicker" packages/ui/src -C3
rg -n "DatepickerTheme" packages/ui/src/components/Datepicker -C3Repository: themesberg/flowbite-react
Length of output: 19717
🏁 Script executed:
# Get the full context of DatepickerViewsDaysTheme interface
sed -n '16,31p' packages/ui/src/components/Datepicker/Views/Days.tsxRepository: themesberg/flowbite-react
Length of output: 337
🏁 Script executed:
# Check the theme definition to see how outOfMonth is defined there
cat packages/ui/src/components/Datepicker/theme.tsRepository: themesberg/flowbite-react
Length of output: 3391
🏁 Script executed:
# Check if DatepickerViewsDaysTheme is re-exported anywhere else
rg "export.*DatepickerViewsDaysTheme|from.*Views/Days" packages/ui/srcRepository: themesberg/flowbite-react
Length of output: 386
Verify breaking change for public DatepickerTheme consumers.
Adding outOfMonth: string as a required field to DatepickerViewsDaysTheme breaks the public API. Although DatepickerViewsDaysTheme is not directly exported, it is embedded in the publicly exported DatepickerTheme interface (via views.days). Users providing custom DatepickerTheme objects without outOfMonth will encounter TypeScript compilation errors.
Consider making it optional (outOfMonth?: string) or document this as a breaking change.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/ui/src/components/Datepicker/Views/Days.tsx` at line 28, The new
required property outOfMonth on DatepickerViewsDaysTheme breaks the public
DatepickerTheme shape; make outOfMonth optional (change outOfMonth: string to
outOfMonth?: string) in the DatepickerViewsDaysTheme declaration so consumers
who pass custom DatepickerTheme objects to the exported DatepickerTheme (via
views.days) won’t get TypeScript errors, and ensure any internal uses handle
undefined or provide a default value where referenced.
Changes
outOfMonthclass support inDatepickerViewsDaysThemeisOutOfMonthinDays.tsxThis allows users to easily distinguish days from the previous/next month in the calendar grid.
Summary by CodeRabbit