Repository navigation
feat(datetime): enable range selection #31581
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
Open
OS-susmitabhowmik
wants to merge
63
commits into
next
Choose a base branch
from
ROU-12704-datepicker-range
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
478544c
feat(datetime): add DatetimeRangeParts interface for range selection
OS-susmitabhowmik a507212
feat(datetime): add selectionMode prop and deprecate multiple
OS-susmitabhowmik 1ab6897
feat(datetime): add range flags to getCalendarDayState
OS-susmitabhowmik bb61d21
feat(datetime): implement range selection logic
OS-susmitabhowmik 15aa4ae
feat(datetime): update calendar rendering for range selection
OS-susmitabhowmik cca6ee5
feat(datetime): add range highlight track styles
OS-susmitabhowmik f03eb37
feat(datetime): update header and datetime-button for range display
OS-susmitabhowmik 26b65a7
feat(datetime): disable confirm button until range is complete
OS-susmitabhowmik 8eb4d4e
test(datetime): add range and range-styling test pages
OS-susmitabhowmik 4d7abfc
fix(datetime): align range track styles with Figma design
OS-susmitabhowmik 9385623
fix(datetime): fix range style issues found during Figma validation
OS-susmitabhowmik 8236f7d
chore(datetime): update generated files for range selection API
OS-susmitabhowmik 581d280
chore(): add updated snapshots
Ionitron 9d70a28
Merge branch 'next' into ROU-12704-datepicker-range
OS-susmitabhowmik 5353064
fix(datetime): fix lint error and update state spec for range fields
OS-susmitabhowmik 405bac7
fix(toolbar): restore baseline snapshot from next branch
OS-susmitabhowmik e90b03c
Revert "fix(toolbar): restore baseline snapshot from next branch"
OS-susmitabhowmik 1b0efef
fix(datetime): fix SCSS lint property order and disallowed-list errors
OS-susmitabhowmik e07c496
chore(): add updated snapshots
Ionitron 2a7744b
fix(datetime): fix remaining SCSS lint order errors
OS-susmitabhowmik 47aa109
fix(datetime): apply prettier formatting to range files
OS-susmitabhowmik 2c61014
fix(datetime): use pill shapes for range on all themes and fix disabl…
OS-susmitabhowmik 1dbcd39
Merge branch 'next' into ROU-12704-datepicker-range
OS-susmitabhowmik 19d5c0e
fix(datetime): make month/year wheels navigation-only in range and mu…
OS-susmitabhowmik 91d19ed
fix(datetime): pass border-radius values as separate arguments for RT…
OS-susmitabhowmik 21d0dc2
fix(angular): add missing datetime props to standalone DATETIME_INPUT…
OS-susmitabhowmik 5ee1d71
fix(datetime): append both range labels for single-day range aria-label
OS-susmitabhowmik d917bd2
fix(datetime): prevent confirm from closing overlay with incomplete r…
OS-susmitabhowmik c1859c3
test(datetime): add e2e and unit tests for range selection mode
OS-susmitabhowmik 1ca8d38
refactor(datetime): simplify setActivePartsRange and rangeContainsDis…
OS-susmitabhowmik 4516f4f
fix(datetime): remove unused variables in range e2e tests
OS-susmitabhowmik 5b93e9a
fix(datetime): remove unused page param in readonly range test
OS-susmitabhowmik 133ac77
style(datetime): fix formatting in range e2e test fixture
OS-susmitabhowmik 621ecb0
fix(datetime): use dynamic selectors for no-value range e2e tests
OS-susmitabhowmik 609386d
style(datetime): fix indentation and remove extra blank line in setAc…
OS-susmitabhowmik 900707b
fix(datetime): remove unused datetime variable in ionChange range test
OS-susmitabhowmik e63b135
chore(): add updated snapshots
Ionitron 782299f
fix(datetime): fix range track subpixel gaps and iOS height
OS-susmitabhowmik 0f67fc5
chore(): add updated snapshots
Ionitron a1c43b3
fix(datetime): fix range track rendering on iOS
OS-susmitabhowmik e0550e4
chore(): add updated snapshots
Ionitron 4e27f4e
fix(datetime): fix range track subpixel gaps and iOS centering
OS-susmitabhowmik ddf6701
chore(): add updated snapshots
Ionitron c889e4a
test(datetime): add e2e tests for range selection aria labels
OS-susmitabhowmik 5c28e28
chore(datetime): remove outdated range e2e snapshots
OS-susmitabhowmik 60e3a89
style(datetime): fix formatting in range track background
OS-susmitabhowmik 047ec56
chore(): add updated snapshots
Ionitron e54e7b7
refactor(datetime-button): simplify range endDate lookup and remove u…
OS-susmitabhowmik f0d2627
fix(datetime): fix disabled opacity seams and empty range navigation
OS-susmitabhowmik 3da13e0
chore(): add updated snapshots
Ionitron c53ed45
test(datetime): add ionic-md mode to range visual regression tests
OS-susmitabhowmik 662f013
chore(): add updated snapshots
Ionitron 1cb5bb9
fix(datetime): stop cancel() from clearing a confirmed range selection
OS-susmitabhowmik 7aef96c
fix(datetime): scope disabled range grid opacity to ios/md themes only
OS-susmitabhowmik 3a651d6
test(datetime): strengthen range tests to fail without their fixes
OS-susmitabhowmik 1380043
chore(): add updated snapshots
Ionitron 427636b
test(datetime): add month wheel test for multiple mode in range tests
OS-susmitabhowmik 71891f1
fix(datetime): use circular range endpoints for ios/md and distinct c…
OS-susmitabhowmik 027b180
chore(): add updated snapshots
Ionitron b6087fd
fix(datetime): update range styles to match Figma design
OS-susmitabhowmik a373ddc
chore(): add updated snapshots
Ionitron 8b4de43
fix(datetime): fix range start/end text color specificity in ionic theme
OS-susmitabhowmik 4bffcb8
chore(): add updated snapshots
Ionitron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -273,6 +273,8 @@ | |||||||||||||||||||||||||||||||||||||||||
| :host .calendar-day-wrapper { | ||||||||||||||||||||||||||||||||||||||||||
| display: flex; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| position: relative; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| align-items: center; | ||||||||||||||||||||||||||||||||||||||||||
| justify-content: center; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -285,6 +287,100 @@ | |||||||||||||||||||||||||||||||||||||||||
| min-height: 0; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| overflow: visible; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||
| * Create a stacking context so the range track | ||||||||||||||||||||||||||||||||||||||||||
| * (::before with z-index: -1) stays behind the | ||||||||||||||||||||||||||||||||||||||||||
| * day button but above the host background. | ||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||
| z-index: 0; | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| // Range Selection Track | ||||||||||||||||||||||||||||||||||||||||||
| // ----------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||
| * Each day in the range draws its own piece of the track with a | ||||||||||||||||||||||||||||||||||||||||||
| * ::before. In-range days fill the cell, while the start and end | ||||||||||||||||||||||||||||||||||||||||||
| * caps cover the half between the pill center and the next day. | ||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||
| * Grid columns are `1fr`, so cell edges land on fractional pixels | ||||||||||||||||||||||||||||||||||||||||||
| * and a cell's track can fall a hairline short of its neighbor's. | ||||||||||||||||||||||||||||||||||||||||||
| * Each day therefore extends 1px toward the next day in the range, | ||||||||||||||||||||||||||||||||||||||||||
| * which the next day paints over except inside such a gap. | ||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||
| * @prop --range-background: The background color of the range selection track. | ||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||
| :host .calendar-day-wrapper-in-range::before, | ||||||||||||||||||||||||||||||||||||||||||
| :host .calendar-day-wrapper-range-start::before, | ||||||||||||||||||||||||||||||||||||||||||
| :host .calendar-day-wrapper-range-end::before { | ||||||||||||||||||||||||||||||||||||||||||
| position: absolute; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| top: 50%; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| inset-inline-start: 0; | ||||||||||||||||||||||||||||||||||||||||||
| inset-inline-end: 0; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| height: var(--range-track-height); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| transform: translateY(-50%); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||
| * `--range-background` is translucent by default, so it is layered | ||||||||||||||||||||||||||||||||||||||||||
| * over the datetime background to paint an opaque track. Where two | ||||||||||||||||||||||||||||||||||||||||||
| * days overlap, the color stays the same instead of doubling up | ||||||||||||||||||||||||||||||||||||||||||
| * into a darker line. | ||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||
| background: linear-gradient(var(--range-background), var(--range-background)), | ||||||||||||||||||||||||||||||||||||||||||
| linear-gradient(var(--background), var(--background)); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| content: ""; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| z-index: -1; | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| :host .calendar-day-wrapper-range-start::before { | ||||||||||||||||||||||||||||||||||||||||||
| inset-inline-start: 50%; | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| :host .calendar-day-wrapper-range-end::before { | ||||||||||||||||||||||||||||||||||||||||||
| inset-inline-end: 50%; | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||
| * Only extend toward a day that draws the track as well. The last | ||||||||||||||||||||||||||||||||||||||||||
| * day of a week is followed by the next row, and the next day is | ||||||||||||||||||||||||||||||||||||||||||
| * unpainted when it ends the selection or is disabled inside the | ||||||||||||||||||||||||||||||||||||||||||
| * range, so extending there would leave a 1px nub. | ||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||
| :host .calendar-day-wrapper-in-range:not(:nth-child(7n)):has(+ .calendar-day-wrapper-in-range)::before, | ||||||||||||||||||||||||||||||||||||||||||
| :host .calendar-day-wrapper-in-range:not(:nth-child(7n)):has(+ .calendar-day-wrapper-range-end)::before, | ||||||||||||||||||||||||||||||||||||||||||
| :host .calendar-day-wrapper-range-start:not(:nth-child(7n)):has(+ .calendar-day-wrapper-in-range)::before, | ||||||||||||||||||||||||||||||||||||||||||
| :host .calendar-day-wrapper-range-start:not(:nth-child(7n)):has(+ .calendar-day-wrapper-range-end)::before { | ||||||||||||||||||||||||||||||||||||||||||
| inset-inline-end: -1px; | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+359
to
+361
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Each theme then sets the overflow to its grid padding, next to // datetime.md.scss
--range-track-edge-overflow: 10px;
// datetime.ios.scss
--range-track-edge-overflow: #{$datetime-ios-padding * 0.5}; |
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||
| * When a single day is both the start and end of the range, | ||||||||||||||||||||||||||||||||||||||||||
| * do not show a track since there is nothing to connect. | ||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||
| :host .calendar-day-wrapper-range-start.calendar-day-wrapper-range-end::before { | ||||||||||||||||||||||||||||||||||||||||||
| display: none; | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||
| * When the component is disabled, fade the whole grid once instead of | ||||||||||||||||||||||||||||||||||||||||||
| * fading each day. Fading a day makes it its own compositing group, so | ||||||||||||||||||||||||||||||||||||||||||
| * the 1px that each day extends toward the next would be painted twice | ||||||||||||||||||||||||||||||||||||||||||
| * and read as a darker seam. The day buttons drop their own disabled | ||||||||||||||||||||||||||||||||||||||||||
| * opacity so the grid is the only thing applying it. | ||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||
| :host(.datetime-disabled.datetime-range) .calendar-month-grid { | ||||||||||||||||||||||||||||||||||||||||||
| opacity: 0.4; | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| :host(.datetime-disabled.datetime-range) .calendar-month-grid .calendar-day[disabled] { | ||||||||||||||||||||||||||||||||||||||||||
| opacity: 1; | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parsedDatetimes[0]and[1]in the order given makes a programmatic['2023-10-31', '2023-10-23']show "Oct 31, 2023 - Oct 23, 2023" on the button, while the datetime normalizes it to Oct 23 to Oct 31.length === 2check sends a three-entry value to the single-date branch, so the button shows only the first date while the datetime uses the first and last.titleSelectedDatesFormattergets the raw array here but the normalized pair in the datetime header.This also needs
import { isAfter } from '../datetime/utils/comparison';at the top of the file. Please add an e2e case for a reversed value.