Skip to content

Conversation

@gselderslaghs
Copy link
Member

Proposed changes

Implements a modal display plugin in timepicker and datepicker components

Timepicker example:

document.addEventListener('DOMContentLoaded', function() {
    const timepickerEl = document.querySelector('.timepicker');
    const title = document.createElement('h4');
    title.innerText = 'Select time';

    M.Timepicker.init(timepickerEl, {
        autoSubmit: true,
        showClearBtn: false,
        displayPlugin: 'modal',
        displayPluginOptions: { title }
    });
});

Datepicker example:

document.addEventListener('DOMContentLoaded', function() {
    const datepickerEl = document.querySelector('.datepicker');
    const title = document.createElement('h4');
    title.innerText = 'Select date';

    M.Datepicker.init(datepickerEl, {
        autoSubmit: true,
        showClearBtn: true,
        displayPlugin: 'modal',
        displayPluginOptions: { title }
    });
});

Screenshots (if appropriate) or codepen:

Screenshot 2025-03-06 at 13 50 20 Screenshot 2025-03-06 at 13 52 04

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to change).

Checklist:

  • I have read the CONTRIBUTING document.
  • My commit messages follows the conventional commit format
  • My change requires a change to the documentation, and updated it accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@gselderslaghs gselderslaghs marked this pull request as draft March 12, 2025 09:57
@gselderslaghs gselderslaghs force-pushed the pickers-modal-display-plugin branch from b7348eb to 1d2452a Compare June 29, 2025 17:02
@gselderslaghs gselderslaghs marked this pull request as ready for review June 29, 2025 18:15
@gselderslaghs
Copy link
Member Author

The codebase has been rebased according to recent changes in v2-dev and I've added additional refinements required for this feature, this is ready for a coding review

@wuda-io
Copy link
Member

wuda-io commented Jul 2, 2025

Looks nice! Why not use the existing Modal Component and implement the create methods there. It is ok for now i guess.

Can you provide a storybooks kind of documentation for the date- and timepicker too? With all variants would be awesome.
Check out the other examples too. They are in the dev-branch already. (Buttons, Checkbox, Radiobuttons, navbar)
It is very nice for testing and development. I think we should transfer all components in near future to this approach. Thanks.

@wuda-io wuda-io self-requested a review July 2, 2025 11:30
@gselderslaghs
Copy link
Member Author

Looks nice! Why not use the existing Modal Component and implement the create methods there. It is ok for now i guess.

This was initially the idea, as the new Modal implementation was in parallel with the Pickers changes I decided to not take the risk implementing it in a manner that could possibly gets overridden or would require additional changes afterwards

Let's make the transition to use the Modal Component in a separate pr, since the Modal component slightly might be refactored as wel to accompli with requirements in Pickers components

Can you provide a storybooks kind of documentation for the date- and timepicker too? With all variants would be awesome. Check out the other examples too. They are in the dev-branch already. (Buttons, Checkbox, Radiobuttons, navbar) It is very nice for testing and development. I think we should transfer all components in near future to this approach. Thanks.

Definitely, I like the idea, perhaps it has already gone out of scope for this feature, it would be a better approach creating an overarching issue listing all components that are currently lacking storybooks

Let me know if any additional changes would be required to make this pr work into v2-dev

wuda-io
wuda-io previously approved these changes Jul 14, 2025
Copy link
Member

Choose a reason for hiding this comment

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

why is this file needed? I think we should use the already existing popover! Modal was removed in the last version.

Copy link
Member Author

Choose a reason for hiding this comment

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

Regarding #558

Excerpt from Material M3 specs

Three types: docked, modal, modal input

This is the reason why this was implemented in this way, I can confirm it could take additional refinements based on your remarks, would be great if we can split this reviewing up into several stages

Copy link
Member

Choose a reason for hiding this comment

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

also this is not needed. We should use popover attribute. And in near future we can use anchor-positioning.

Copy link
Member Author

Choose a reason for hiding this comment

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

This was already approved in #140 , can you clarify why this was approved and then dismissed afterwards?

@gselderslaghs gselderslaghs dismissed wuda-io’s stale review July 14, 2025 08:28

The merge-base changed after approval.

wuda-io
wuda-io previously approved these changes Jul 14, 2025
@gselderslaghs gselderslaghs dismissed wuda-io’s stale review July 14, 2025 08:39

The merge-base changed after approval.

@wuda-io wuda-io self-requested a review July 14, 2025 08:40
wuda-io
wuda-io previously approved these changes Jul 14, 2025
@wuda-io wuda-io requested review from bugy and mauromascarenhas July 14, 2025 08:40
@gselderslaghs gselderslaghs dismissed wuda-io’s stale review July 14, 2025 08:46

The merge-base changed after approval.

@wuda-io
Copy link
Member

wuda-io commented Jul 14, 2025

also i can not approve it, i think someone else has to confirm too. Would be nice if you could take a look @bugy or @mauromascarenhas . Thanks

@wuda-io wuda-io merged commit 0c73505 into materializecss:v2-dev Jul 22, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants