-
Notifications
You must be signed in to change notification settings - Fork 76
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
feat(input-date-picker, date-picker): improve date picking experience #8402
feat(input-date-picker, date-picker): improve date picking experience #8402
Conversation
Is the intention that these are separate public components? Or all housed within one public component? I know the native input can be |
Yeah, the idea is to have independent Concurrently, I am testing a different approach to use combobox for input-month-picker and input-year-picker (similar to input-time-zone) which seems promising but wouldn't work if we need to display two scroll bars one for month and one for year. I also dig the idea mentioned in the issue for input-month-picker which is more like a table with year at the top. It doesn't require two scroll bars. |
IMO, this approach is just an implementation of a Combobox, a user can already set something like that up. I'd think ours would be more custom picking experiences like the examples linked in the original issue / Material example (however the components are structured).
Agreed, I think that's more appropriate for a component offering. If it's just a Combobox, we're only setting up an existing component with a set of pre-configured options, not providing a unique selection experience. |
…picker when switching between input's
…vious month button when selecting endDate
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.
Aside from a few comments, I think this is good to go! Awesome job, @anveshmekala! 😎
📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅
📅👈📅📅📅👈📅📅👈👈📅📅👈👈👈📅📅👈👈👈📅👈👈👈👈📅👈📅
📅👈👈📅📅👈📅👈📅📅👈📅📅👈📅📅👈📅📅📅📅👈📅📅📅📅👈📅
📅👈📅👈📅👈📅👈📅📅👈📅📅👈📅📅👈📅📅📅📅👈👈👈📅📅👈📅
📅👈📅📅👈👈📅👈📅📅👈📅📅👈📅📅👈📅📅📅📅👈📅📅📅📅📅📅
📅👈📅📅📅👈📅📅👈👈📅📅👈👈👈📅📅👈👈👈📅👈👈👈👈📅👈📅
📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅📅
@@ -53,23 +53,47 @@ export default { | |||
}; | |||
|
|||
export const simple = (args: InputDatePickerStoryArgs): string => html` | |||
<div style="width: 400px"> | |||
<style> |
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.
Suggestion: not critical for this PR, but you might be able to simplify setting custom width and height by using a custom decorator (example).
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.
Will create a followup PR.
|
||
async function selectDayInMonthById(id: string, page: E2EPage): Promise<void> { | ||
const day = await page.find( | ||
`calcite-date-picker>>> calcite-date-picker-month >>> calcite-date-picker-day[current-month][id="${id}"]`, |
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.
Nitpick: can you add a space before the first piercing selector?
); | ||
expect(firstDayInNextMonth.classList.contains("current-day")).toBe(false); | ||
currentDay = await page.find( | ||
"calcite-date-picker >>> calcite-date-picker-month >>> calcite-date-picker-day.current-day", |
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.
Can you create a follow-up issue to see if we can make these tests more robust? The complex selectors might make them a bit brittle.
await page.keyboard.press("Enter"); | ||
await page.waitForChanges(); | ||
expect(await calendar.isVisible()).toBe(false); | ||
expect((await inputDatePicker.getProperty("value"))[1]).toEqual("2024-07-02"); |
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.
Nitpick: splitting up the value (storing in a var) and assertion might help with readability.
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.
Is the below syntax suggested?
const [, endDate] = await inputDatePicker.getProperty("value");
expect(endValue).toEqual("2024-07-02");
|
||
expect(await date.getAttribute("aria-label")).toBe("Year"); | ||
const yearInput = await page.find(`calcite-date-picker-month-header >>> input`); | ||
expect(yearInput.getAttribute("aria-label")).toBe("Year"); |
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.
Nice. So we could do something like the following, right?
expect(yearInput.getAttribute("aria-label")).toBe(messages.year);
if (!Array.isArray(valueAsDate) && valueAsDate && valueAsDate !== this.activeDate) { | ||
this.activeDate = new Date(valueAsDate); | ||
} | ||
|
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.
Nitpick: For readability, can you restore these newlines? It should help scanning the code since there's a bit of if
statements here.
@@ -70,9 +84,21 @@ export class DatePickerMonthHeader { | |||
* @internal | |||
* @readonly | |||
*/ | |||
// eslint-disable-next-line @stencil-community/strict-mutable -- updated by t9n module | |||
// eslint-disable-next-line @stencil-community/strict-mutable | |||
@Prop({ mutable: true }) messages: DatePickerMessages; |
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.
How so? mutable
is for internal prop updates and I don't see where it might get updated internally.
private setSelectMenuWidth(select: HTMLCalciteSelectElement): void { | ||
const selectEl = select.shadowRoot.querySelector("select"); | ||
let selectedOptionWidth: number; | ||
const fontStyle = getComputedStyle(selectEl).font; |
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.
We could add inherit here & reference the font css prop at :host.
I dig it!
|
||
private handleKeyDown = (event: KeyboardEvent): void => { | ||
if (event.key === "ArrowDown" || event.key === "ArrowUp") { | ||
event.stopPropagation(); |
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.
We cancel the event for these cases. input-date-picker
will ignore canceled arrow key presses.
Actually, after taking a closer look, this is a totally different issue. We can address it separately.
} | ||
|
||
private async setSelectMenuIconOffset(select: HTMLCalciteSelectElement): Promise<void> { | ||
const iconEl = select.shadowRoot.querySelector("calcite-icon"); |
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.
Could we get the icon container dimensions from the design spec and tokens? If not, I’m inclined to hardcode the sizes (based on the spec) while we explore alternatives in a follow-up issue.
packages/calcite-components/src/components/date-picker/date-picker.scss
Outdated
Show resolved
Hide resolved
This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions. |
…orepo * origin/dev: build(deps): update typescript-eslint monorepo to v7.18.0 (#10593) feat(tile): add design tokens (#10476) deprecate: deprecate web-adaptor in favor of web-adapter (#10598) docs: update component READMEs (#10600) build(deps): update dependency @rollup/plugin-replace to v6 (#10604) chore: release main (#10597) ci(chromatic): build storybook even when skipping snapshots (#10589) build(deps): update dependency axe-core to v4.10.1 (#10566) ci: add calcite-ui-icons label to relevant package PRs (#10590) chore: release next feat: add buffer point, buffer polygon, buffer polyline, contour, offset (#10594) feat(input-date-picker, date-picker): improve date picking experience (#8402) chore: release next fix: updated web-adapter name (#10581) build(deps): update nrwl monorepo to v19.8.6 (#10575) build(deps): update dependency tsx to v4.19.1 (#10574) build(deps): update dependency @cspell/eslint-plugin to v8.15.4 (#10565)
Related Issue: #3455
Summary
Update
calcite-date-picker
&calcite-input-date-picker
UI & UX.Key changes
Other issues resolved :
#6321
#6410
#10301
#10291
#10113
#10243
#10490
#10069
Blocked issues: #9167
Wiki https://github.com/Esri/calcite-design-system/wiki/date%E2%80%90picker-enhancement-%238402