Skip to content

Commit

Permalink
refactor: use position: absolute for required indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed Apr 10, 2024
1 parent 62d7e79 commit 14d2000
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 10 additions & 7 deletions packages/checkbox/theme/lumo/vaadin-checkbox-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ registerStyles(
[part='label'] {
display: flex;
position: relative;
max-width: max-content;
}
:host([has-label]) ::slotted(label) {
Expand All @@ -42,6 +43,14 @@ registerStyles(
);
}
:host([dir='rtl'][has-label]) ::slotted(label) {
padding: var(--lumo-space-xs) var(--lumo-space-xs) var(--lumo-space-xs) var(--lumo-space-s);
}
:host([has-label][required]) ::slotted(label) {
padding-inline-end: var(--lumo-space-m);
}
[part='checkbox'] {
width: var(--_checkbox-size);
height: var(--_checkbox-size);
Expand Down Expand Up @@ -156,11 +165,6 @@ registerStyles(
background-color: var(--vaadin-checkbox-readonly-checked-background, var(--lumo-contrast-70pct));
}
/* RTL specific styles */
:host([dir='rtl'][has-label]) ::slotted(label) {
padding: var(--lumo-space-xs) var(--lumo-space-xs) var(--lumo-space-xs) var(--lumo-space-s);
}
/* Used for activation "halo" */
[part='checkbox']::before {
pointer-events: none;
Expand Down Expand Up @@ -205,10 +209,9 @@ registerStyles(
/* Required */
:host([required]) [part='required-indicator'] {
position: relative;
position: absolute;
top: var(--lumo-space-xs);
right: var(--lumo-space-xs);
align-self: flex-start;
}
:host([required][dir='rtl']) [part='required-indicator'] {
Expand Down

0 comments on commit 14d2000

Please sign in to comment.