feat(datepicker): add showOutsideDays prop and css fixes
Changes
- Added
showOutsideDaysprop to control visibility of out-of-month days. - Updated styles for out-of-month and disabled days.
- Handled view change when out-of-month days are clicked.
Fixes
Fixes #1647
Summary by CodeRabbit
-
New Features
- Added a
showOutsideDaysoption to Datepicker to toggle display of adjacent-month days. - Calendar view now auto-synchronizes to the selected date so the displayed month matches your choice.
- Added a
-
Styling
- Improved appearance and behavior for outside, hidden, and disabled day states for clearer visual cues.
-
Documentation
- Added docs, interactive example, and updated Storybook stories demonstrating
showOutsideDays.
- Added docs, interactive example, and updated Storybook stories demonstrating
-
Chores
- Added a release changeset for the datepicker update.
@Karan5656 is attempting to deploy a commit to the Bergside Team on Vercel.
A member of the Team first needs to authorize it.
π¦ Changeset detected
Latest commit: feb354463d47f4f9d57ee2f9cfc10bbeab8753c1
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
No actionable comments were generated in the recent review. π
βΉοΈ Recent review info
βοΈ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c155ae18-29d8-43cd-8278-e8fa72eb4897
π₯ Commits
Reviewing files that changed from the base of the PR and between 22413a6b740238f613f226b963e1984677aaafe4 and feb354463d47f4f9d57ee2f9cfc10bbeab8753c1.
π Files selected for processing (1)
.changeset/flat-spoons-double.md
β Files skipped from review due to trivial changes (1)
- .changeset/flat-spoons-double.md
π Walkthrough
Walkthrough
Added a new Datepicker prop showOutsideDays (default true), propagated through context to Views/Days; Days now detects outside-month days and can hide or style them. Selection now syncs viewDate with selected date. Storybook, docs, and examples updated to demonstrate the feature.
Changes
| Cohort / File(s) | Summary |
|---|---|
Storybook Stories apps/storybook/src/Datepicker.stories.tsx |
Added showOutsideDays: true to multiple story .args for consistent rendering. |
Docs & Examples apps/web/content/docs/components/datepicker.mdx, apps/web/examples/datepicker/datepicker.showOutsideDays.tsx, apps/web/examples/datepicker/index.ts |
Added "Outside days" docs section, new example datepicker.showOutsideDays.tsx demonstrating showOutsideDays={false}, and re-exported the example. |
Datepicker Component packages/ui/src/components/Datepicker/Datepicker.tsx |
Added prop showOutsideDays?: boolean (default true) and passed it into context; changeSelectedDate() now calls setViewDate(date) when a date is selected. |
Context & Views packages/ui/src/components/Datepicker/DatepickerContext.tsx, packages/ui/src/components/Datepicker/Views/Days.tsx, packages/ui/src/components/Datepicker/theme.ts |
Extended context with showOutsideDays; Days uses isMonthEqual to detect outside-month days, computes isHidden = outside && !showOutsideDays, prevents clicks on hidden days, adjusts disabled logic, and adds outside/hidden theme keys; theme strings updated for disabled/outside/hidden states. |
Changeset .changeset/flat-spoons-double.md |
New changeset declaring the feature release for datepicker and related CSS fixes. |
Sequence Diagram(s)
sequenceDiagram
participant User
participant Datepicker as Datepicker(Component)
participant Context as DatepickerContext
participant DaysView as Days(Views/Days)
User->>Datepicker: click day (date)
Datepicker->>Context: changeSelectedDate(date)
Context->>Context: setSelectedDate(date)\nsetViewDate(date)
Context->>DaysView: provide showOutsideDays, viewDate, selectedDate
DaysView->>DaysView: compute isOutsideDay via isMonthEqual\ndetermine isHidden = isOutsideDay && !showOutsideDays
DaysView-->>User: render day cells (apply outside/hidden styles, block clicks if hidden)
Estimated Code Review Effort
π― 3 (Moderate) | β±οΈ ~20 minutes
Possibly Related PRs
#1627: Modifies Datepicker day rendering and theme keys; touches similar theme and day-rendering logic.#1457: Adds or usesisMonthEqualutilities for month-level comparisons used in Days view.#1587: Alters Datepicker day-rendering/disable logic and prop propagation; overlaps with showOutsideDays behavior.
Suggested Reviewers
- rluders
- SutuSebastian
- robert1508
Poem
π° I hopped through code to dim some days,
Outside-month numbers now fade their rays.
A prop, a theme, a gentler sightβ
Calendars breathe in softer light.
Hop, hop, hooray β the months feel right!
π₯ Pre-merge checks | β 4 | β 1
β Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | β οΈ Warning | Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
β Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | β Passed | Check skipped - CodeRabbitβs high-level summary is enabled. |
| Title check | β Passed | The title 'feat(datepicker): add showOutsideDays prop and css fixes' accurately summarizes the main changes: adding a new prop to control out-of-month day visibility and updating related CSS styling. |
| Linked Issues check | β Passed | The PR fully addresses issue #1647 requirements: adds showOutsideDays prop to control visibility, implements visual de-emphasis of out-of-month days, provides theme tokens (outside/hidden), keeps days interactive, and ensures selected styling overrides. |
| Out of Scope Changes check | β Passed | All changes are directly scoped to implementing the showOutsideDays feature and its styling requirements; no unrelated modifications detected. |
βοΈ Tip: You can configure your own custom pre-merge checks in the settings.
β¨ Finishing Touches
π§ͺ Generate unit tests (beta)
- [ ] Create PR with unit tests
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 @coderabbitai help to get the list of available commands and usage tips.
Superseded by #1682, which covers this scope and passes checks. Thanks for the attempt - please rebase onto #1682 if anything is missing there.