@@ -45,19 +45,25 @@ export const formLayoutStyles = css`
45
45
}
46
46
47
47
: host ([auto-responsive ]) {
48
- --_column-gap : var (--vaadin-form-layout-column-spacing );
49
- --_max-total-gap-width : calc ((var (--_max-columns ) - 1 ) * var (--_column-gap ));
50
- --_max-total-col-width : calc (var (--_max-columns ) * var (--_column-width ));
48
+ --_column-width-labels-above : var (--_column-width );
49
+ --_column-width-labels-aside : calc (
50
+ var (--_column-width ) + var (--vaadin-form-layout-label-width ) + var (--vaadin-form-layout-label-spacing )
51
+ );
51
52
52
53
display : flex;
53
- min-width : var (--_column-width );
54
+ min-width : var (--_column-width-labels-above );
54
55
}
55
56
56
57
: host ([auto-responsive ]) # layout {
58
+ --_grid-column-gap : var (--vaadin-form-layout-column-spacing );
59
+ --_grid-column-width : var (--_column-width-labels-above );
60
+ --_grid-column-max-total-gap : calc ((var (--_max-columns ) - 1 ) * var (--_grid-column-gap ));
61
+ --_grid-column-max-total-width : calc (var (--_max-columns ) * var (--_column-width-labels-above ));
62
+
57
63
display : grid;
58
- grid-template-columns : repeat (auto-fit, var (--_column -width ));
64
+ grid-template-columns : repeat (auto-fit, var (--_grid-column -width ));
59
65
justify-items : start;
60
- gap : var (--vaadin-form-layout-row-spacing ) var (--_column -gap );
66
+ gap : var (--vaadin-form-layout-row-spacing ) var (--_grid-column -gap );
61
67
62
68
/*
63
69
To prevent the layout from exceeding the column limit defined by --_max-columns,
@@ -71,7 +77,7 @@ export const formLayoutStyles = css`
71
77
number of columns inside <vaadin-overlay>, which creates a new stacking context
72
78
without a predefined width.
73
79
*/
74
- width : calc (var (--_max-total-col- width ) + var (--_max- total-gap-width ));
80
+ width : calc (var (--_grid-column-max-total- width ) + var (--_grid-column-max- total-gap ));
75
81
76
82
/*
77
83
Firefox requires min-width on both :host and #layout to allow the layout
@@ -80,13 +86,33 @@ export const formLayoutStyles = css`
80
86
min-width : inherit;
81
87
}
82
88
89
+ : host ([auto-responsive ]) # layout ::before {
90
+ background-position-y : var (--_column-width-labels-aside );
91
+ }
92
+
83
93
: host ([auto-responsive ]) # layout ::slotted (* ) {
94
+ --_form-item-labels-above : initial; /* true */
95
+ --_form-item-labels-aside : ' ' ; /* false */
96
+
84
97
grid-column-start : 1 ;
85
98
}
86
99
87
100
: host ([auto-responsive ][auto-rows ]) # layout ::slotted (* ) {
88
101
grid-column-start : var (--_column-start , auto);
89
102
}
103
+
104
+ : host ([auto-responsive ][labels-aside ]) # layout {
105
+ --_grid-column-max-total-width : calc (var (--_max-columns ) * var (--_column-width-labels-aside ));
106
+ }
107
+
108
+ : host ([auto-responsive ][labels-aside ]) # layout [fits-labels-aside ] {
109
+ --_grid-column-width : var (--_column-width-labels-aside );
110
+ }
111
+
112
+ : host ([auto-responsive ][labels-aside ]) # layout [fits-labels-aside ] ::slotted (* ) {
113
+ --_form-item-labels-above : ' ' ; /* false */
114
+ --_form-item-labels-aside : initial; /* true */
115
+ }
90
116
` ;
91
117
92
118
export const formRowStyles = css `
@@ -109,30 +135,33 @@ export const formRowStyles = css`
109
135
110
136
export const formItemStyles = css `
111
137
: host {
138
+ - - _for m- item- labels- above: ' '; /* false */
139
+ - - _for m- item- labels- aside: initial; /* true */
140
+
112
141
dis play: inline-flex;
113
- flex- direction: row;
114
- align- items: baseline;
142
+ align- items: var(--_form-item-labels-aside , baseline );
143
+ flex- flow: var(- - _for m- item- labels- above, column ) nowrap;
144
+ justify- self: stretch;
115
145
margin: calc(0.5 * var(- - vaadin- for m- item- row- spacing, var (- - vaadin- for m- layout- row- spacing, 1em))) 0;
116
146
}
117
147
118
148
: host ([label-position = 'top' ]) {
119
- flex-direction : column;
120
- align-items : stretch;
149
+ --_form-item-labels-above : initial; /* true */
150
+ --_form-item-labels-aside : ' ' ; /* false */
121
151
}
122
152
123
153
: host ([hidden ]) {
124
154
display : none !important ;
125
155
}
126
156
127
157
# label {
128
- width : var (--vaadin-form-item-label-width , var (--vaadin-form-layout-label-width , 8em ));
158
+ width : var (
159
+ --_form-item-labels-aside ,
160
+ var (--vaadin-form-item-label-width , var (--vaadin-form-layout-label-width , 8em ))
161
+ );
129
162
flex : 0 0 auto;
130
163
}
131
164
132
- : host ([label-position = 'top' ]) # label {
133
- width : auto;
134
- }
135
-
136
165
# spacing {
137
166
width : var (--vaadin-form-item-label-spacing , var (--vaadin-form-layout-label-spacing , 1em ));
138
167
flex : 0 0 auto;
0 commit comments