Repository navigation
Closed
Labels
refactorInternal improvementInternal improvementrequires new majorThis would be a breaking changeThis would be a breaking changethemev24To be done in V24To be done in V24vaadin-combo-boxvaadin-context-menuvaadin-itemvaadin-multi-select-combo-boxvaadin-selectvaadin-time-picker
Description
Motivation
Currently, we have the following set of item components and their extensions in our codebase:
Item elements
vaadin-item
| class Item extends ItemMixin(ThemableMixin(DirMixin(PolymerElement))) { |
| class ContextMenuItem extends Item { |
| class SelectItem extends Item { |
We also plan to add vaadin-menu-bar-item in Vaadin 24 - see #3010 and #5339 (currently in review).
vaadin-combo-box-item
| export class ComboBoxItem extends ThemableMixin(DirMixin(PolymerElement)) { |
| class TimePickerItem extends ComboBoxItem { |
web-components/packages/multi-select-combo-box/src/vaadin-multi-select-combo-box-item.js
Line 31 in 9cae6b5
| class MultiSelectComboBoxItem extends ComboBoxItem { |
ListBox elements
| class ListBox extends ElementMixin(MultiSelectListMixin(ThemableMixin(ControllerMixin(PolymerElement)))) { |
| class ContextMenuListBox extends ListBox { |
| class SelectListBox extends ListBox { |
Problem
The main problem is that some components are currently leaking their implementation detail to the users:
- Importing
vaadin-time-pickeralso definesvaadin-combo-box-itemin the custom element registry, - Styles that are applied to
vaadin-itemusingregisterStylesalso apply tovaadin-select-itemetc, - In
vaadin-list-boxwe useMultiSelectListMixinbut we don't need that invaadin-select-list-box. - The fact that classes extend each other makes it more complicated to convert them to Lit in the future,
Proposed Solution
- Update all the item and list-box classes to avoid usage of
extends, - Share logic using mixins instead: create
ComboBoxItemMixinetc, - Share styles by exporting
csstagged literals from theme JS files.
Alternatives
Keep extending ListBox and Item, also in new elements: vaadin-menu-bar-list-box and vaadin-menu-bar-item.
Note
There are a few other elements that could be also updated similarly:
vaadin-time-picker-scrollerextendsvaadin-combo-box-scrollervaadin-time-picker-overlayextendsvaadin-combo-box-overlayvaadin-menu-bar-overlayextendsvaadin-context-menu-overlay
Reacted by Leho Kraav
Metadata
Metadata
Assignees
Labels
refactorInternal improvementInternal improvementrequires new majorThis would be a breaking changeThis would be a breaking changethemev24To be done in V24To be done in V24vaadin-combo-boxvaadin-context-menuvaadin-itemvaadin-multi-select-combo-boxvaadin-selectvaadin-time-picker
Activity
web-padawan commentedon Jan 23, 2023
Conclusion from the daily: this change is quite similar to what we already did in Vaadin 22 with decoupling components that were based on
vaadin-text-fieldto not use it internally. And hopefully, users don't style items that much as fields.Also, the same change was done in Vaadin 24 for
vaadin-accordion-panelwhich no longer extendsvaadin-details.We even had an issue reported about the confusion related to styles for these components - see #412.
So, we want to fix this at least for item and list-box extensions for Vaadin 24, and I'll work to get it done this week.
web-padawan commentedon Jan 24, 2023
Item and List-box extensions
Overlay extensions
Scroller extensions
web-padawan commentedon Jan 27, 2023
Closing as completed, see individual PRs linked to this issue.