@vaadin/form-layout 24.8.0-alpha9 → 25.0.0-alpha2
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/README.md +0 -23
- package/package.json +12 -15
- package/src/layouts/auto-responsive-layout.js +4 -3
- package/src/vaadin-form-item.js +13 -9
- package/src/vaadin-form-layout-mixin.d.ts +11 -0
- package/src/vaadin-form-layout-mixin.js +26 -2
- package/src/vaadin-form-layout-styles.js +23 -11
- package/src/vaadin-form-layout.js +10 -6
- package/src/vaadin-form-row.js +10 -6
- package/web-types.json +24 -2
- package/web-types.lit.json +9 -2
- package/src/vaadin-lit-form-item.d.ts +0 -6
- package/src/vaadin-lit-form-item.js +0 -48
- package/src/vaadin-lit-form-layout.d.ts +0 -6
- package/src/vaadin-lit-form-layout.js +0 -44
- package/src/vaadin-lit-form-row.d.ts +0 -6
- package/src/vaadin-lit-form-row.js +0 -38
- package/theme/lumo/vaadin-lit-form-item.d.ts +0 -2
- package/theme/lumo/vaadin-lit-form-item.js +0 -2
- package/theme/lumo/vaadin-lit-form-layout.d.ts +0 -2
- package/theme/lumo/vaadin-lit-form-layout.js +0 -2
- package/theme/lumo/vaadin-lit-form-row.d.ts +0 -1
- package/theme/lumo/vaadin-lit-form-row.js +0 -1
- package/theme/material/vaadin-form-item-styles.d.ts +0 -2
- package/theme/material/vaadin-form-item-styles.js +0 -28
- package/theme/material/vaadin-form-item.d.ts +0 -2
- package/theme/material/vaadin-form-item.js +0 -2
- package/theme/material/vaadin-form-layout.d.ts +0 -1
- package/theme/material/vaadin-form-layout.js +0 -1
- package/theme/material/vaadin-form-row.d.ts +0 -1
- package/theme/material/vaadin-form-row.js +0 -1
- package/theme/material/vaadin-lit-form-item.d.ts +0 -2
- package/theme/material/vaadin-lit-form-item.js +0 -2
- package/theme/material/vaadin-lit-form-layout.d.ts +0 -1
- package/theme/material/vaadin-lit-form-layout.js +0 -1
- package/theme/material/vaadin-lit-form-row.d.ts +0 -1
- package/theme/material/vaadin-lit-form-row.js +0 -1
- package/vaadin-lit-form-item.d.ts +0 -1
- package/vaadin-lit-form-item.js +0 -2
- package/vaadin-lit-form-layout.d.ts +0 -1
- package/vaadin-lit-form-layout.js +0 -2
- package/vaadin-lit-form-row.d.ts +0 -1
- package/vaadin-lit-form-row.js +0 -2
package/README.md
CHANGED
|
@@ -30,29 +30,6 @@ Once installed, import the component in your application:
|
|
|
30
30
|
import '@vaadin/form-layout';
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
## Themes
|
|
34
|
-
|
|
35
|
-
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
|
|
36
|
-
The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/form-layout/vaadin-form-layout.js) of the package uses the Lumo theme.
|
|
37
|
-
|
|
38
|
-
To use the Material theme, import the component from the `theme/material` folder:
|
|
39
|
-
|
|
40
|
-
```js
|
|
41
|
-
import '@vaadin/form-layout/theme/material/vaadin-form-layout.js';
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
You can also import the Lumo version of the component explicitly:
|
|
45
|
-
|
|
46
|
-
```js
|
|
47
|
-
import '@vaadin/form-layout/theme/lumo/vaadin-form-layout.js';
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
|
|
51
|
-
|
|
52
|
-
```js
|
|
53
|
-
import '@vaadin/form-layout/src/vaadin-form-layout.js';
|
|
54
|
-
```
|
|
55
|
-
|
|
56
33
|
## Contributing
|
|
57
34
|
|
|
58
35
|
Read the [contributing guide](https://vaadin.com/docs/latest/contributing) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/form-layout",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.0-alpha2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -31,30 +31,27 @@
|
|
|
31
31
|
"Vaadin",
|
|
32
32
|
"form-layout",
|
|
33
33
|
"web-components",
|
|
34
|
-
"web-component"
|
|
35
|
-
"polymer"
|
|
34
|
+
"web-component"
|
|
36
35
|
],
|
|
37
36
|
"dependencies": {
|
|
38
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
39
|
-
"@
|
|
40
|
-
"@vaadin/
|
|
41
|
-
"@vaadin/
|
|
42
|
-
"@vaadin/vaadin-
|
|
43
|
-
"@vaadin/vaadin-material-styles": "24.8.0-alpha9",
|
|
44
|
-
"@vaadin/vaadin-themable-mixin": "24.8.0-alpha9",
|
|
38
|
+
"@vaadin/a11y-base": "25.0.0-alpha2",
|
|
39
|
+
"@vaadin/component-base": "25.0.0-alpha2",
|
|
40
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha2",
|
|
41
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha2",
|
|
45
42
|
"lit": "^3.0.0"
|
|
46
43
|
},
|
|
47
44
|
"devDependencies": {
|
|
48
|
-
"@vaadin/chai-plugins": "
|
|
49
|
-
"@vaadin/custom-field": "
|
|
50
|
-
"@vaadin/test-runner-commands": "
|
|
51
|
-
"@vaadin/testing-helpers": "^
|
|
52
|
-
"@vaadin/text-field": "
|
|
45
|
+
"@vaadin/chai-plugins": "25.0.0-alpha2",
|
|
46
|
+
"@vaadin/custom-field": "25.0.0-alpha2",
|
|
47
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha2",
|
|
48
|
+
"@vaadin/testing-helpers": "^2.0.0",
|
|
49
|
+
"@vaadin/text-field": "25.0.0-alpha2",
|
|
53
50
|
"sinon": "^18.0.0"
|
|
54
51
|
},
|
|
55
52
|
"web-types": [
|
|
56
53
|
"web-types.json",
|
|
57
54
|
"web-types.lit.json"
|
|
58
55
|
],
|
|
59
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "67ffcd5355cf21ce1b5039c598525109fc4c164b"
|
|
60
57
|
}
|
|
@@ -130,7 +130,8 @@ export class AutoResponsiveLayout extends AbstractLayout {
|
|
|
130
130
|
host.style.removeProperty('--_column-width');
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
host.style.setProperty('--
|
|
133
|
+
host.style.setProperty('--_min-columns', props.minColumns);
|
|
134
|
+
host.style.setProperty('--_max-columns', Math.min(Math.max(props.minColumns, props.maxColumns), maxColumns));
|
|
134
135
|
|
|
135
136
|
host.$.layout.toggleAttribute('fits-labels-aside', this.props.labelsAside && this.__fitsLabelsAside);
|
|
136
137
|
host.$.layout.style.setProperty('--_grid-rendered-column-count', this.__renderedColumnCount);
|
|
@@ -170,13 +171,13 @@ export class AutoResponsiveLayout extends AbstractLayout {
|
|
|
170
171
|
}
|
|
171
172
|
|
|
172
173
|
/** @private */
|
|
173
|
-
get
|
|
174
|
+
get __minWidthLabelsAside() {
|
|
174
175
|
const { backgroundPositionY } = getComputedStyle(this.host.$.layout, '::before');
|
|
175
176
|
return parseFloat(backgroundPositionY);
|
|
176
177
|
}
|
|
177
178
|
|
|
178
179
|
/** @private */
|
|
179
180
|
get __fitsLabelsAside() {
|
|
180
|
-
return this.host.offsetWidth >= this.
|
|
181
|
+
return this.host.offsetWidth >= this.__minWidthLabelsAside;
|
|
181
182
|
}
|
|
182
183
|
}
|
package/src/vaadin-form-item.js
CHANGED
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { html,
|
|
6
|
+
import { html, LitElement } from 'lit';
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
-
import {
|
|
8
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
9
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
10
|
import { FormItemMixin } from './vaadin-form-item-mixin.js';
|
|
10
11
|
import { formItemStyles } from './vaadin-form-layout-styles.js';
|
|
11
12
|
|
|
12
|
-
registerStyles('vaadin-form-item', formItemStyles, { moduleId: 'vaadin-form-item-styles' });
|
|
13
|
-
|
|
14
13
|
/**
|
|
15
14
|
* `<vaadin-form-item>` is a Web Component providing labelled form item wrapper
|
|
16
15
|
* for using inside `<vaadin-form-layout>`.
|
|
@@ -103,20 +102,25 @@ registerStyles('vaadin-form-item', formItemStyles, { moduleId: 'vaadin-form-item
|
|
|
103
102
|
* @mixes FormItemMixin
|
|
104
103
|
* @mixes ThemableMixin
|
|
105
104
|
*/
|
|
106
|
-
class FormItem extends FormItemMixin(ThemableMixin(
|
|
105
|
+
class FormItem extends FormItemMixin(ThemableMixin(PolylitMixin(LitElement))) {
|
|
107
106
|
static get is() {
|
|
108
107
|
return 'vaadin-form-item';
|
|
109
108
|
}
|
|
110
109
|
|
|
111
|
-
static get
|
|
110
|
+
static get styles() {
|
|
111
|
+
return formItemStyles;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** @protected */
|
|
115
|
+
render() {
|
|
112
116
|
return html`
|
|
113
|
-
<div id="label" part="label"
|
|
114
|
-
<slot name="label" id="labelSlot"
|
|
117
|
+
<div id="label" part="label" @click="${this.__onLabelClick}">
|
|
118
|
+
<slot name="label" id="labelSlot" @slotchange="${this.__onLabelSlotChange}"></slot>
|
|
115
119
|
<span part="required-indicator" aria-hidden="true"></span>
|
|
116
120
|
</div>
|
|
117
121
|
<div id="spacing"></div>
|
|
118
122
|
<div id="content">
|
|
119
|
-
<slot id="contentSlot"
|
|
123
|
+
<slot id="contentSlot" @slotchange="${this.__onContentSlotChange}"></slot>
|
|
120
124
|
</div>
|
|
121
125
|
`;
|
|
122
126
|
}
|
|
@@ -119,6 +119,17 @@ export declare class FormLayoutMixinClass {
|
|
|
119
119
|
*/
|
|
120
120
|
maxColumns: number;
|
|
121
121
|
|
|
122
|
+
/**
|
|
123
|
+
* When `autoResponsive` is enabled, defines the minimum number of columns
|
|
124
|
+
* that the layout can create. The layout will create columns at least up
|
|
125
|
+
* to this limit provided the container width allows it.
|
|
126
|
+
*
|
|
127
|
+
* The default value is `1`.
|
|
128
|
+
*
|
|
129
|
+
* @attr {number} min-columns
|
|
130
|
+
*/
|
|
131
|
+
minColumns: number;
|
|
132
|
+
|
|
122
133
|
/**
|
|
123
134
|
* When enabled with `autoResponsive`, distributes fields across columns
|
|
124
135
|
* by placing each field in the next available column and wrapping to
|
|
@@ -156,6 +156,21 @@ export const FormLayoutMixin = (superClass) =>
|
|
|
156
156
|
value: 10,
|
|
157
157
|
},
|
|
158
158
|
|
|
159
|
+
/**
|
|
160
|
+
* When `autoResponsive` is enabled, defines the minimum number of columns
|
|
161
|
+
* that the layout can create. The layout will create columns at least up
|
|
162
|
+
* to this limit.
|
|
163
|
+
*
|
|
164
|
+
* The default value is `1`.
|
|
165
|
+
*
|
|
166
|
+
* @attr {number} min-columns
|
|
167
|
+
*/
|
|
168
|
+
minColumns: {
|
|
169
|
+
type: Number,
|
|
170
|
+
sync: true,
|
|
171
|
+
value: 1,
|
|
172
|
+
},
|
|
173
|
+
|
|
159
174
|
/**
|
|
160
175
|
* When enabled with `autoResponsive`, distributes fields across columns
|
|
161
176
|
* by placing each field in the next available column and wrapping to
|
|
@@ -231,7 +246,7 @@ export const FormLayoutMixin = (superClass) =>
|
|
|
231
246
|
|
|
232
247
|
static get observers() {
|
|
233
248
|
return [
|
|
234
|
-
'__autoResponsiveLayoutPropsChanged(columnWidth, maxColumns, autoRows, labelsAside, expandColumns, expandFields)',
|
|
249
|
+
'__autoResponsiveLayoutPropsChanged(columnWidth, maxColumns, minColumns, autoRows, labelsAside, expandColumns, expandFields)',
|
|
235
250
|
'__autoResponsiveChanged(autoResponsive)',
|
|
236
251
|
];
|
|
237
252
|
}
|
|
@@ -289,10 +304,19 @@ export const FormLayoutMixin = (superClass) =>
|
|
|
289
304
|
|
|
290
305
|
/** @private */
|
|
291
306
|
// eslint-disable-next-line @typescript-eslint/max-params
|
|
292
|
-
__autoResponsiveLayoutPropsChanged(
|
|
307
|
+
__autoResponsiveLayoutPropsChanged(
|
|
308
|
+
columnWidth,
|
|
309
|
+
maxColumns,
|
|
310
|
+
minColumns,
|
|
311
|
+
autoRows,
|
|
312
|
+
labelsAside,
|
|
313
|
+
expandColumns,
|
|
314
|
+
expandFields,
|
|
315
|
+
) {
|
|
293
316
|
this.__autoResponsiveLayout.setProps({
|
|
294
317
|
columnWidth,
|
|
295
318
|
maxColumns,
|
|
319
|
+
minColumns,
|
|
296
320
|
autoRows,
|
|
297
321
|
labelsAside,
|
|
298
322
|
expandColumns,
|
|
@@ -45,14 +45,29 @@ export const formLayoutStyles = css`
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
:host([auto-responsive]) {
|
|
48
|
+
/* Column width */
|
|
48
49
|
--_column-width: var(--vaadin-field-default-width, 12em);
|
|
49
50
|
--_column-width-labels-above: var(--_column-width);
|
|
50
51
|
--_column-width-labels-aside: calc(
|
|
51
52
|
var(--_column-width) + var(--vaadin-form-layout-label-width) + var(--vaadin-form-layout-label-spacing)
|
|
52
53
|
);
|
|
53
54
|
|
|
55
|
+
/* Column gap */
|
|
56
|
+
--_min-total-gap: calc((var(--_min-columns) - 1) * var(--vaadin-form-layout-column-spacing));
|
|
57
|
+
--_max-total-gap: calc((var(--_max-columns) - 1) * var(--vaadin-form-layout-column-spacing));
|
|
58
|
+
|
|
59
|
+
/* Minimum form layout width */
|
|
60
|
+
--_min-width-labels-above: calc(var(--_min-columns) * var(--_column-width-labels-above) + var(--_min-total-gap));
|
|
61
|
+
--_min-width-labels-aside: calc(var(--_min-columns) * var(--_column-width-labels-aside) + var(--_min-total-gap));
|
|
62
|
+
--_min-width: var(--_min-width-labels-above);
|
|
63
|
+
|
|
64
|
+
/* Maximum form layout width */
|
|
65
|
+
--_max-width-labels-above: calc(var(--_max-columns) * var(--_column-width-labels-above) + var(--_max-total-gap));
|
|
66
|
+
--_max-width-labels-aside: calc(var(--_max-columns) * var(--_column-width-labels-aside) + var(--_max-total-gap));
|
|
67
|
+
--_max-width: var(--_max-width-labels-above);
|
|
68
|
+
|
|
54
69
|
display: flex;
|
|
55
|
-
min-width: var(--
|
|
70
|
+
min-width: var(--_min-width);
|
|
56
71
|
}
|
|
57
72
|
|
|
58
73
|
:host([auto-responsive]) #layout {
|
|
@@ -61,10 +76,7 @@ export const formLayoutStyles = css`
|
|
|
61
76
|
--_form-item-labels-aside: ' '; /* false */
|
|
62
77
|
|
|
63
78
|
/* CSS grid related properties */
|
|
64
|
-
--_grid-column-gap: var(--vaadin-form-layout-column-spacing);
|
|
65
79
|
--_grid-column-width: var(--_column-width-labels-above);
|
|
66
|
-
--_grid-column-max-total-gap: calc((var(--_max-columns) - 1) * var(--_grid-column-gap));
|
|
67
|
-
--_grid-column-max-total-width: calc(var(--_max-columns) * var(--_column-width-labels-above));
|
|
68
80
|
--_grid-repeat: var(--_grid-column-width);
|
|
69
81
|
|
|
70
82
|
display: grid;
|
|
@@ -78,7 +90,7 @@ export const formLayoutStyles = css`
|
|
|
78
90
|
grid-auto-columns: 0;
|
|
79
91
|
|
|
80
92
|
justify-items: start;
|
|
81
|
-
gap: var(--vaadin-form-layout-row-spacing) var(--
|
|
93
|
+
gap: var(--vaadin-form-layout-row-spacing) var(--vaadin-form-layout-column-spacing);
|
|
82
94
|
|
|
83
95
|
/*
|
|
84
96
|
To prevent the layout from exceeding the column limit defined by --_max-columns,
|
|
@@ -92,17 +104,17 @@ export const formLayoutStyles = css`
|
|
|
92
104
|
number of columns inside <vaadin-overlay>, which creates a new stacking context
|
|
93
105
|
without a predefined width.
|
|
94
106
|
*/
|
|
95
|
-
width:
|
|
107
|
+
width: var(--_max-width);
|
|
96
108
|
|
|
97
109
|
/*
|
|
98
110
|
Firefox requires min-width on both :host and #layout to allow the layout
|
|
99
111
|
to shrink below the value specified in the CSS width property above.
|
|
100
112
|
*/
|
|
101
|
-
min-width:
|
|
113
|
+
min-width: var(--_min-width);
|
|
102
114
|
}
|
|
103
115
|
|
|
104
116
|
:host([auto-responsive]) #layout::before {
|
|
105
|
-
background-position-y: var(--
|
|
117
|
+
background-position-y: var(--_min-width-labels-aside);
|
|
106
118
|
}
|
|
107
119
|
|
|
108
120
|
:host([auto-responsive]) #layout ::slotted(*) {
|
|
@@ -118,8 +130,8 @@ export const formLayoutStyles = css`
|
|
|
118
130
|
grid-column-start: var(--_grid-colstart, auto);
|
|
119
131
|
}
|
|
120
132
|
|
|
121
|
-
:host([auto-responsive][labels-aside])
|
|
122
|
-
--
|
|
133
|
+
:host([auto-responsive][labels-aside]) {
|
|
134
|
+
--_max-width: var(--_max-width-labels-aside);
|
|
123
135
|
}
|
|
124
136
|
|
|
125
137
|
:host([auto-responsive][labels-aside]) #layout[fits-labels-aside] {
|
|
@@ -138,7 +150,7 @@ export const formLayoutStyles = css`
|
|
|
138
150
|
reached yet.
|
|
139
151
|
*/
|
|
140
152
|
--_grid-repeat: minmax(
|
|
141
|
-
max(var(--_grid-column-width), calc((100% - var(--
|
|
153
|
+
max(var(--_grid-column-width), calc((100% - var(--_max-total-gap)) / var(--_max-columns))),
|
|
142
154
|
1fr
|
|
143
155
|
);
|
|
144
156
|
|
|
@@ -3,15 +3,14 @@
|
|
|
3
3
|
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { html,
|
|
6
|
+
import { html, LitElement } from 'lit';
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
8
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
9
|
-
import {
|
|
9
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
10
11
|
import { FormLayoutMixin } from './vaadin-form-layout-mixin.js';
|
|
11
12
|
import { formLayoutStyles } from './vaadin-form-layout-styles.js';
|
|
12
13
|
|
|
13
|
-
registerStyles('vaadin-form-layout', formLayoutStyles, { moduleId: 'vaadin-form-layout-styles' });
|
|
14
|
-
|
|
15
14
|
/**
|
|
16
15
|
* `<vaadin-form-layout>` is a Web Component providing configurable responsive
|
|
17
16
|
* layout for form elements.
|
|
@@ -206,12 +205,17 @@ registerStyles('vaadin-form-layout', formLayoutStyles, { moduleId: 'vaadin-form-
|
|
|
206
205
|
* @mixes ElementMixin
|
|
207
206
|
* @mixes ThemableMixin
|
|
208
207
|
*/
|
|
209
|
-
class FormLayout extends FormLayoutMixin(ThemableMixin(ElementMixin(
|
|
208
|
+
class FormLayout extends FormLayoutMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement)))) {
|
|
210
209
|
static get is() {
|
|
211
210
|
return 'vaadin-form-layout';
|
|
212
211
|
}
|
|
213
212
|
|
|
214
|
-
static get
|
|
213
|
+
static get styles() {
|
|
214
|
+
return formLayoutStyles;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** @protected */
|
|
218
|
+
render() {
|
|
215
219
|
return html`
|
|
216
220
|
<div id="layout">
|
|
217
221
|
<slot id="slot"></slot>
|
package/src/vaadin-form-row.js
CHANGED
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { html,
|
|
6
|
+
import { html, LitElement } from 'lit';
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
-
import {
|
|
8
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
9
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
10
|
import { formRowStyles } from './vaadin-form-layout-styles.js';
|
|
10
11
|
|
|
11
|
-
registerStyles('vaadin-form-row', formRowStyles, { moduleId: 'vaadin-form-row-styles' });
|
|
12
|
-
|
|
13
12
|
/**
|
|
14
13
|
* `<vaadin-form-row>` is a web component for arranging fields into rows
|
|
15
14
|
* inside a `<vaadin-form-layout>` that is set to autoResponsive mode.
|
|
@@ -22,12 +21,17 @@ registerStyles('vaadin-form-row', formRowStyles, { moduleId: 'vaadin-form-row-st
|
|
|
22
21
|
* @extends HTMLElement
|
|
23
22
|
* @mixes ThemableMixin
|
|
24
23
|
*/
|
|
25
|
-
class FormRow extends ThemableMixin(
|
|
24
|
+
class FormRow extends ThemableMixin(PolylitMixin(LitElement)) {
|
|
26
25
|
static get is() {
|
|
27
26
|
return 'vaadin-form-row';
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
static get
|
|
29
|
+
static get styles() {
|
|
30
|
+
return formRowStyles;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** @protected */
|
|
34
|
+
render() {
|
|
31
35
|
return html`<slot></slot>`;
|
|
32
36
|
}
|
|
33
37
|
}
|
package/web-types.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": "
|
|
4
|
+
"version": "25.0.0-alpha2",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -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### Auto Responsive Mode\n\nTo avoid manually dealing with responsive breakpoints, Form Layout provides an auto-responsive mode\nthat automatically creates and adjusts fixed-width columns based on the container's available space.\n\nThe [`columnWidth`](https://cdn.vaadin.com/vaadin-web-components/
|
|
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### Auto Responsive Mode\n\nTo avoid manually dealing with responsive breakpoints, Form Layout provides an auto-responsive mode\nthat automatically creates and adjusts fixed-width columns based on the container's available space.\n\nThe [`columnWidth`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-form-layout#property-columnWidth) and\n[`maxColumns`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-form-layout#property-maxColumns) properties define the width of\neach column and the maximum number of columns that the component can create. By default, the component\ncreates up to 10 columns, each with a width of `12em` or the value of the `--vaadin-field-default-width`\nCSS custom property, if defined.\n\nThe auto-responsive mode is disabled by default. To enable it for an individual instance, set the\n`auto-responsive` attribute:\n\n```html\n<vaadin-form-layout auto-responsive>\n <vaadin-text-field label=\"First Name\"></vaadin-text-field>\n <vaadin-text-field label=\"Last Name\"></vaadin-text-field>\n <vaadin-text-area label=\"Address\" colspan=\"2\"></vaadin-text-area>\n</vaadin-form-layout>\n```\n\nYou can also enable it for all instances by enabling the following feature flag\nbefore `<vaadin-form-layout>` elements are added to the DOM:\n\n```js\nwindow.Vaadin.featureFlags.defaultAutoResponsiveFormLayout = true;\n```\n\n#### Organizing Fields into Rows\n\nBy default, each field is placed on a new row. To organize fields into rows, you can either:\n\n1. Manually wrap fields into [`<vaadin-form-row>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-form-row) elements.\n\n2. Enable the [`autoRows`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-form-layout#property-autoRows) property to\n let Form Layout automatically arrange fields in available columns, wrapping to a new\n row when necessary. `<br>` elements can be used to force a new row.\n\nHere is an example of using `<vaadin-form-row>`:\n\n```html\n<vaadin-form-layout auto-responsive>\n <vaadin-form-row>\n <vaadin-text-field label=\"First Name\"></vaadin-text-field>\n <vaadin-text-field label=\"Last Name\"></vaadin-text-field>\n </vaadin-form-row>\n <vaadin-form-row>\n <vaadin-text-area label=\"Address\" colspan=\"2\"></vaadin-text-area>\n </vaadin-form-row>\n</vaadin-form-layout>\n```\n\n#### Expanding Columns and Fields\n\nYou can configure Form Layout to expand columns to evenly fill any remaining space after\nall fixed-width columns have been created.\nTo enable this, set the [`expandColumns`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-form-layout#property-expandColumns)\nproperty to `true`.\n\nAlso, Form Layout can stretch fields to make them take up all available space within columns.\nTo enable this, set the [`expandFields`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-form-layout#property-expandFields)\nproperty to `true`.\n\n#### Customizing Label Position\n\nBy default, Form Layout displays labels above the fields. To position labels beside fields, you\nneed to wrap each field in a `<vaadin-form-item>` element and define its labels on the wrapper.\nThen, you can enable the [`labelsAside`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-form-layout#property-labelsAside)\nproperty:\n\n```html\n<vaadin-form-layout auto-responsive labels-aside>\n <vaadin-form-row>\n <vaadin-form-item>\n <label slot=\"label\">First Name</label>\n <vaadin-text-field></vaadin-text-field>\n </vaadin-form-item>\n <vaadin-form-item>\n <label slot=\"label\">Last Name</label>\n <vaadin-text-field></vaadin-text-field>\n </vaadin-form-item>\n </vaadin-form-row>\n <vaadin-form-row>\n <vaadin-form-item colspan=\"2\">\n <label slot=\"label\">Address</label>\n <vaadin-text-area></vaadin-text-area>\n </vaadin-form-item>\n </vaadin-form-row>\n</vaadin-form-layout>\n```\n\nWith this, FormLayout will display labels beside fields, falling back to\nthe default position above the fields only when there isn't enough space.\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": "auto-responsive",
|
|
@@ -64,6 +64,17 @@
|
|
|
64
64
|
]
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
|
+
{
|
|
68
|
+
"name": "min-columns",
|
|
69
|
+
"description": "When `autoResponsive` is enabled, defines the minimum number of columns\nthat the layout can create. The layout will create columns at least up\nto this limit.\n\nThe default value is `1`.",
|
|
70
|
+
"value": {
|
|
71
|
+
"type": [
|
|
72
|
+
"number",
|
|
73
|
+
"null",
|
|
74
|
+
"undefined"
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
},
|
|
67
78
|
{
|
|
68
79
|
"name": "auto-rows",
|
|
69
80
|
"description": "When enabled with `autoResponsive`, distributes fields across columns\nby placing each field in the next available column and wrapping to\nthe next row when the current row is full. `<br>` elements can be\nused to force a new row.\n\nThe default value is `false`.",
|
|
@@ -164,6 +175,17 @@
|
|
|
164
175
|
]
|
|
165
176
|
}
|
|
166
177
|
},
|
|
178
|
+
{
|
|
179
|
+
"name": "minColumns",
|
|
180
|
+
"description": "When `autoResponsive` is enabled, defines the minimum number of columns\nthat the layout can create. The layout will create columns at least up\nto this limit.\n\nThe default value is `1`.",
|
|
181
|
+
"value": {
|
|
182
|
+
"type": [
|
|
183
|
+
"number",
|
|
184
|
+
"null",
|
|
185
|
+
"undefined"
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
},
|
|
167
189
|
{
|
|
168
190
|
"name": "autoRows",
|
|
169
191
|
"description": "When enabled with `autoResponsive`, distributes fields across columns\nby placing each field in the next available column and wrapping to\nthe next row when the current row is full. `<br>` elements can be\nused to force a new row.\n\nThe default value is `false`.",
|
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": "
|
|
4
|
+
"version": "25.0.0-alpha2",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -22,7 +22,7 @@
|
|
|
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### Auto Responsive Mode\n\nTo avoid manually dealing with responsive breakpoints, Form Layout provides an auto-responsive mode\nthat automatically creates and adjusts fixed-width columns based on the container's available space.\n\nThe [`columnWidth`](https://cdn.vaadin.com/vaadin-web-components/
|
|
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### Auto Responsive Mode\n\nTo avoid manually dealing with responsive breakpoints, Form Layout provides an auto-responsive mode\nthat automatically creates and adjusts fixed-width columns based on the container's available space.\n\nThe [`columnWidth`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-form-layout#property-columnWidth) and\n[`maxColumns`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-form-layout#property-maxColumns) properties define the width of\neach column and the maximum number of columns that the component can create. By default, the component\ncreates up to 10 columns, each with a width of `12em` or the value of the `--vaadin-field-default-width`\nCSS custom property, if defined.\n\nThe auto-responsive mode is disabled by default. To enable it for an individual instance, set the\n`auto-responsive` attribute:\n\n```html\n<vaadin-form-layout auto-responsive>\n <vaadin-text-field label=\"First Name\"></vaadin-text-field>\n <vaadin-text-field label=\"Last Name\"></vaadin-text-field>\n <vaadin-text-area label=\"Address\" colspan=\"2\"></vaadin-text-area>\n</vaadin-form-layout>\n```\n\nYou can also enable it for all instances by enabling the following feature flag\nbefore `<vaadin-form-layout>` elements are added to the DOM:\n\n```js\nwindow.Vaadin.featureFlags.defaultAutoResponsiveFormLayout = true;\n```\n\n#### Organizing Fields into Rows\n\nBy default, each field is placed on a new row. To organize fields into rows, you can either:\n\n1. Manually wrap fields into [`<vaadin-form-row>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-form-row) elements.\n\n2. Enable the [`autoRows`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-form-layout#property-autoRows) property to\n let Form Layout automatically arrange fields in available columns, wrapping to a new\n row when necessary. `<br>` elements can be used to force a new row.\n\nHere is an example of using `<vaadin-form-row>`:\n\n```html\n<vaadin-form-layout auto-responsive>\n <vaadin-form-row>\n <vaadin-text-field label=\"First Name\"></vaadin-text-field>\n <vaadin-text-field label=\"Last Name\"></vaadin-text-field>\n </vaadin-form-row>\n <vaadin-form-row>\n <vaadin-text-area label=\"Address\" colspan=\"2\"></vaadin-text-area>\n </vaadin-form-row>\n</vaadin-form-layout>\n```\n\n#### Expanding Columns and Fields\n\nYou can configure Form Layout to expand columns to evenly fill any remaining space after\nall fixed-width columns have been created.\nTo enable this, set the [`expandColumns`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-form-layout#property-expandColumns)\nproperty to `true`.\n\nAlso, Form Layout can stretch fields to make them take up all available space within columns.\nTo enable this, set the [`expandFields`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-form-layout#property-expandFields)\nproperty to `true`.\n\n#### Customizing Label Position\n\nBy default, Form Layout displays labels above the fields. To position labels beside fields, you\nneed to wrap each field in a `<vaadin-form-item>` element and define its labels on the wrapper.\nThen, you can enable the [`labelsAside`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-form-layout#property-labelsAside)\nproperty:\n\n```html\n<vaadin-form-layout auto-responsive labels-aside>\n <vaadin-form-row>\n <vaadin-form-item>\n <label slot=\"label\">First Name</label>\n <vaadin-text-field></vaadin-text-field>\n </vaadin-form-item>\n <vaadin-form-item>\n <label slot=\"label\">Last Name</label>\n <vaadin-text-field></vaadin-text-field>\n </vaadin-form-item>\n </vaadin-form-row>\n <vaadin-form-row>\n <vaadin-form-item colspan=\"2\">\n <label slot=\"label\">Address</label>\n <vaadin-text-area></vaadin-text-area>\n </vaadin-form-item>\n </vaadin-form-row>\n</vaadin-form-layout>\n```\n\nWith this, FormLayout will display labels beside fields, falling back to\nthe default position above the fields only when there isn't enough space.\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
|
{
|
|
@@ -80,6 +80,13 @@
|
|
|
80
80
|
"value": {
|
|
81
81
|
"kind": "expression"
|
|
82
82
|
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"name": ".minColumns",
|
|
86
|
+
"description": "When `autoResponsive` is enabled, defines the minimum number of columns\nthat the layout can create. The layout will create columns at least up\nto this limit.\n\nThe default value is `1`.",
|
|
87
|
+
"value": {
|
|
88
|
+
"kind": "expression"
|
|
89
|
+
}
|
|
83
90
|
}
|
|
84
91
|
]
|
|
85
92
|
},
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import { html, LitElement } from 'lit';
|
|
7
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
9
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
10
|
-
import { FormItemMixin } from './vaadin-form-item-mixin.js';
|
|
11
|
-
import { formItemStyles } from './vaadin-form-layout-styles.js';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* LitElement based version of `<vaadin-form-item>` web component.
|
|
15
|
-
*
|
|
16
|
-
* ## Disclaimer
|
|
17
|
-
*
|
|
18
|
-
* This component is an experiment and not yet a part of Vaadin platform.
|
|
19
|
-
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
20
|
-
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
21
|
-
*/
|
|
22
|
-
class FormItem extends FormItemMixin(ThemableMixin(PolylitMixin(LitElement))) {
|
|
23
|
-
static get is() {
|
|
24
|
-
return 'vaadin-form-item';
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
static get styles() {
|
|
28
|
-
return formItemStyles;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** @protected */
|
|
32
|
-
render() {
|
|
33
|
-
return html`
|
|
34
|
-
<div id="label" part="label" @click="${this.__onLabelClick}">
|
|
35
|
-
<slot name="label" id="labelSlot" @slotchange="${this.__onLabelSlotChange}"></slot>
|
|
36
|
-
<span part="required-indicator" aria-hidden="true"></span>
|
|
37
|
-
</div>
|
|
38
|
-
<div id="spacing"></div>
|
|
39
|
-
<div id="content">
|
|
40
|
-
<slot id="contentSlot" @slotchange="${this.__onContentSlotChange}"></slot>
|
|
41
|
-
</div>
|
|
42
|
-
`;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
defineCustomElement(FormItem);
|
|
47
|
-
|
|
48
|
-
export { FormItem };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import { html, LitElement } from 'lit';
|
|
7
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
-
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
9
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
|
-
import { FormLayoutMixin } from './vaadin-form-layout-mixin.js';
|
|
12
|
-
import { formLayoutStyles } from './vaadin-form-layout-styles.js';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* LitElement based version of `<vaadin-form-layout>` web component.
|
|
16
|
-
*
|
|
17
|
-
* ## Disclaimer
|
|
18
|
-
*
|
|
19
|
-
* This component is an experiment and not yet a part of Vaadin platform.
|
|
20
|
-
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
21
|
-
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
22
|
-
*/
|
|
23
|
-
class FormLayout extends FormLayoutMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement)))) {
|
|
24
|
-
static get is() {
|
|
25
|
-
return 'vaadin-form-layout';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static get styles() {
|
|
29
|
-
return formLayoutStyles;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/** @protected */
|
|
33
|
-
render() {
|
|
34
|
-
return html`
|
|
35
|
-
<div id="layout">
|
|
36
|
-
<slot id="slot"></slot>
|
|
37
|
-
</div>
|
|
38
|
-
`;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
defineCustomElement(FormLayout);
|
|
43
|
-
|
|
44
|
-
export { FormLayout };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import { html, LitElement } from 'lit';
|
|
7
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
9
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
10
|
-
import { formRowStyles } from './vaadin-form-layout-styles.js';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* LitElement based version of `<vaadin-form-row>` web component.
|
|
14
|
-
*
|
|
15
|
-
* ## Disclaimer
|
|
16
|
-
*
|
|
17
|
-
* This component is an experiment and not yet a part of Vaadin platform.
|
|
18
|
-
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
19
|
-
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
20
|
-
*/
|
|
21
|
-
class FormRow extends ThemableMixin(PolylitMixin(LitElement)) {
|
|
22
|
-
static get is() {
|
|
23
|
-
return 'vaadin-form-row';
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
static get styles() {
|
|
27
|
-
return formRowStyles;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/** @protected */
|
|
31
|
-
render() {
|
|
32
|
-
return html`<slot></slot>`;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
defineCustomElement(FormRow);
|
|
37
|
-
|
|
38
|
-
export { FormRow };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../src/vaadin-lit-form-row.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../src/vaadin-lit-form-row.js';
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-material-styles/color.js';
|
|
2
|
-
import '@vaadin/vaadin-material-styles/typography.js';
|
|
3
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
4
|
-
|
|
5
|
-
registerStyles(
|
|
6
|
-
'vaadin-form-item',
|
|
7
|
-
css`
|
|
8
|
-
[part='label'] {
|
|
9
|
-
font-family: var(--material-font-family);
|
|
10
|
-
font-size: var(--material-small-font-size);
|
|
11
|
-
color: var(--material-secondary-text-color);
|
|
12
|
-
line-height: 16px;
|
|
13
|
-
font-weight: 400;
|
|
14
|
-
margin-top: 16px;
|
|
15
|
-
margin-bottom: 8px;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
:host([required]) [part='required-indicator']::after {
|
|
19
|
-
content: ' *';
|
|
20
|
-
color: inherit;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
:host([invalid]) [part='label'] {
|
|
24
|
-
color: var(--material-error-text-color);
|
|
25
|
-
}
|
|
26
|
-
`,
|
|
27
|
-
{ moduleId: 'material-form-item' },
|
|
28
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../src/vaadin-form-layout.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../src/vaadin-form-layout.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../src/vaadin-form-row.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../src/vaadin-form-row.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../src/vaadin-lit-form-layout.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../src/vaadin-lit-form-layout.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../src/vaadin-lit-form-row.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../src/vaadin-lit-form-row.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './vaadin-form-item.js';
|
package/vaadin-lit-form-item.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './vaadin-form-layout.js';
|
package/vaadin-lit-form-row.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './vaadin-form-row.js';
|
package/vaadin-lit-form-row.js
DELETED