Skip to content

Conversation

ugur-vaadin
Copy link
Contributor

@ugur-vaadin ugur-vaadin commented Oct 10, 2025

Description

This PR

  • adds Aura variants in enums for variants that are not also base variants
  • adds HasThemeVariant interface to
    • Upload
    • SideNav
    • MessageInput
  • adds missing theme variant unit tests
  • updates unit tests to use the helper in order to reduce duplication

Closes #8126

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/contributing/overview
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.
  • Enhancement / new feature was discussed in a corresponding GitHub issue and Acceptance Criteria were created.

@ugur-vaadin ugur-vaadin marked this pull request as ready for review October 13, 2025 13:19
LUMO_DROPDOWN_INDICATORS("dropdown-indicators");
LUMO_DROPDOWN_INDICATORS("dropdown-indicators"),
TERTIARY("tertiary"),
ICON("icon"),
Copy link
Member

Choose a reason for hiding this comment

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

Not a base style variant, keep the Lumo version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It looks like it is there in the base button styles like with the Lumo version.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Oh, right, thanks for the heads up. I don't think I’ve noticed that. I’d say we should remove the icon variant from that selector.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed it from this PR.

Copy link
Member

Choose a reason for hiding this comment

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

I made at least a note to myself to update that selector during beta.

Comment on lines 24 to 35
/**
* @deprecated Use {@link #VERTICAL} instead.
*/
@Deprecated(since = "25.0", forRemoval = true)
LUMO_VERTICAL("vertical"),
/**
* @deprecated Use {@link #HELPER_ABOVE_FIELD} instead.
*/
@Deprecated(since = "25.0", forRemoval = true)
LUMO_HELPER_ABOVE_FIELD("helper-above-field"),
VERTICAL("vertical"),
Copy link
Member

Choose a reason for hiding this comment

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

Should be the same as Checkbox Group, that the base variant is horizontal, but Lumo has the opposite (default is horizontal and the variant is vertical).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed it along with the uses in the unit tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks a bit weird IMO, as HORIZONTAL doesn't do anything for Lumo, same as VERTICAL doesn't do anything in base / Aura. Would look cleaner if we'd just have both HORIZONTAL and VERTICAL.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that sounds okay to me, even if VERTICAL is basically a no-op in base styles and Aura (and same for HORIZONTAL in Lumo).

Copy link
Member

Choose a reason for hiding this comment

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

Starts to sound like an orientation property more than a theme variant, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the PR to include both horizontal and vertical for radio button group and checkbox group variants.

@ugur-vaadin ugur-vaadin force-pushed the feat-add-base-variants branch from c1ae768 to 9727063 Compare October 14, 2025 10:38
@sissbruecker sissbruecker self-requested a review October 14, 2025 12:11
@ugur-vaadin ugur-vaadin force-pushed the feat-add-base-variants branch from f11629d to bb5fdb9 Compare October 14, 2025 16:43
@ugur-vaadin
Copy link
Contributor Author

The failing test on CI (GridProDetachAttachIT.attachAndDetach_noClientErrors) is unrelated and is also present on main.

*/
@Deprecated(since = "25.0", forRemoval = true)
LUMO_NO_PADDING("no-padding"),
NO_BORDER("no-border"),
Copy link
Contributor

Choose a reason for hiding this comment

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

no-border is basically a no-op in Lumo since it doesn't have a border.

Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed the same. However maybe it's better to keep this as is for simplicity. Since Lumo doesn't have a border, it's also unlikely that you would try to use it there, or expect it to do anything?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, not a problem IMO, just wanted to point it out to confirm the agreement in such cases.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, would make sense to change the default in Lumo, but probably not worth the breaking change for users.

*/
public enum SplitLayoutVariant implements ThemeVariant {
LUMO_SMALL("small"), LUMO_MINIMAL("minimal");
LUMO_SMALL("small"), LUMO_MINIMAL("minimal"), SMALL("small");
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing Lumo deprecation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the missing annotation.

Copy link
Contributor

Choose a reason for hiding this comment

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

The PR tags #8126 as fixed, however it's still missing the Aura specific variants. I was assuming those would come in a follow-up PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could update it as "part of". I tagged it so because it seemed like the scope of the issue was reduced to base variants (possibly temporarily) in the comments.

Copy link
Contributor

Choose a reason for hiding this comment

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

We need to add something for Aura at some point, so since we have no other ticket for that I think we should keep this one.

I'm also still a bit confused since we discussed to use class names instead of theme variants for Aura at some point. But that makes it rather inconsistent with the base variants being a theme variant, and Aura variants being a class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the PR tag as "part of".

Copy link
Member

Choose a reason for hiding this comment

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

@sissbruecker: the only classnames in Aura at the moment are .aura-surface and .aura-surface-solid, which are general purpose for any element, not just our components. So it doesn't make sense to have those use the theme attribute (because of React mainly).

Comment on lines 27 to 28
LUMO_NO_ROW_BORDERS("no-row-borders"),
LUMO_COLUMN_BORDERS("column-borders"),
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like Aura also supports these, but base styles do not. Should there be separate prefixed variants for Aura, or should we have this as a base variant?

Maybe more of a question for @jouni

Copy link
Member

@jouni jouni Oct 15, 2025

Choose a reason for hiding this comment

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

Base styles leaves this as a responsibility of a theme, to decide what the default border configuration is (whether to show column and row borders or not). And then it’s naturally also a theme’s responsibility to offer any variants that allow to deviate from those defaults easily per component.

I don't want to force all themes to implement grid borders the same way by forcing them to implement those base variants.

So it seems we’ll have these ones for both Lumo and Aura.

Copy link
Member

@jouni jouni Oct 15, 2025

Choose a reason for hiding this comment

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

A similar case could be made about row stripes, but it felt a bit more natural to force that default than the borders. Well, maybe the same case can be made about almost all variants. I suppose I’m just struggling to define a clear guideline how we decide what goes to base styles and what is left for themes. Suggestions welcome! Ping @rolfsmeds.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, it is arguably a bit late to make major changes, but the more I think about it, the more it feels like base styles should have as few variants as possible, like things that should maybe not be theme variants at all (like orientation) and a few really obvious ones.

@ugur-vaadin ugur-vaadin force-pushed the feat-add-base-variants branch from 640ed49 to 3440633 Compare October 15, 2025 10:05
Copy link
Member

@jouni jouni left a comment

Choose a reason for hiding this comment

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

Some ambiguity regarding what is a base style variant, but that’s something I think we can still fine tune later.

@yuriy-fix
Copy link
Contributor

Decision: No base variants should be exposed, all variants should have theme prefixes (those that are present in both themes should be duplicated)

@ugur-vaadin ugur-vaadin marked this pull request as draft October 16, 2025 08:01
@ugur-vaadin ugur-vaadin force-pushed the feat-add-base-variants branch from 3440633 to 32c7a49 Compare October 17, 2025 14:44
@ugur-vaadin ugur-vaadin changed the title feat: add base variants feat: add Aura variants Oct 17, 2025
Copy link

@ugur-vaadin ugur-vaadin marked this pull request as ready for review October 17, 2025 16:24
@knoobie
Copy link
Contributor

knoobie commented Oct 17, 2025

Decision: No base variants should be exposed, all variants should have theme prefixes (those that are present in both themes should be duplicated)

Is the reasoning for this decision public?

@rolfsmeds
Copy link
Contributor

rolfsmeds commented Oct 17, 2025

Is the reasoning for this decision public?

No, it's a super secret strategic business decision 😁

Jokes aside, it's primarily that variants implemented in base styles are available in all themes, so duplicating them would be kind of pointless.

We initially considered having unprefixed variants of base variants in the *Variant enums, but 1) we already have the LUMO prefixed ones and don't want to deprecate them, 2) We figured autocomplete in IDEs would work better without them, 3) We might want to move theme-specific variants to the theme classes in the future (and then where would base variants go?), and 4) base styles are not expected to be used as-is, but as the foundation of custom themes which would provide their own variants enums.

@knoobie
Copy link
Contributor

knoobie commented Oct 17, 2025

Understandable reasoning! I personally was hoping for an universal "ButtonVariant.PRIMARY" enum that just works (1) regardless of which theme I use (lumo, aura or something else) this feels more naturally instead of remembering (always adding AURA_) in front of all values. (AI is probably getting this wrong as well.. half joking)

Yes, that leaves us with the problem that either theme specific variants have to be prefixed or they just don't work on all themes. I'm not sure how many theme-specific variants there are... So I would just say: no prefix and just add java doc information if it does not apply to all themes if you don't want to create theme specific enum classes

(1) I know it already works like this with LUMO_PRIMARY and AURA_PRIMARY cause both map to primary on the client.

Edit: RIP my hope for deprecated LUMO-Variants 🤭

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.

Add base and Aura component variants to *Variant classes.

7 participants