@vaadin/form-layout 24.7.0-alpha7 → 24.7.0-alpha9
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 +12 -10
- package/src/vaadin-form-item-mixin.js +15 -0
- package/src/vaadin-form-item.d.ts +9 -1
- package/src/vaadin-form-item.js +9 -1
- package/src/vaadin-form-layout-mixin.js +33 -136
- package/src/vaadin-form-layout-styles.js +2 -9
- package/src/vaadin-form-layout.d.ts +1 -0
- package/src/vaadin-form-layout.js +1 -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-alpha9",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,22 +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-alpha9",
|
|
41
|
+
"@vaadin/component-base": "24.7.0-alpha9",
|
|
42
|
+
"@vaadin/vaadin-lumo-styles": "24.7.0-alpha9",
|
|
43
|
+
"@vaadin/vaadin-material-styles": "24.7.0-alpha9",
|
|
44
|
+
"@vaadin/vaadin-themable-mixin": "24.7.0-alpha9",
|
|
45
|
+
"lit": "^3.0.0"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
|
-
"@vaadin/chai-plugins": "24.7.0-
|
|
48
|
-
"@vaadin/custom-field": "24.7.0-
|
|
48
|
+
"@vaadin/chai-plugins": "24.7.0-alpha9",
|
|
49
|
+
"@vaadin/custom-field": "24.7.0-alpha9",
|
|
50
|
+
"@vaadin/test-runner-commands": "24.7.0-alpha9",
|
|
49
51
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
50
|
-
"@vaadin/text-field": "24.7.0-
|
|
52
|
+
"@vaadin/text-field": "24.7.0-alpha9",
|
|
51
53
|
"sinon": "^18.0.0"
|
|
52
54
|
},
|
|
53
55
|
"web-types": [
|
|
54
56
|
"web-types.json",
|
|
55
57
|
"web-types.lit.json"
|
|
56
58
|
],
|
|
57
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "b0a16c6ed7fc50a22a42dcab0649d74f4c300485"
|
|
58
60
|
}
|
|
@@ -6,6 +6,8 @@
|
|
|
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 itemRowSpacingDeprecationNotified = false;
|
|
10
|
+
|
|
9
11
|
/**
|
|
10
12
|
* @polymerMixin
|
|
11
13
|
*/
|
|
@@ -42,6 +44,19 @@ export const FormItemMixin = (superClass) =>
|
|
|
42
44
|
this.__fieldNode = null;
|
|
43
45
|
}
|
|
44
46
|
|
|
47
|
+
connectedCallback() {
|
|
48
|
+
super.connectedCallback();
|
|
49
|
+
if (!itemRowSpacingDeprecationNotified) {
|
|
50
|
+
const spacing = getComputedStyle(this).getPropertyValue('--vaadin-form-item-row-spacing');
|
|
51
|
+
if (spacing !== '' && parseInt(spacing) !== 0) {
|
|
52
|
+
console.warn(
|
|
53
|
+
'`--vaadin-form-item-row-spacing` is deprecated since 24.7. Use `--vaadin-form-layout-row-spacing` on <vaadin-form-layout> instead.',
|
|
54
|
+
);
|
|
55
|
+
itemRowSpacingDeprecationNotified = true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
45
60
|
/**
|
|
46
61
|
* Returns a target element to add ARIA attributes to for a field.
|
|
47
62
|
*
|
|
@@ -43,6 +43,10 @@ import { FormItemMixin } from './vaadin-form-item-mixin.js';
|
|
|
43
43
|
* because the `label-position` attribute is triggered automatically by the parent
|
|
44
44
|
* `<vaadin-form-layout>`, depending on its width and responsive behavior.
|
|
45
45
|
*
|
|
46
|
+
* **Deprecation note:** The `label-position` attribute is deprecated since 24.7 and
|
|
47
|
+
* will be removed in Vaadin 25, when a new approach for setting the label position
|
|
48
|
+
* will be introduced.
|
|
49
|
+
*
|
|
46
50
|
* ### Input Width
|
|
47
51
|
*
|
|
48
52
|
* By default, `<vaadin-form-item>` does not manipulate the width of the slotted
|
|
@@ -66,6 +70,10 @@ import { FormItemMixin } from './vaadin-form-item-mixin.js';
|
|
|
66
70
|
* }
|
|
67
71
|
* ```
|
|
68
72
|
*
|
|
73
|
+
* **Deprecation note:** The `label-position` attribute is deprecated since 24.7 and
|
|
74
|
+
* will be removed in Vaadin 25, when a new approach to styling the form-item
|
|
75
|
+
* based on the label position will be introduced.
|
|
76
|
+
*
|
|
69
77
|
* The following shadow DOM parts are available for styling:
|
|
70
78
|
*
|
|
71
79
|
* Part name | Description
|
|
@@ -81,7 +89,7 @@ import { FormItemMixin } from './vaadin-form-item-mixin.js';
|
|
|
81
89
|
* ---|---|---
|
|
82
90
|
* `--vaadin-form-item-label-width` | Width of the label column when the labels are aside | `8em`
|
|
83
91
|
* `--vaadin-form-item-label-spacing` | Spacing between the label column and the input column when the labels are aside | `1em`
|
|
84
|
-
* `--vaadin-form-item-row-spacing` | Height of the spacing between the form item elements | `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`
|
|
85
93
|
*
|
|
86
94
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
87
95
|
*/
|
package/src/vaadin-form-item.js
CHANGED
|
@@ -48,6 +48,10 @@ registerStyles('vaadin-form-item', formItemStyles, { moduleId: 'vaadin-form-item
|
|
|
48
48
|
* because the `label-position` attribute is triggered automatically by the parent
|
|
49
49
|
* `<vaadin-form-layout>`, depending on its width and responsive behavior.
|
|
50
50
|
*
|
|
51
|
+
* **Deprecation note:** The `label-position` attribute is deprecated since 24.7 and
|
|
52
|
+
* will be removed in Vaadin 25, when a new approach for setting the label position
|
|
53
|
+
* will be introduced.
|
|
54
|
+
*
|
|
51
55
|
* ### Input Width
|
|
52
56
|
*
|
|
53
57
|
* By default, `<vaadin-form-item>` does not manipulate the width of the slotted
|
|
@@ -71,6 +75,10 @@ registerStyles('vaadin-form-item', formItemStyles, { moduleId: 'vaadin-form-item
|
|
|
71
75
|
* }
|
|
72
76
|
* ```
|
|
73
77
|
*
|
|
78
|
+
* **Deprecation note:** The `label-position` attribute is deprecated since 24.7 and
|
|
79
|
+
* will be removed in Vaadin 25, when a new approach to styling the form-item
|
|
80
|
+
* based on the label position will be introduced.
|
|
81
|
+
*
|
|
74
82
|
* The following shadow DOM parts are available for styling:
|
|
75
83
|
*
|
|
76
84
|
* Part name | Description
|
|
@@ -86,7 +94,7 @@ registerStyles('vaadin-form-item', formItemStyles, { moduleId: 'vaadin-form-item
|
|
|
86
94
|
* ---|---|---
|
|
87
95
|
* `--vaadin-form-item-label-width` | Width of the label column when the labels are aside | `8em`
|
|
88
96
|
* `--vaadin-form-item-label-spacing` | Spacing between the label column and the input column when the labels are aside | `1em`
|
|
89
|
-
* `--vaadin-form-item-row-spacing` | Height of the spacing between the form item elements | `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`
|
|
90
98
|
*
|
|
91
99
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
92
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,110 +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();
|
|
116
|
-
|
|
117
|
-
this.addEventListener('animationend', this.__onAnimationEnd);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
constructor() {
|
|
121
|
-
super();
|
|
109
|
+
connectedCallback() {
|
|
110
|
+
super.connectedCallback();
|
|
122
111
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
this.
|
|
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 });
|
|
126
115
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
this.$.layout.style.opacity = 0;
|
|
131
|
-
}
|
|
132
|
-
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)) {
|
|
133
119
|
this._updateLayout();
|
|
134
|
-
this.$.layout.style.opacity = '';
|
|
135
120
|
}
|
|
136
|
-
this.__isVisible = entry.isIntersecting;
|
|
137
121
|
});
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
122
|
+
this.__childrenAttributesObserver.observe(this, {
|
|
123
|
+
subtree: true,
|
|
124
|
+
attributes: true,
|
|
125
|
+
attributeFilter: ['colspan', 'data-colspan', 'hidden'],
|
|
126
|
+
});
|
|
143
127
|
|
|
144
128
|
requestAnimationFrame(() => this._selectResponsiveStep());
|
|
145
129
|
requestAnimationFrame(() => this._updateLayout());
|
|
146
|
-
|
|
147
|
-
this._observeChildrenColspanChange();
|
|
148
|
-
this.__intersectionObserver.observe(this.$.layout);
|
|
149
130
|
}
|
|
150
131
|
|
|
151
132
|
/** @protected */
|
|
152
133
|
disconnectedCallback() {
|
|
153
134
|
super.disconnectedCallback();
|
|
154
135
|
|
|
155
|
-
this.
|
|
156
|
-
this.
|
|
157
|
-
this.__intersectionObserver.disconnect();
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/** @private */
|
|
161
|
-
_observeChildrenColspanChange() {
|
|
162
|
-
// Observe changes in form items' `colspan` attribute and update styles
|
|
163
|
-
const mutationObserverConfig = { attributes: true };
|
|
164
|
-
|
|
165
|
-
this.__mutationObserver = new MutationObserver((mutationRecord) => {
|
|
166
|
-
mutationRecord.forEach((mutation) => {
|
|
167
|
-
if (
|
|
168
|
-
mutation.type === 'attributes' &&
|
|
169
|
-
(mutation.attributeName === 'colspan' ||
|
|
170
|
-
mutation.attributeName === 'data-colspan' ||
|
|
171
|
-
mutation.attributeName === 'hidden')
|
|
172
|
-
) {
|
|
173
|
-
this._updateLayout();
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
// Observe changes to initial children
|
|
179
|
-
[...this.children].forEach((child) => {
|
|
180
|
-
this.__mutationObserver.observe(child, mutationObserverConfig);
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
// Observe changes to lazily added nodes
|
|
184
|
-
this.__childObserver = new MutationObserver((mutations) => {
|
|
185
|
-
const addedNodes = [];
|
|
186
|
-
const removedNodes = [];
|
|
187
|
-
|
|
188
|
-
mutations.forEach((mutation) => {
|
|
189
|
-
addedNodes.push(...this._getObservableNodes(mutation.addedNodes));
|
|
190
|
-
removedNodes.push(...this._getObservableNodes(mutation.removedNodes));
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
addedNodes.forEach((child) => {
|
|
194
|
-
this.__mutationObserver.observe(child, mutationObserverConfig);
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
if (addedNodes.length > 0 || removedNodes.length > 0) {
|
|
198
|
-
this._updateLayout();
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
this.__childObserver.observe(this, { childList: true });
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/** @private */
|
|
206
|
-
_getObservableNodes(nodeList) {
|
|
207
|
-
const ignore = ['template', 'style', 'dom-repeat', 'dom-if'];
|
|
208
|
-
return Array.from(nodeList).filter(
|
|
209
|
-
(node) => node.nodeType === Node.ELEMENT_NODE && ignore.indexOf(node.localName.toLowerCase()) === -1,
|
|
210
|
-
);
|
|
136
|
+
this.__childrenObserver.disconnect();
|
|
137
|
+
this.__childrenAttributesObserver.disconnect();
|
|
211
138
|
}
|
|
212
139
|
|
|
213
140
|
/** @private */
|
|
@@ -218,34 +145,6 @@ export const FormLayoutMixin = (superClass) =>
|
|
|
218
145
|
return 1;
|
|
219
146
|
}
|
|
220
147
|
|
|
221
|
-
/** @private */
|
|
222
|
-
_isValidCSSLength(value) {
|
|
223
|
-
// Let us choose a CSS property for validating CSS <length> values:
|
|
224
|
-
// - `border-spacing` accepts `<length> | inherit`, it's the best! But
|
|
225
|
-
// it does not disallow invalid values at all in MSIE :-(
|
|
226
|
-
// - `letter-spacing` and `word-spacing` accept
|
|
227
|
-
// `<length> | normal | inherit`, and disallows everything else, like
|
|
228
|
-
// `<percentage>`, `auto` and such, good enough.
|
|
229
|
-
// - `word-spacing` is used since its shorter.
|
|
230
|
-
|
|
231
|
-
// Disallow known keywords allowed as the `word-spacing` value
|
|
232
|
-
if (value === 'inherit' || value === 'normal') {
|
|
233
|
-
return false;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
// Use the value in a stylesheet and check the parsed value. Invalid
|
|
237
|
-
// input value results in empty parsed value.
|
|
238
|
-
this._styleElement.firstChild.nodeValue = `#styleElement { word-spacing: ${value}; }`;
|
|
239
|
-
|
|
240
|
-
if (!this._styleElement.sheet) {
|
|
241
|
-
// Stylesheet is not ready, probably not attached to the document yet.
|
|
242
|
-
return true;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
// Safari 9 sets invalid CSS rules' value to `null`
|
|
246
|
-
return ['', null].indexOf(this._styleElement.sheet.cssRules[0].style.getPropertyValue('word-spacing')) < 0;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
148
|
/** @private */
|
|
250
149
|
_responsiveStepsChanged(responsiveSteps, oldResponsiveSteps) {
|
|
251
150
|
try {
|
|
@@ -262,7 +161,7 @@ export const FormLayoutMixin = (superClass) =>
|
|
|
262
161
|
throw new Error(`Invalid 'columns' value of ${step.columns}, a natural number is required.`);
|
|
263
162
|
}
|
|
264
163
|
|
|
265
|
-
if (step.minWidth !== undefined && !
|
|
164
|
+
if (step.minWidth !== undefined && !isValidCSSLength(step.minWidth)) {
|
|
266
165
|
throw new Error(`Invalid 'minWidth' value of ${step.minWidth}, a valid CSS length required.`);
|
|
267
166
|
}
|
|
268
167
|
|
|
@@ -289,13 +188,6 @@ export const FormLayoutMixin = (superClass) =>
|
|
|
289
188
|
this._selectResponsiveStep();
|
|
290
189
|
}
|
|
291
190
|
|
|
292
|
-
/** @private */
|
|
293
|
-
__onAnimationEnd(e) {
|
|
294
|
-
if (e.animationName.indexOf('vaadin-form-layout-appear') === 0) {
|
|
295
|
-
this._selectResponsiveStep();
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
|
|
299
191
|
/** @private */
|
|
300
192
|
_selectResponsiveStep() {
|
|
301
193
|
// Iterate through responsiveSteps and choose the step
|
|
@@ -373,10 +265,7 @@ export const FormLayoutMixin = (superClass) =>
|
|
|
373
265
|
colspan = Math.min(colspan, this._columnCount);
|
|
374
266
|
|
|
375
267
|
const childRatio = colspan / this._columnCount;
|
|
376
|
-
|
|
377
|
-
// Note: using 99.9% for 100% fixes rounding errors in MS Edge
|
|
378
|
-
// (< v16), otherwise the items might wrap, resizing is wobbly.
|
|
379
|
-
child.style.width = `calc(${childRatio * 99.9}% - ${1 - childRatio} * ${columnSpacing})`;
|
|
268
|
+
child.style.width = `calc(${childRatio * 100}% - ${1 - childRatio} * ${columnSpacing})`;
|
|
380
269
|
|
|
381
270
|
if (col + colspan > this._columnCount) {
|
|
382
271
|
// Too big to fit on this row, let's wrap it
|
|
@@ -427,7 +316,15 @@ export const FormLayoutMixin = (superClass) =>
|
|
|
427
316
|
* @protected
|
|
428
317
|
* @override
|
|
429
318
|
*/
|
|
430
|
-
_onResize() {
|
|
319
|
+
_onResize(contentRect) {
|
|
320
|
+
if (contentRect.width === 0 && contentRect.height === 0) {
|
|
321
|
+
this.$.layout.style.opacity = '0';
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
|
|
431
325
|
this._selectResponsiveStep();
|
|
326
|
+
this._updateLayout();
|
|
327
|
+
|
|
328
|
+
this.$.layout.style.opacity = '';
|
|
432
329
|
}
|
|
433
330
|
};
|
|
@@ -9,21 +9,14 @@ export const formLayoutStyles = css`
|
|
|
9
9
|
:host {
|
|
10
10
|
display: block;
|
|
11
11
|
max-width: 100%;
|
|
12
|
-
animation: 1ms vaadin-form-layout-appear;
|
|
13
12
|
/* CSS API for host */
|
|
14
13
|
--vaadin-form-item-label-width: 8em;
|
|
15
14
|
--vaadin-form-item-label-spacing: 1em;
|
|
16
|
-
--vaadin-form-
|
|
15
|
+
--vaadin-form-layout-row-spacing: 1em;
|
|
17
16
|
--vaadin-form-layout-column-spacing: 2em; /* (default) */
|
|
18
17
|
align-self: stretch;
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
@keyframes vaadin-form-layout-appear {
|
|
22
|
-
to {
|
|
23
|
-
opacity: 1 !important; /* stylelint-disable-line keyframe-declaration-no-important */
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
20
|
:host([hidden]) {
|
|
28
21
|
display: none !important;
|
|
29
22
|
}
|
|
@@ -56,7 +49,7 @@ export const formItemStyles = css`
|
|
|
56
49
|
display: inline-flex;
|
|
57
50
|
flex-direction: row;
|
|
58
51
|
align-items: baseline;
|
|
59
|
-
margin: calc(0.5 * var(--vaadin-form-item-row-spacing, 1em)) 0;
|
|
52
|
+
margin: calc(0.5 * var(--vaadin-form-item-row-spacing, var(--vaadin-form-layout-row-spacing, 1em))) 0;
|
|
60
53
|
}
|
|
61
54
|
|
|
62
55
|
:host([label-position='top']) {
|
|
@@ -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,7 @@ 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`
|
|
104
105
|
*
|
|
105
106
|
* @customElement
|
|
106
107
|
* @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-alpha9",
|
|
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### 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\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` | 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` | (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`",
|
|
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-alpha9",
|
|
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### 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\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` | 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` | (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`",
|
|
26
26
|
"extension": true,
|
|
27
27
|
"attributes": [
|
|
28
28
|
{
|