@vaadin/form-layout 24.7.0-alpha8 → 24.7.0-beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +11 -11
- package/src/vaadin-form-item-mixin.js +35 -0
- package/src/vaadin-form-item.d.ts +3 -3
- package/src/vaadin-form-item.js +3 -3
- package/src/vaadin-form-layout-mixin.js +33 -141
- package/src/vaadin-form-layout-styles.js +9 -15
- package/src/vaadin-form-layout.d.ts +1 -0
- package/src/vaadin-form-layout.js +3 -0
- package/theme/lumo/vaadin-form-item-styles.js +0 -4
- package/theme/lumo/vaadin-form-layout-styles.js +1 -0
- package/web-types.json +3 -3
- package/web-types.lit.json +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/form-layout",
|
|
3
|
-
"version": "24.7.0-
|
|
3
|
+
"version": "24.7.0-beta1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,24 +37,24 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
39
39
|
"@polymer/polymer": "^3.0.0",
|
|
40
|
-
"@vaadin/a11y-base": "24.7.0-
|
|
41
|
-
"@vaadin/component-base": "24.7.0-
|
|
42
|
-
"@vaadin/vaadin-lumo-styles": "24.7.0-
|
|
43
|
-
"@vaadin/vaadin-material-styles": "24.7.0-
|
|
44
|
-
"@vaadin/vaadin-themable-mixin": "24.7.0-
|
|
40
|
+
"@vaadin/a11y-base": "24.7.0-beta1",
|
|
41
|
+
"@vaadin/component-base": "24.7.0-beta1",
|
|
42
|
+
"@vaadin/vaadin-lumo-styles": "24.7.0-beta1",
|
|
43
|
+
"@vaadin/vaadin-material-styles": "24.7.0-beta1",
|
|
44
|
+
"@vaadin/vaadin-themable-mixin": "24.7.0-beta1",
|
|
45
45
|
"lit": "^3.0.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@vaadin/chai-plugins": "24.7.0-
|
|
49
|
-
"@vaadin/custom-field": "24.7.0-
|
|
50
|
-
"@vaadin/test-runner-commands": "24.7.0-
|
|
48
|
+
"@vaadin/chai-plugins": "24.7.0-beta1",
|
|
49
|
+
"@vaadin/custom-field": "24.7.0-beta1",
|
|
50
|
+
"@vaadin/test-runner-commands": "24.7.0-beta1",
|
|
51
51
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
52
|
-
"@vaadin/text-field": "24.7.0-
|
|
52
|
+
"@vaadin/text-field": "24.7.0-beta1",
|
|
53
53
|
"sinon": "^18.0.0"
|
|
54
54
|
},
|
|
55
55
|
"web-types": [
|
|
56
56
|
"web-types.json",
|
|
57
57
|
"web-types.lit.json"
|
|
58
58
|
],
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "4043c518ef9b915cde612d2907ddc9bd10e5af17"
|
|
60
60
|
}
|
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
import { addValueToAttribute, removeValueFromAttribute } from '@vaadin/component-base/src/dom-utils.js';
|
|
7
7
|
import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
|
|
8
8
|
|
|
9
|
+
let spacingDeprecationNotified = false;
|
|
10
|
+
let labelWidthDeprecationNotified = false;
|
|
11
|
+
let labelSpacingDeprecationNotified = false;
|
|
12
|
+
|
|
9
13
|
/**
|
|
10
14
|
* @polymerMixin
|
|
11
15
|
*/
|
|
@@ -42,6 +46,37 @@ export const FormItemMixin = (superClass) =>
|
|
|
42
46
|
this.__fieldNode = null;
|
|
43
47
|
}
|
|
44
48
|
|
|
49
|
+
/** @protected */
|
|
50
|
+
ready() {
|
|
51
|
+
super.ready();
|
|
52
|
+
|
|
53
|
+
const computedStyle = getComputedStyle(this);
|
|
54
|
+
const spacing = computedStyle.getPropertyValue('--vaadin-form-item-row-spacing');
|
|
55
|
+
const labelWidth = computedStyle.getPropertyValue('--vaadin-form-item-label-width');
|
|
56
|
+
const labelSpacing = computedStyle.getPropertyValue('--vaadin-form-item-label-spacing');
|
|
57
|
+
|
|
58
|
+
if (!spacingDeprecationNotified && spacing !== '' && parseInt(spacing) !== 0) {
|
|
59
|
+
console.warn(
|
|
60
|
+
'`--vaadin-form-item-row-spacing` is deprecated since 24.7. Use `--vaadin-form-layout-row-spacing` on <vaadin-form-layout> instead.',
|
|
61
|
+
);
|
|
62
|
+
spacingDeprecationNotified = true;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (!labelWidthDeprecationNotified && labelWidth !== '' && parseInt(labelWidth) !== 0) {
|
|
66
|
+
console.warn(
|
|
67
|
+
'`--vaadin-form-item-label-width` is deprecated since 24.7. Use `--vaadin-form-layout-label-width` on <vaadin-form-layout> instead.',
|
|
68
|
+
);
|
|
69
|
+
labelWidthDeprecationNotified = true;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!labelSpacingDeprecationNotified && labelSpacing !== '' && parseInt(labelSpacing) !== 0) {
|
|
73
|
+
console.warn(
|
|
74
|
+
'`--vaadin-form-item-label-spacing` is deprecated since 24.7. Use `--vaadin-form-layout-label-spacing` on <vaadin-form-layout> instead.',
|
|
75
|
+
);
|
|
76
|
+
labelSpacingDeprecationNotified = true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
45
80
|
/**
|
|
46
81
|
* Returns a target element to add ARIA attributes to for a field.
|
|
47
82
|
*
|
|
@@ -87,9 +87,9 @@ import { FormItemMixin } from './vaadin-form-item-mixin.js';
|
|
|
87
87
|
*
|
|
88
88
|
* Custom CSS property | Description | Default
|
|
89
89
|
* ---|---|---
|
|
90
|
-
* `--vaadin-form-item-label-width` | Width of the label column when the labels are aside | `8em`
|
|
91
|
-
* `--vaadin-form-item-label-spacing` | Spacing between the label column and the input column when the labels are aside | `1em`
|
|
92
|
-
* `--vaadin-form-item-row-spacing` | Height of the spacing between the form item elements | `1em`
|
|
90
|
+
* `--vaadin-form-item-label-width` | (DEPRECATED: Use `--vaadin-form-layout-label-width` on `<vaadin-form-layout>` instead) Width of the label column when the labels are aside | `8em`
|
|
91
|
+
* `--vaadin-form-item-label-spacing` | (DEPRECATED: Use `--vaadin-form-layout-label-spacing` on `<vaadin-form-layout>` instead) Spacing between the label column and the input column when the labels are aside | `1em`
|
|
92
|
+
* `--vaadin-form-item-row-spacing` | (DEPRECATED: Use `--vaadin-form-layout-row-spacing` on `<vaadin-form-layout>` instead) Height of the spacing between the form item elements | `1em`
|
|
93
93
|
*
|
|
94
94
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
95
95
|
*/
|
package/src/vaadin-form-item.js
CHANGED
|
@@ -92,9 +92,9 @@ registerStyles('vaadin-form-item', formItemStyles, { moduleId: 'vaadin-form-item
|
|
|
92
92
|
*
|
|
93
93
|
* Custom CSS property | Description | Default
|
|
94
94
|
* ---|---|---
|
|
95
|
-
* `--vaadin-form-item-label-width` | Width of the label column when the labels are aside | `8em`
|
|
96
|
-
* `--vaadin-form-item-label-spacing` | Spacing between the label column and the input column when the labels are aside | `1em`
|
|
97
|
-
* `--vaadin-form-item-row-spacing` | Height of the spacing between the form item elements | `1em`
|
|
95
|
+
* `--vaadin-form-item-label-width` | (DEPRECATED: Use `--vaadin-form-layout-label-width` on `<vaadin-form-layout>` instead) Width of the label column when the labels are aside | `8em`
|
|
96
|
+
* `--vaadin-form-item-label-spacing` | (DEPRECATED: Use `--vaadin-form-layout-label-spacing` on `<vaadin-form-layout>` instead) Spacing between the label column and the input column when the labels are aside | `1em`
|
|
97
|
+
* `--vaadin-form-item-row-spacing` | (DEPRECATED: Use `--vaadin-form-layout-row-spacing` on `<vaadin-form-layout>` instead) Height of the spacing between the form item elements | `1em`
|
|
98
98
|
*
|
|
99
99
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
100
100
|
*
|
|
@@ -6,6 +6,13 @@
|
|
|
6
6
|
import { isElementHidden } from '@vaadin/a11y-base/src/focus-utils.js';
|
|
7
7
|
import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
|
|
8
8
|
|
|
9
|
+
function isValidCSSLength(value) {
|
|
10
|
+
// Check if the value is a valid CSS length and not `inherit` or `normal`,
|
|
11
|
+
// which are also valid values for `word-spacing`, see:
|
|
12
|
+
// https://drafts.csswg.org/css-text-3/#word-spacing-property
|
|
13
|
+
return CSS.supports('word-spacing', value) && !['inherit', 'normal'].includes(value);
|
|
14
|
+
}
|
|
15
|
+
|
|
9
16
|
/**
|
|
10
17
|
* @polymerMixin
|
|
11
18
|
* @mixes ResizeMixin
|
|
@@ -91,11 +98,6 @@ export const FormLayoutMixin = (superClass) =>
|
|
|
91
98
|
type: Boolean,
|
|
92
99
|
sync: true,
|
|
93
100
|
},
|
|
94
|
-
|
|
95
|
-
/** @private */
|
|
96
|
-
__isVisible: {
|
|
97
|
-
type: Boolean,
|
|
98
|
-
},
|
|
99
101
|
};
|
|
100
102
|
}
|
|
101
103
|
|
|
@@ -104,115 +106,35 @@ export const FormLayoutMixin = (superClass) =>
|
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
/** @protected */
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
// CSS values in `responsiveSteps`. We can't add this to the `<template>`,
|
|
110
|
-
// because Polymer will throw it away. We need to create this before
|
|
111
|
-
// `super.ready()`, because `super.ready()` invokes property observers,
|
|
112
|
-
// and the observer for `responsiveSteps` does CSS value validation.
|
|
113
|
-
this.appendChild(this._styleElement);
|
|
114
|
-
|
|
115
|
-
super.ready();
|
|
109
|
+
connectedCallback() {
|
|
110
|
+
super.connectedCallback();
|
|
116
111
|
|
|
117
|
-
|
|
118
|
-
|
|
112
|
+
// Set up an observer to update layout when new children are added or removed.
|
|
113
|
+
this.__childrenObserver = new MutationObserver(() => this._updateLayout());
|
|
114
|
+
this.__childrenObserver.observe(this, { childList: true });
|
|
119
115
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
this._styleElement = document.createElement('style');
|
|
124
|
-
// Ensure there is a child text node in the style element
|
|
125
|
-
this._styleElement.textContent = ' ';
|
|
126
|
-
|
|
127
|
-
this.__intersectionObserver = new IntersectionObserver((entries) => {
|
|
128
|
-
// If the browser is busy (e.g. due to slow rendering), multiple entries can
|
|
129
|
-
// be queued and then passed to the callback invocation at once. Make sure we
|
|
130
|
-
// use the most recent entry to detect whether the layout is visible or not.
|
|
131
|
-
// See https://github.com/vaadin/web-components/issues/8564
|
|
132
|
-
const entry = [...entries].pop();
|
|
133
|
-
if (!entry.isIntersecting) {
|
|
134
|
-
// Prevent possible jump when layout becomes visible
|
|
135
|
-
this.$.layout.style.opacity = 0;
|
|
136
|
-
}
|
|
137
|
-
if (!this.__isVisible && entry.isIntersecting) {
|
|
116
|
+
// Set up an observer to update layout when children's attributes change.
|
|
117
|
+
this.__childrenAttributesObserver = new MutationObserver((mutations) => {
|
|
118
|
+
if (mutations.some((mutation) => mutation.target.parentElement === this)) {
|
|
138
119
|
this._updateLayout();
|
|
139
|
-
this.$.layout.style.opacity = '';
|
|
140
120
|
}
|
|
141
|
-
this.__isVisible = entry.isIntersecting;
|
|
142
121
|
});
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
122
|
+
this.__childrenAttributesObserver.observe(this, {
|
|
123
|
+
subtree: true,
|
|
124
|
+
attributes: true,
|
|
125
|
+
attributeFilter: ['colspan', 'data-colspan', 'hidden'],
|
|
126
|
+
});
|
|
148
127
|
|
|
149
128
|
requestAnimationFrame(() => this._selectResponsiveStep());
|
|
150
129
|
requestAnimationFrame(() => this._updateLayout());
|
|
151
|
-
|
|
152
|
-
this._observeChildrenColspanChange();
|
|
153
|
-
this.__intersectionObserver.observe(this.$.layout);
|
|
154
130
|
}
|
|
155
131
|
|
|
156
132
|
/** @protected */
|
|
157
133
|
disconnectedCallback() {
|
|
158
134
|
super.disconnectedCallback();
|
|
159
135
|
|
|
160
|
-
this.
|
|
161
|
-
this.
|
|
162
|
-
this.__intersectionObserver.disconnect();
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/** @private */
|
|
166
|
-
_observeChildrenColspanChange() {
|
|
167
|
-
// Observe changes in form items' `colspan` attribute and update styles
|
|
168
|
-
const mutationObserverConfig = { attributes: true };
|
|
169
|
-
|
|
170
|
-
this.__mutationObserver = new MutationObserver((mutationRecord) => {
|
|
171
|
-
mutationRecord.forEach((mutation) => {
|
|
172
|
-
if (
|
|
173
|
-
mutation.type === 'attributes' &&
|
|
174
|
-
(mutation.attributeName === 'colspan' ||
|
|
175
|
-
mutation.attributeName === 'data-colspan' ||
|
|
176
|
-
mutation.attributeName === 'hidden')
|
|
177
|
-
) {
|
|
178
|
-
this._updateLayout();
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
// Observe changes to initial children
|
|
184
|
-
[...this.children].forEach((child) => {
|
|
185
|
-
this.__mutationObserver.observe(child, mutationObserverConfig);
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
// Observe changes to lazily added nodes
|
|
189
|
-
this.__childObserver = new MutationObserver((mutations) => {
|
|
190
|
-
const addedNodes = [];
|
|
191
|
-
const removedNodes = [];
|
|
192
|
-
|
|
193
|
-
mutations.forEach((mutation) => {
|
|
194
|
-
addedNodes.push(...this._getObservableNodes(mutation.addedNodes));
|
|
195
|
-
removedNodes.push(...this._getObservableNodes(mutation.removedNodes));
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
addedNodes.forEach((child) => {
|
|
199
|
-
this.__mutationObserver.observe(child, mutationObserverConfig);
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
if (addedNodes.length > 0 || removedNodes.length > 0) {
|
|
203
|
-
this._updateLayout();
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
this.__childObserver.observe(this, { childList: true });
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/** @private */
|
|
211
|
-
_getObservableNodes(nodeList) {
|
|
212
|
-
const ignore = ['template', 'style', 'dom-repeat', 'dom-if'];
|
|
213
|
-
return Array.from(nodeList).filter(
|
|
214
|
-
(node) => node.nodeType === Node.ELEMENT_NODE && ignore.indexOf(node.localName.toLowerCase()) === -1,
|
|
215
|
-
);
|
|
136
|
+
this.__childrenObserver.disconnect();
|
|
137
|
+
this.__childrenAttributesObserver.disconnect();
|
|
216
138
|
}
|
|
217
139
|
|
|
218
140
|
/** @private */
|
|
@@ -223,34 +145,6 @@ export const FormLayoutMixin = (superClass) =>
|
|
|
223
145
|
return 1;
|
|
224
146
|
}
|
|
225
147
|
|
|
226
|
-
/** @private */
|
|
227
|
-
_isValidCSSLength(value) {
|
|
228
|
-
// Let us choose a CSS property for validating CSS <length> values:
|
|
229
|
-
// - `border-spacing` accepts `<length> | inherit`, it's the best! But
|
|
230
|
-
// it does not disallow invalid values at all in MSIE :-(
|
|
231
|
-
// - `letter-spacing` and `word-spacing` accept
|
|
232
|
-
// `<length> | normal | inherit`, and disallows everything else, like
|
|
233
|
-
// `<percentage>`, `auto` and such, good enough.
|
|
234
|
-
// - `word-spacing` is used since its shorter.
|
|
235
|
-
|
|
236
|
-
// Disallow known keywords allowed as the `word-spacing` value
|
|
237
|
-
if (value === 'inherit' || value === 'normal') {
|
|
238
|
-
return false;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
// Use the value in a stylesheet and check the parsed value. Invalid
|
|
242
|
-
// input value results in empty parsed value.
|
|
243
|
-
this._styleElement.firstChild.nodeValue = `#styleElement { word-spacing: ${value}; }`;
|
|
244
|
-
|
|
245
|
-
if (!this._styleElement.sheet) {
|
|
246
|
-
// Stylesheet is not ready, probably not attached to the document yet.
|
|
247
|
-
return true;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// Safari 9 sets invalid CSS rules' value to `null`
|
|
251
|
-
return ['', null].indexOf(this._styleElement.sheet.cssRules[0].style.getPropertyValue('word-spacing')) < 0;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
148
|
/** @private */
|
|
255
149
|
_responsiveStepsChanged(responsiveSteps, oldResponsiveSteps) {
|
|
256
150
|
try {
|
|
@@ -267,7 +161,7 @@ export const FormLayoutMixin = (superClass) =>
|
|
|
267
161
|
throw new Error(`Invalid 'columns' value of ${step.columns}, a natural number is required.`);
|
|
268
162
|
}
|
|
269
163
|
|
|
270
|
-
if (step.minWidth !== undefined && !
|
|
164
|
+
if (step.minWidth !== undefined && !isValidCSSLength(step.minWidth)) {
|
|
271
165
|
throw new Error(`Invalid 'minWidth' value of ${step.minWidth}, a valid CSS length required.`);
|
|
272
166
|
}
|
|
273
167
|
|
|
@@ -294,13 +188,6 @@ export const FormLayoutMixin = (superClass) =>
|
|
|
294
188
|
this._selectResponsiveStep();
|
|
295
189
|
}
|
|
296
190
|
|
|
297
|
-
/** @private */
|
|
298
|
-
__onAnimationEnd(e) {
|
|
299
|
-
if (e.animationName.indexOf('vaadin-form-layout-appear') === 0) {
|
|
300
|
-
this._selectResponsiveStep();
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
191
|
/** @private */
|
|
305
192
|
_selectResponsiveStep() {
|
|
306
193
|
// Iterate through responsiveSteps and choose the step
|
|
@@ -378,10 +265,7 @@ export const FormLayoutMixin = (superClass) =>
|
|
|
378
265
|
colspan = Math.min(colspan, this._columnCount);
|
|
379
266
|
|
|
380
267
|
const childRatio = colspan / this._columnCount;
|
|
381
|
-
|
|
382
|
-
// Note: using 99.9% for 100% fixes rounding errors in MS Edge
|
|
383
|
-
// (< v16), otherwise the items might wrap, resizing is wobbly.
|
|
384
|
-
child.style.width = `calc(${childRatio * 99.9}% - ${1 - childRatio} * ${columnSpacing})`;
|
|
268
|
+
child.style.width = `calc(${childRatio * 100}% - ${1 - childRatio} * ${columnSpacing})`;
|
|
385
269
|
|
|
386
270
|
if (col + colspan > this._columnCount) {
|
|
387
271
|
// Too big to fit on this row, let's wrap it
|
|
@@ -432,7 +316,15 @@ export const FormLayoutMixin = (superClass) =>
|
|
|
432
316
|
* @protected
|
|
433
317
|
* @override
|
|
434
318
|
*/
|
|
435
|
-
_onResize() {
|
|
319
|
+
_onResize(contentRect) {
|
|
320
|
+
if (contentRect.width === 0 && contentRect.height === 0) {
|
|
321
|
+
this.$.layout.style.opacity = '0';
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
|
|
436
325
|
this._selectResponsiveStep();
|
|
326
|
+
this._updateLayout();
|
|
327
|
+
|
|
328
|
+
this.$.layout.style.opacity = '';
|
|
437
329
|
}
|
|
438
330
|
};
|
|
@@ -7,23 +7,17 @@ import { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
|
7
7
|
|
|
8
8
|
export const formLayoutStyles = css`
|
|
9
9
|
:host {
|
|
10
|
+
/* Default values */
|
|
11
|
+
--vaadin-form-layout-row-spacing: 1em;
|
|
12
|
+
--vaadin-form-layout-column-spacing: 2em;
|
|
13
|
+
--vaadin-form-layout-label-width: 8em;
|
|
14
|
+
--vaadin-form-layout-label-spacing: 1em;
|
|
15
|
+
|
|
10
16
|
display: block;
|
|
11
17
|
max-width: 100%;
|
|
12
|
-
animation: 1ms vaadin-form-layout-appear;
|
|
13
|
-
/* CSS API for host */
|
|
14
|
-
--vaadin-form-item-label-width: 8em;
|
|
15
|
-
--vaadin-form-item-label-spacing: 1em;
|
|
16
|
-
--vaadin-form-item-row-spacing: 1em;
|
|
17
|
-
--vaadin-form-layout-column-spacing: 2em; /* (default) */
|
|
18
18
|
align-self: stretch;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
@keyframes vaadin-form-layout-appear {
|
|
22
|
-
to {
|
|
23
|
-
opacity: 1 !important; /* stylelint-disable-line keyframe-declaration-no-important */
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
21
|
:host([hidden]) {
|
|
28
22
|
display: none !important;
|
|
29
23
|
}
|
|
@@ -56,7 +50,7 @@ export const formItemStyles = css`
|
|
|
56
50
|
display: inline-flex;
|
|
57
51
|
flex-direction: row;
|
|
58
52
|
align-items: baseline;
|
|
59
|
-
margin: calc(0.5 * var(--vaadin-form-item-row-spacing, 1em)) 0;
|
|
53
|
+
margin: calc(0.5 * var(--vaadin-form-item-row-spacing, var(--vaadin-form-layout-row-spacing, 1em))) 0;
|
|
60
54
|
}
|
|
61
55
|
|
|
62
56
|
:host([label-position='top']) {
|
|
@@ -69,7 +63,7 @@ export const formItemStyles = css`
|
|
|
69
63
|
}
|
|
70
64
|
|
|
71
65
|
#label {
|
|
72
|
-
width: var(--vaadin-form-item-label-width, 8em);
|
|
66
|
+
width: var(--vaadin-form-item-label-width, var(--vaadin-form-layout-label-width, 8em));
|
|
73
67
|
flex: 0 0 auto;
|
|
74
68
|
}
|
|
75
69
|
|
|
@@ -78,7 +72,7 @@ export const formItemStyles = css`
|
|
|
78
72
|
}
|
|
79
73
|
|
|
80
74
|
#spacing {
|
|
81
|
-
width: var(--vaadin-form-item-label-spacing, 1em);
|
|
75
|
+
width: var(--vaadin-form-item-label-spacing, var(--vaadin-form-layout-label-spacing, 1em));
|
|
82
76
|
flex: 0 0 auto;
|
|
83
77
|
}
|
|
84
78
|
|
|
@@ -98,6 +98,7 @@ export * from './vaadin-form-layout-mixin.js';
|
|
|
98
98
|
* Custom CSS property | Description | Default
|
|
99
99
|
* ---|---|---
|
|
100
100
|
* `--vaadin-form-layout-column-spacing` | Length of the spacing between columns | `2em`
|
|
101
|
+
* `--vaadin-form-layout-row-spacing` | Length of the spacing between rows | `1em`
|
|
101
102
|
*/
|
|
102
103
|
declare class FormLayout extends FormLayoutMixin(ElementMixin(ThemableMixin(HTMLElement))) {}
|
|
103
104
|
|
|
@@ -101,6 +101,9 @@ registerStyles('vaadin-form-layout', formLayoutStyles, { moduleId: 'vaadin-form-
|
|
|
101
101
|
* Custom CSS property | Description | Default
|
|
102
102
|
* ---|---|---
|
|
103
103
|
* `--vaadin-form-layout-column-spacing` | Length of the spacing between columns | `2em`
|
|
104
|
+
* `--vaadin-form-layout-row-spacing` | Length of the spacing between rows | `1em`
|
|
105
|
+
* `--vaadin-form-layout-label-width` | Width of the label when labels are displayed aside | `8em`
|
|
106
|
+
* `--vaadin-form-layout-label-spacing` | Length of the spacing between the label and the input when labels are displayed aside | `1em`
|
|
104
107
|
*
|
|
105
108
|
* @customElement
|
|
106
109
|
* @extends HTMLElement
|
|
@@ -7,10 +7,6 @@ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themab
|
|
|
7
7
|
registerStyles(
|
|
8
8
|
'vaadin-form-item',
|
|
9
9
|
css`
|
|
10
|
-
:host {
|
|
11
|
-
--vaadin-form-item-row-spacing: 0;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
10
|
/* font-weight, margin-bottom, transition and line-height same as for part label in text-field */
|
|
15
11
|
[part='label'] {
|
|
16
12
|
color: var(--lumo-secondary-text-color);
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/form-layout",
|
|
4
|
-
"version": "24.7.0-
|
|
4
|
+
"version": "24.7.0-beta1",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-form-item",
|
|
11
|
-
"description": "`<vaadin-form-item>` is a Web Component providing labelled form item wrapper\nfor using inside `<vaadin-form-layout>`.\n\n`<vaadin-form-item>` accepts a single child as the input content,\nand also has a separate named `label` slot:\n\n```html\n<vaadin-form-item>\n <label slot=\"label\">Label aside</label>\n <input>\n</vaadin-form-item>\n```\n\nThe label is optional and can be omitted:\n\n```html\n<vaadin-form-item>\n <input type=\"checkbox\"> Subscribe to our Newsletter\n</vaadin-form-item>\n```\n\nBy default, the `label` slot content is displayed aside of the input content.\nWhen `label-position=\"top\"` is set, the `label` slot content is displayed on top:\n\n```html\n<vaadin-form-item label-position=\"top\">\n <label slot=\"label\">Label on top</label>\n <input>\n</vaadin-form-item>\n```\n\n**Note:** Normally, `<vaadin-form-item>` is used as a child of\na `<vaadin-form-layout>` element. Setting `label-position` is unnecessary,\nbecause the `label-position` attribute is triggered automatically by the parent\n`<vaadin-form-layout>`, depending on its width and responsive behavior.\n\n**Deprecation note:** The `label-position` attribute is deprecated since 24.7 and\nwill be removed in Vaadin 25, when a new approach for setting the label position\nwill be introduced.\n\n### Input Width\n\nBy default, `<vaadin-form-item>` does not manipulate the width of the slotted\ninput element. Optionally you can stretch the child input element to fill\nthe available width for the input content by adding the `full-width` class:\n\n```html\n<vaadin-form-item>\n <label slot=\"label\">Label</label>\n <input class=\"full-width\">\n</vaadin-form-item>\n```\n\n### Styling\n\nThe `label-position` host attribute can be used to target the label on top state:\n\n```\n:host([label-position=\"top\"]) {\n padding-top: 0.5rem;\n}\n```\n\n**Deprecation note:** The `label-position` attribute is deprecated since 24.7 and\nwill be removed in Vaadin 25, when a new approach to styling the form-item\nbased on the label position will be introduced.\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---|---\nlabel | The label slot container\n\n### Custom CSS Properties Reference\n\nThe following custom CSS properties are available on the `<vaadin-form-item>`\nelement:\n\nCustom CSS property | Description | Default\n---|---|---\n`--vaadin-form-item-label-width` | Width of the label column when the labels are aside | `8em`\n`--vaadin-form-item-label-spacing` | Spacing between the label column and the input column when the labels are aside | `1em`\n`--vaadin-form-item-row-spacing` | Height of the spacing between the form item elements | `1em`\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
11
|
+
"description": "`<vaadin-form-item>` is a Web Component providing labelled form item wrapper\nfor using inside `<vaadin-form-layout>`.\n\n`<vaadin-form-item>` accepts a single child as the input content,\nand also has a separate named `label` slot:\n\n```html\n<vaadin-form-item>\n <label slot=\"label\">Label aside</label>\n <input>\n</vaadin-form-item>\n```\n\nThe label is optional and can be omitted:\n\n```html\n<vaadin-form-item>\n <input type=\"checkbox\"> Subscribe to our Newsletter\n</vaadin-form-item>\n```\n\nBy default, the `label` slot content is displayed aside of the input content.\nWhen `label-position=\"top\"` is set, the `label` slot content is displayed on top:\n\n```html\n<vaadin-form-item label-position=\"top\">\n <label slot=\"label\">Label on top</label>\n <input>\n</vaadin-form-item>\n```\n\n**Note:** Normally, `<vaadin-form-item>` is used as a child of\na `<vaadin-form-layout>` element. Setting `label-position` is unnecessary,\nbecause the `label-position` attribute is triggered automatically by the parent\n`<vaadin-form-layout>`, depending on its width and responsive behavior.\n\n**Deprecation note:** The `label-position` attribute is deprecated since 24.7 and\nwill be removed in Vaadin 25, when a new approach for setting the label position\nwill be introduced.\n\n### Input Width\n\nBy default, `<vaadin-form-item>` does not manipulate the width of the slotted\ninput element. Optionally you can stretch the child input element to fill\nthe available width for the input content by adding the `full-width` class:\n\n```html\n<vaadin-form-item>\n <label slot=\"label\">Label</label>\n <input class=\"full-width\">\n</vaadin-form-item>\n```\n\n### Styling\n\nThe `label-position` host attribute can be used to target the label on top state:\n\n```\n:host([label-position=\"top\"]) {\n padding-top: 0.5rem;\n}\n```\n\n**Deprecation note:** The `label-position` attribute is deprecated since 24.7 and\nwill be removed in Vaadin 25, when a new approach to styling the form-item\nbased on the label position will be introduced.\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---|---\nlabel | The label slot container\n\n### Custom CSS Properties Reference\n\nThe following custom CSS properties are available on the `<vaadin-form-item>`\nelement:\n\nCustom CSS property | Description | Default\n---|---|---\n`--vaadin-form-item-label-width` | (DEPRECATED: Use `--vaadin-form-layout-label-width` on `<vaadin-form-layout>` instead) Width of the label column when the labels are aside | `8em`\n`--vaadin-form-item-label-spacing` | (DEPRECATED: Use `--vaadin-form-layout-label-spacing` on `<vaadin-form-layout>` instead) Spacing between the label column and the input column when the labels are aside | `1em`\n`--vaadin-form-item-row-spacing` | (DEPRECATED: Use `--vaadin-form-layout-row-spacing` on `<vaadin-form-layout>` instead) Height of the spacing between the form item elements | `1em`\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "theme",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
"name": "vaadin-form-layout",
|
|
32
|
-
"description": "`<vaadin-form-layout>` is a Web Component providing configurable responsive\nlayout for form elements.\n\n```html\n<vaadin-form-layout>\n\n <vaadin-form-item>\n <label slot=\"label\">First Name</label>\n <input class=\"full-width\" value=\"Jane\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">Last Name</label>\n <input class=\"full-width\" value=\"Doe\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">Email</label>\n <input class=\"full-width\" value=\"jane.doe@example.com\">\n </vaadin-form-item>\n\n</vaadin-form-layout>\n```\n\nIt supports any child elements as layout items.\n\nBy default, it makes a layout of two columns if the element width is equal or\nwider than 40em, and a single column layout otherwise.\n\nThe number of columns and the responsive behavior are customizable with\nthe `responsiveSteps` property.\n\n### Spanning Items on Multiple Columns\n\nYou can use `colspan` or `data-colspan` attribute on the items.\nIn the example below, the first text field spans on two columns:\n\n```html\n<vaadin-form-layout>\n\n <vaadin-form-item colspan=\"2\">\n <label slot=\"label\">Address</label>\n <input class=\"full-width\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">First Name</label>\n <input class=\"full-width\" value=\"Jane\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">Last Name</label>\n <input class=\"full-width\" value=\"Doe\">\n </vaadin-form-item>\n\n</vaadin-form-layout>\n```\n\n### Explicit New Row\n\nUse the `<br>` line break element to wrap the items on a new row:\n\n```html\n<vaadin-form-layout>\n\n <vaadin-form-item>\n <label slot=\"label\">Email</label>\n <input class=\"full-width\">\n </vaadin-form-item>\n\n <br>\n\n <vaadin-form-item>\n <label slot=\"label\">Confirm Email</label>\n <input class=\"full-width\">\n </vaadin-form-item>\n\n</vaadin-form-layout>\n```\n\n### CSS Properties Reference\n\nThe following custom CSS properties are available on the `<vaadin-form-layout>`\nelement:\n\nCustom CSS property | Description | Default\n---|---|---\n`--vaadin-form-layout-column-spacing` | Length of the spacing between columns | `2em`",
|
|
32
|
+
"description": "`<vaadin-form-layout>` is a Web Component providing configurable responsive\nlayout for form elements.\n\n```html\n<vaadin-form-layout>\n\n <vaadin-form-item>\n <label slot=\"label\">First Name</label>\n <input class=\"full-width\" value=\"Jane\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">Last Name</label>\n <input class=\"full-width\" value=\"Doe\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">Email</label>\n <input class=\"full-width\" value=\"jane.doe@example.com\">\n </vaadin-form-item>\n\n</vaadin-form-layout>\n```\n\nIt supports any child elements as layout items.\n\nBy default, it makes a layout of two columns if the element width is equal or\nwider than 40em, and a single column layout otherwise.\n\nThe number of columns and the responsive behavior are customizable with\nthe `responsiveSteps` property.\n\n### Spanning Items on Multiple Columns\n\nYou can use `colspan` or `data-colspan` attribute on the items.\nIn the example below, the first text field spans on two columns:\n\n```html\n<vaadin-form-layout>\n\n <vaadin-form-item colspan=\"2\">\n <label slot=\"label\">Address</label>\n <input class=\"full-width\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">First Name</label>\n <input class=\"full-width\" value=\"Jane\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">Last Name</label>\n <input class=\"full-width\" value=\"Doe\">\n </vaadin-form-item>\n\n</vaadin-form-layout>\n```\n\n### Explicit New Row\n\nUse the `<br>` line break element to wrap the items on a new row:\n\n```html\n<vaadin-form-layout>\n\n <vaadin-form-item>\n <label slot=\"label\">Email</label>\n <input class=\"full-width\">\n </vaadin-form-item>\n\n <br>\n\n <vaadin-form-item>\n <label slot=\"label\">Confirm Email</label>\n <input class=\"full-width\">\n </vaadin-form-item>\n\n</vaadin-form-layout>\n```\n\n### CSS Properties Reference\n\nThe following custom CSS properties are available on the `<vaadin-form-layout>`\nelement:\n\nCustom CSS property | Description | Default\n---|---|---\n`--vaadin-form-layout-column-spacing` | Length of the spacing between columns | `2em`\n`--vaadin-form-layout-row-spacing` | Length of the spacing between rows | `1em`\n`--vaadin-form-layout-label-width` | Width of the label when labels are displayed aside | `8em`\n`--vaadin-form-layout-label-spacing` | Length of the spacing between the label and the input when labels are displayed aside | `1em`",
|
|
33
33
|
"attributes": [
|
|
34
34
|
{
|
|
35
35
|
"name": "theme",
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/form-layout",
|
|
4
|
-
"version": "24.7.0-
|
|
4
|
+
"version": "24.7.0-beta1",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
"elements": [
|
|
17
17
|
{
|
|
18
18
|
"name": "vaadin-form-item",
|
|
19
|
-
"description": "`<vaadin-form-item>` is a Web Component providing labelled form item wrapper\nfor using inside `<vaadin-form-layout>`.\n\n`<vaadin-form-item>` accepts a single child as the input content,\nand also has a separate named `label` slot:\n\n```html\n<vaadin-form-item>\n <label slot=\"label\">Label aside</label>\n <input>\n</vaadin-form-item>\n```\n\nThe label is optional and can be omitted:\n\n```html\n<vaadin-form-item>\n <input type=\"checkbox\"> Subscribe to our Newsletter\n</vaadin-form-item>\n```\n\nBy default, the `label` slot content is displayed aside of the input content.\nWhen `label-position=\"top\"` is set, the `label` slot content is displayed on top:\n\n```html\n<vaadin-form-item label-position=\"top\">\n <label slot=\"label\">Label on top</label>\n <input>\n</vaadin-form-item>\n```\n\n**Note:** Normally, `<vaadin-form-item>` is used as a child of\na `<vaadin-form-layout>` element. Setting `label-position` is unnecessary,\nbecause the `label-position` attribute is triggered automatically by the parent\n`<vaadin-form-layout>`, depending on its width and responsive behavior.\n\n**Deprecation note:** The `label-position` attribute is deprecated since 24.7 and\nwill be removed in Vaadin 25, when a new approach for setting the label position\nwill be introduced.\n\n### Input Width\n\nBy default, `<vaadin-form-item>` does not manipulate the width of the slotted\ninput element. Optionally you can stretch the child input element to fill\nthe available width for the input content by adding the `full-width` class:\n\n```html\n<vaadin-form-item>\n <label slot=\"label\">Label</label>\n <input class=\"full-width\">\n</vaadin-form-item>\n```\n\n### Styling\n\nThe `label-position` host attribute can be used to target the label on top state:\n\n```\n:host([label-position=\"top\"]) {\n padding-top: 0.5rem;\n}\n```\n\n**Deprecation note:** The `label-position` attribute is deprecated since 24.7 and\nwill be removed in Vaadin 25, when a new approach to styling the form-item\nbased on the label position will be introduced.\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---|---\nlabel | The label slot container\n\n### Custom CSS Properties Reference\n\nThe following custom CSS properties are available on the `<vaadin-form-item>`\nelement:\n\nCustom CSS property | Description | Default\n---|---|---\n`--vaadin-form-item-label-width` | Width of the label column when the labels are aside | `8em`\n`--vaadin-form-item-label-spacing` | Spacing between the label column and the input column when the labels are aside | `1em`\n`--vaadin-form-item-row-spacing` | Height of the spacing between the form item elements | `1em`\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
19
|
+
"description": "`<vaadin-form-item>` is a Web Component providing labelled form item wrapper\nfor using inside `<vaadin-form-layout>`.\n\n`<vaadin-form-item>` accepts a single child as the input content,\nand also has a separate named `label` slot:\n\n```html\n<vaadin-form-item>\n <label slot=\"label\">Label aside</label>\n <input>\n</vaadin-form-item>\n```\n\nThe label is optional and can be omitted:\n\n```html\n<vaadin-form-item>\n <input type=\"checkbox\"> Subscribe to our Newsletter\n</vaadin-form-item>\n```\n\nBy default, the `label` slot content is displayed aside of the input content.\nWhen `label-position=\"top\"` is set, the `label` slot content is displayed on top:\n\n```html\n<vaadin-form-item label-position=\"top\">\n <label slot=\"label\">Label on top</label>\n <input>\n</vaadin-form-item>\n```\n\n**Note:** Normally, `<vaadin-form-item>` is used as a child of\na `<vaadin-form-layout>` element. Setting `label-position` is unnecessary,\nbecause the `label-position` attribute is triggered automatically by the parent\n`<vaadin-form-layout>`, depending on its width and responsive behavior.\n\n**Deprecation note:** The `label-position` attribute is deprecated since 24.7 and\nwill be removed in Vaadin 25, when a new approach for setting the label position\nwill be introduced.\n\n### Input Width\n\nBy default, `<vaadin-form-item>` does not manipulate the width of the slotted\ninput element. Optionally you can stretch the child input element to fill\nthe available width for the input content by adding the `full-width` class:\n\n```html\n<vaadin-form-item>\n <label slot=\"label\">Label</label>\n <input class=\"full-width\">\n</vaadin-form-item>\n```\n\n### Styling\n\nThe `label-position` host attribute can be used to target the label on top state:\n\n```\n:host([label-position=\"top\"]) {\n padding-top: 0.5rem;\n}\n```\n\n**Deprecation note:** The `label-position` attribute is deprecated since 24.7 and\nwill be removed in Vaadin 25, when a new approach to styling the form-item\nbased on the label position will be introduced.\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---|---\nlabel | The label slot container\n\n### Custom CSS Properties Reference\n\nThe following custom CSS properties are available on the `<vaadin-form-item>`\nelement:\n\nCustom CSS property | Description | Default\n---|---|---\n`--vaadin-form-item-label-width` | (DEPRECATED: Use `--vaadin-form-layout-label-width` on `<vaadin-form-layout>` instead) Width of the label column when the labels are aside | `8em`\n`--vaadin-form-item-label-spacing` | (DEPRECATED: Use `--vaadin-form-layout-label-spacing` on `<vaadin-form-layout>` instead) Spacing between the label column and the input column when the labels are aside | `1em`\n`--vaadin-form-item-row-spacing` | (DEPRECATED: Use `--vaadin-form-layout-row-spacing` on `<vaadin-form-layout>` instead) Height of the spacing between the form item elements | `1em`\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": []
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
"name": "vaadin-form-layout",
|
|
25
|
-
"description": "`<vaadin-form-layout>` is a Web Component providing configurable responsive\nlayout for form elements.\n\n```html\n<vaadin-form-layout>\n\n <vaadin-form-item>\n <label slot=\"label\">First Name</label>\n <input class=\"full-width\" value=\"Jane\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">Last Name</label>\n <input class=\"full-width\" value=\"Doe\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">Email</label>\n <input class=\"full-width\" value=\"jane.doe@example.com\">\n </vaadin-form-item>\n\n</vaadin-form-layout>\n```\n\nIt supports any child elements as layout items.\n\nBy default, it makes a layout of two columns if the element width is equal or\nwider than 40em, and a single column layout otherwise.\n\nThe number of columns and the responsive behavior are customizable with\nthe `responsiveSteps` property.\n\n### Spanning Items on Multiple Columns\n\nYou can use `colspan` or `data-colspan` attribute on the items.\nIn the example below, the first text field spans on two columns:\n\n```html\n<vaadin-form-layout>\n\n <vaadin-form-item colspan=\"2\">\n <label slot=\"label\">Address</label>\n <input class=\"full-width\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">First Name</label>\n <input class=\"full-width\" value=\"Jane\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">Last Name</label>\n <input class=\"full-width\" value=\"Doe\">\n </vaadin-form-item>\n\n</vaadin-form-layout>\n```\n\n### Explicit New Row\n\nUse the `<br>` line break element to wrap the items on a new row:\n\n```html\n<vaadin-form-layout>\n\n <vaadin-form-item>\n <label slot=\"label\">Email</label>\n <input class=\"full-width\">\n </vaadin-form-item>\n\n <br>\n\n <vaadin-form-item>\n <label slot=\"label\">Confirm Email</label>\n <input class=\"full-width\">\n </vaadin-form-item>\n\n</vaadin-form-layout>\n```\n\n### CSS Properties Reference\n\nThe following custom CSS properties are available on the `<vaadin-form-layout>`\nelement:\n\nCustom CSS property | Description | Default\n---|---|---\n`--vaadin-form-layout-column-spacing` | Length of the spacing between columns | `2em`",
|
|
25
|
+
"description": "`<vaadin-form-layout>` is a Web Component providing configurable responsive\nlayout for form elements.\n\n```html\n<vaadin-form-layout>\n\n <vaadin-form-item>\n <label slot=\"label\">First Name</label>\n <input class=\"full-width\" value=\"Jane\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">Last Name</label>\n <input class=\"full-width\" value=\"Doe\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">Email</label>\n <input class=\"full-width\" value=\"jane.doe@example.com\">\n </vaadin-form-item>\n\n</vaadin-form-layout>\n```\n\nIt supports any child elements as layout items.\n\nBy default, it makes a layout of two columns if the element width is equal or\nwider than 40em, and a single column layout otherwise.\n\nThe number of columns and the responsive behavior are customizable with\nthe `responsiveSteps` property.\n\n### Spanning Items on Multiple Columns\n\nYou can use `colspan` or `data-colspan` attribute on the items.\nIn the example below, the first text field spans on two columns:\n\n```html\n<vaadin-form-layout>\n\n <vaadin-form-item colspan=\"2\">\n <label slot=\"label\">Address</label>\n <input class=\"full-width\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">First Name</label>\n <input class=\"full-width\" value=\"Jane\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">Last Name</label>\n <input class=\"full-width\" value=\"Doe\">\n </vaadin-form-item>\n\n</vaadin-form-layout>\n```\n\n### Explicit New Row\n\nUse the `<br>` line break element to wrap the items on a new row:\n\n```html\n<vaadin-form-layout>\n\n <vaadin-form-item>\n <label slot=\"label\">Email</label>\n <input class=\"full-width\">\n </vaadin-form-item>\n\n <br>\n\n <vaadin-form-item>\n <label slot=\"label\">Confirm Email</label>\n <input class=\"full-width\">\n </vaadin-form-item>\n\n</vaadin-form-layout>\n```\n\n### CSS Properties Reference\n\nThe following custom CSS properties are available on the `<vaadin-form-layout>`\nelement:\n\nCustom CSS property | Description | Default\n---|---|---\n`--vaadin-form-layout-column-spacing` | Length of the spacing between columns | `2em`\n`--vaadin-form-layout-row-spacing` | Length of the spacing between rows | `1em`\n`--vaadin-form-layout-label-width` | Width of the label when labels are displayed aside | `8em`\n`--vaadin-form-layout-label-spacing` | Length of the spacing between the label and the input when labels are displayed aside | `1em`",
|
|
26
26
|
"extension": true,
|
|
27
27
|
"attributes": [
|
|
28
28
|
{
|