Skip to content

Commit 49c21f7

Browse files
committed
refactor: register and read CSS custom property directly
1 parent f4c1fc6 commit 49c21f7

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

packages/form-layout/src/layouts/auto-responsive-layout.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,7 @@ export class AutoResponsiveLayout extends AbstractLayout {
172172

173173
/** @private */
174174
get __minWidthLabelsAside() {
175-
const { backgroundPositionY } = getComputedStyle(this.host.$.layout, '::before');
176-
return parseFloat(backgroundPositionY);
175+
return parseFloat(getComputedStyle(this.host).getPropertyValue('--_min-width-labels-aside'));
177176
}
178177

179178
/** @private */

packages/form-layout/src/styles/vaadin-form-layout-base-styles.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ import '@vaadin/component-base/src/styles/style-props.js';
77
import { css } from 'lit';
88
import { addGlobalThemeStyles } from '@vaadin/vaadin-themable-mixin/register-styles.js';
99

10+
CSS.registerProperty({
11+
name: '--_min-width-labels-aside',
12+
syntax: '<length>',
13+
inherits: false,
14+
initialValue: '0px',
15+
});
16+
1017
addGlobalThemeStyles(
1118
'vaadin-form-layout-base',
1219
css`
@@ -132,10 +139,6 @@ export const formLayoutStyles = css`
132139
width: var(--_max-width);
133140
}
134141
135-
:host([auto-responsive]) #layout::before {
136-
background-position-y: var(--_min-width-labels-aside);
137-
}
138-
139142
:host([auto-responsive]) #layout ::slotted(*) {
140143
/* Make form items inherit label position from the layout */
141144
--_form-item-labels-above: inherit;

0 commit comments

Comments
 (0)