@vaadin/field-base 25.0.0-beta4 → 25.0.0-beta5
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 +6 -6
- package/src/styles/button-base-styles.js +3 -0
- package/src/styles/checkable-base-styles.js +30 -17
- package/src/styles/field-base-styles.js +94 -13
- package/src/styles/group-base-styles.d.ts +1 -1
- package/src/styles/group-base-styles.js +14 -13
- package/src/styles/input-field-shared-styles.js +1 -2
- package/src/styles/container-base-styles.d.ts +0 -8
- package/src/styles/container-base-styles.js +0 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/field-base",
|
|
3
|
-
"version": "25.0.0-
|
|
3
|
+
"version": "25.0.0-beta5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -31,15 +31,15 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
34
|
-
"@vaadin/a11y-base": "25.0.0-
|
|
35
|
-
"@vaadin/component-base": "25.0.0-
|
|
34
|
+
"@vaadin/a11y-base": "25.0.0-beta5",
|
|
35
|
+
"@vaadin/component-base": "25.0.0-beta5",
|
|
36
36
|
"lit": "^3.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@vaadin/chai-plugins": "25.0.0-
|
|
40
|
-
"@vaadin/test-runner-commands": "25.0.0-
|
|
39
|
+
"@vaadin/chai-plugins": "25.0.0-beta5",
|
|
40
|
+
"@vaadin/test-runner-commands": "25.0.0-beta5",
|
|
41
41
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
42
42
|
"sinon": "^21.0.0"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "ba59e1404cc4bef2dd685476247f758eb28c9922"
|
|
45
45
|
}
|
|
@@ -14,6 +14,9 @@ export const button = css`
|
|
|
14
14
|
-webkit-tap-highlight-color: transparent;
|
|
15
15
|
-webkit-user-select: none;
|
|
16
16
|
user-select: none;
|
|
17
|
+
/* Ensure minimum click target (WCAG) */
|
|
18
|
+
padding: max(0px, (24px - 1lh) / 2);
|
|
19
|
+
margin: min(0px, (24px - 1lh) / -2);
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
/* Icon */
|
|
@@ -9,9 +9,8 @@ import { css, unsafeCSS } from 'lit';
|
|
|
9
9
|
// postcss-lit-disable-next-line
|
|
10
10
|
export const checkable = (part, propName = part) => css`
|
|
11
11
|
:host {
|
|
12
|
-
align-items:
|
|
13
|
-
|
|
14
|
-
gap: var(--vaadin-${unsafeCSS(propName)}-gap, var(--vaadin-gap-xs) var(--vaadin-gap-s));
|
|
12
|
+
align-items: baseline;
|
|
13
|
+
column-gap: var(--vaadin-${unsafeCSS(propName)}-gap, var(--vaadin-gap-s));
|
|
15
14
|
grid-template-columns: auto 1fr;
|
|
16
15
|
/*
|
|
17
16
|
Using minmax(auto, max-content) works around a Safari 17 issue where placing a checkbox
|
|
@@ -31,10 +30,6 @@ export const checkable = (part, propName = part) => css`
|
|
|
31
30
|
column-gap: 0;
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
.vaadin-${unsafeCSS(propName)}-container {
|
|
35
|
-
display: contents;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
33
|
[part='${unsafeCSS(part)}'],
|
|
39
34
|
::slotted(input),
|
|
40
35
|
[part='label'],
|
|
@@ -58,17 +53,26 @@ export const checkable = (part, propName = part) => css`
|
|
|
58
53
|
grid-column: 1;
|
|
59
54
|
}
|
|
60
55
|
|
|
56
|
+
[part='label'],
|
|
61
57
|
[part='helper-text'],
|
|
62
58
|
[part='error-message'] {
|
|
59
|
+
margin-bottom: 0;
|
|
63
60
|
grid-column: 2;
|
|
61
|
+
width: auto;
|
|
62
|
+
min-width: auto;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
[part='helper-text'],
|
|
66
|
+
[part='error-message'] {
|
|
67
|
+
margin-top: var(--_gap-s);
|
|
64
68
|
}
|
|
65
69
|
|
|
66
70
|
/* Baseline vertical alignment */
|
|
67
71
|
:host::before {
|
|
68
|
-
content: '\\2003';
|
|
69
|
-
grid-column: 1;
|
|
70
72
|
grid-row: 1;
|
|
71
|
-
|
|
73
|
+
margin: 0;
|
|
74
|
+
padding: 0;
|
|
75
|
+
border: 0;
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
/* visually hidden */
|
|
@@ -77,9 +81,12 @@ export const checkable = (part, propName = part) => css`
|
|
|
77
81
|
margin: 0;
|
|
78
82
|
align-self: stretch;
|
|
79
83
|
appearance: none;
|
|
80
|
-
width: 100%;
|
|
81
|
-
height: 100%;
|
|
82
84
|
cursor: var(--_cursor);
|
|
85
|
+
/* Ensure minimum click target (WCAG) */
|
|
86
|
+
width: 2px;
|
|
87
|
+
height: 2px;
|
|
88
|
+
scale: 12;
|
|
89
|
+
margin: auto;
|
|
83
90
|
}
|
|
84
91
|
|
|
85
92
|
/* Control container (checkbox, radio button) */
|
|
@@ -91,17 +98,20 @@ export const checkable = (part, propName = part) => css`
|
|
|
91
98
|
--_border-width: var(--vaadin-${unsafeCSS(propName)}-border-width, var(--vaadin-input-field-border-width, 1px));
|
|
92
99
|
border-width: var(--_border-width);
|
|
93
100
|
box-sizing: border-box;
|
|
94
|
-
|
|
101
|
+
--_color: var(--vaadin-${unsafeCSS(propName)}-marker-color, var(--vaadin-${unsafeCSS(propName)}-background, var(--vaadin-background-color)));
|
|
102
|
+
color: var(--_color);
|
|
95
103
|
height: var(--vaadin-${unsafeCSS(propName)}-size, 1lh);
|
|
96
104
|
width: var(--vaadin-${unsafeCSS(propName)}-size, 1lh);
|
|
97
105
|
position: relative;
|
|
98
106
|
cursor: var(--_cursor);
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: center;
|
|
99
110
|
}
|
|
100
111
|
|
|
101
112
|
:host(:is([checked], [indeterminate])) {
|
|
102
113
|
--vaadin-${unsafeCSS(propName)}-background: var(--vaadin-text-color);
|
|
103
114
|
--vaadin-${unsafeCSS(propName)}-border-color: transparent;
|
|
104
|
-
--vaadin-${unsafeCSS(propName)}-marker-color: oklch(from var(--vaadin-${unsafeCSS(propName)}-background) clamp(0, (0.62 - l) * 1000, 1) 0 0);
|
|
105
115
|
}
|
|
106
116
|
|
|
107
117
|
:host([disabled]) {
|
|
@@ -128,14 +138,17 @@ export const checkable = (part, propName = part) => css`
|
|
|
128
138
|
|
|
129
139
|
/* Checked indicator (checkmark, dot) */
|
|
130
140
|
[part='${unsafeCSS(part)}']::after {
|
|
131
|
-
content: '';
|
|
132
|
-
position: absolute;
|
|
141
|
+
content: '\\2003' / '';
|
|
133
142
|
background: currentColor;
|
|
134
143
|
border-radius: inherit;
|
|
144
|
+
display: flex;
|
|
145
|
+
align-items: center;
|
|
146
|
+
--_filter: var(--vaadin-${unsafeCSS(propName)}-marker-color, saturate(0) invert(1) hue-rotate(180deg) contrast(100) brightness(100));
|
|
147
|
+
filter: var(--_filter);
|
|
135
148
|
}
|
|
136
149
|
|
|
137
150
|
:host(:not([checked], [indeterminate])) [part='${unsafeCSS(part)}']::after {
|
|
138
|
-
|
|
151
|
+
opacity: 0;
|
|
139
152
|
}
|
|
140
153
|
|
|
141
154
|
@media (forced-colors: active) {
|
|
@@ -8,21 +8,45 @@ import { css } from 'lit';
|
|
|
8
8
|
|
|
9
9
|
export const field = css`
|
|
10
10
|
:host {
|
|
11
|
-
|
|
11
|
+
--_helper-below-field: initial;
|
|
12
|
+
--_helper-above-field: ;
|
|
13
|
+
--_no-label: initial;
|
|
14
|
+
--_has-label: ;
|
|
15
|
+
--_no-helper: initial;
|
|
16
|
+
--_has-helper: ;
|
|
17
|
+
--_no-error: initial;
|
|
18
|
+
--_has-error: ;
|
|
19
|
+
--_gap: var(--vaadin-input-field-container-gap, var(--vaadin-gap-xs));
|
|
20
|
+
--_gap-s: round(var(--_gap) / 3, 2px);
|
|
21
|
+
display: inline-grid;
|
|
22
|
+
grid-template:
|
|
23
|
+
'label' auto var(--_helper-above-field, 'helper' auto) 'baseline' 0 'input' 1fr var(
|
|
24
|
+
--_helper-below-field,
|
|
25
|
+
'helper' auto
|
|
26
|
+
)
|
|
27
|
+
'error' auto / 100%;
|
|
12
28
|
outline: none;
|
|
13
29
|
cursor: default;
|
|
14
30
|
-webkit-tap-highlight-color: transparent;
|
|
15
31
|
}
|
|
16
32
|
|
|
17
|
-
:host([
|
|
18
|
-
|
|
33
|
+
:host([has-label]) {
|
|
34
|
+
--_has-label: initial;
|
|
35
|
+
--_no-label: ;
|
|
19
36
|
}
|
|
20
37
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
38
|
+
:host([has-helper]) {
|
|
39
|
+
--_has-helper: initial;
|
|
40
|
+
--_no-helper: ;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:host([has-error-message]) {
|
|
44
|
+
--_has-error: initial;
|
|
45
|
+
--_no-error: ;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
:host([hidden]) {
|
|
49
|
+
display: none !important;
|
|
26
50
|
}
|
|
27
51
|
|
|
28
52
|
:host(:not([has-label])) [part='label'],
|
|
@@ -31,14 +55,50 @@ export const field = css`
|
|
|
31
55
|
display: none;
|
|
32
56
|
}
|
|
33
57
|
|
|
58
|
+
/* Baseline alignment guide */
|
|
59
|
+
:host::before {
|
|
60
|
+
content: '\\2003' / '';
|
|
61
|
+
grid-column: 1;
|
|
62
|
+
grid-row: var(--_has-label, label / baseline) var(--_no-label, label / input);
|
|
63
|
+
align-self: var(--_has-label, end) var(--_no-label, start);
|
|
64
|
+
font-size: var(--vaadin-input-field-value-font-size, inherit);
|
|
65
|
+
line-height: var(--vaadin-input-field-value-line-height, inherit);
|
|
66
|
+
padding: var(
|
|
67
|
+
--vaadin-input-field-padding,
|
|
68
|
+
var(--vaadin-padding-block-container) var(--vaadin-padding-inline-container)
|
|
69
|
+
);
|
|
70
|
+
border: var(--vaadin-input-field-border-width, 1px) solid transparent;
|
|
71
|
+
pointer-events: none;
|
|
72
|
+
margin-bottom: var(--_no-label, 0)
|
|
73
|
+
var(
|
|
74
|
+
--_has-label,
|
|
75
|
+
calc(
|
|
76
|
+
var(
|
|
77
|
+
--vaadin-field-baseline-input-height,
|
|
78
|
+
(1lh + var(--vaadin-padding-xs) * 2 + var(--vaadin-input-field-border-width, 1px) * 2)
|
|
79
|
+
) *
|
|
80
|
+
-1
|
|
81
|
+
)
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
[class$='container'] {
|
|
86
|
+
display: contents;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
[part] {
|
|
90
|
+
grid-column: 1;
|
|
91
|
+
}
|
|
92
|
+
|
|
34
93
|
[part='label'] {
|
|
35
94
|
font-size: var(--vaadin-input-field-label-font-size, inherit);
|
|
36
95
|
line-height: var(--vaadin-input-field-label-line-height, inherit);
|
|
37
96
|
font-weight: var(--vaadin-input-field-label-font-weight, 500);
|
|
38
97
|
color: var(--vaadin-input-field-label-color, var(--vaadin-text-color));
|
|
39
|
-
order: var(--vaadin-input-field-helper-order);
|
|
40
98
|
word-break: break-word;
|
|
41
99
|
position: relative;
|
|
100
|
+
grid-area: label;
|
|
101
|
+
margin-bottom: var(--_helper-below-field, var(--_gap)) var(--_helper-above-field, var(--_no-helper, var(--_gap)));
|
|
42
102
|
}
|
|
43
103
|
|
|
44
104
|
::slotted(label) {
|
|
@@ -74,8 +134,23 @@ export const field = css`
|
|
|
74
134
|
display: none;
|
|
75
135
|
}
|
|
76
136
|
|
|
137
|
+
[part='label'],
|
|
138
|
+
[part='helper-text'],
|
|
139
|
+
[part='error-message'] {
|
|
140
|
+
width: min-content;
|
|
141
|
+
min-width: 100%;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
[part='input-field'],
|
|
145
|
+
[part='group-field'],
|
|
146
|
+
[part='input-fields'] {
|
|
147
|
+
grid-area: input;
|
|
148
|
+
}
|
|
149
|
+
|
|
77
150
|
[part='input-field'] {
|
|
78
|
-
|
|
151
|
+
width: var(--vaadin-field-default-width, 12em);
|
|
152
|
+
max-width: 100%;
|
|
153
|
+
min-width: 100%;
|
|
79
154
|
}
|
|
80
155
|
|
|
81
156
|
:host([readonly]) [part='input-field'] {
|
|
@@ -91,7 +166,9 @@ export const field = css`
|
|
|
91
166
|
line-height: var(--vaadin-input-field-helper-line-height, inherit);
|
|
92
167
|
font-weight: var(--vaadin-input-field-helper-font-weight, 400);
|
|
93
168
|
color: var(--vaadin-input-field-helper-color, var(--vaadin-text-color-secondary));
|
|
94
|
-
|
|
169
|
+
grid-area: helper;
|
|
170
|
+
margin-top: var(--_helper-above-field, var(--_gap-s)) var(--_helper-below-field, var(--_gap));
|
|
171
|
+
margin-bottom: var(--_helper-above-field, var(--_gap));
|
|
95
172
|
}
|
|
96
173
|
|
|
97
174
|
[part='error-message'] {
|
|
@@ -100,7 +177,10 @@ export const field = css`
|
|
|
100
177
|
font-weight: var(--vaadin-input-field-error-font-weight, 400);
|
|
101
178
|
color: var(--vaadin-input-field-error-color, var(--vaadin-text-color));
|
|
102
179
|
display: flex;
|
|
103
|
-
gap: var(--vaadin-gap-
|
|
180
|
+
gap: var(--vaadin-gap-xs);
|
|
181
|
+
grid-area: error;
|
|
182
|
+
margin-top: var(--_has-helper, var(--_helper-below-field, var(--_gap-s)) var(--_helper-above-field, var(--_gap)))
|
|
183
|
+
var(--_no-helper, var(--_gap));
|
|
104
184
|
}
|
|
105
185
|
|
|
106
186
|
[part='error-message']::before {
|
|
@@ -114,7 +194,8 @@ export const field = css`
|
|
|
114
194
|
}
|
|
115
195
|
|
|
116
196
|
:host([theme~='helper-above-field']) {
|
|
117
|
-
--
|
|
197
|
+
--_helper-above-field: initial;
|
|
198
|
+
--_helper-below-field: ;
|
|
118
199
|
}
|
|
119
200
|
|
|
120
201
|
@media (forced-colors: active) {
|
|
@@ -4,29 +4,30 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/component-base/src/styles/style-props.js';
|
|
7
|
-
import { css
|
|
7
|
+
import { css } from 'lit';
|
|
8
8
|
|
|
9
|
-
export const group =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
export const group = css`
|
|
10
|
+
[part='label'],
|
|
11
|
+
[part='helper-text'],
|
|
12
|
+
[part='error-message'] {
|
|
13
|
+
width: auto;
|
|
14
|
+
min-width: auto;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
.vaadin-group-field-container {
|
|
16
|
-
display: contents;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
:host,
|
|
20
17
|
[part='group-field'] {
|
|
21
18
|
display: flex;
|
|
22
19
|
flex-direction: column;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
[part='group-field'] {
|
|
26
20
|
gap: var(--vaadin-gap-xs) var(--vaadin-gap-xl);
|
|
27
21
|
}
|
|
28
22
|
|
|
29
23
|
:host([theme~='horizontal']) [part='group-field'] {
|
|
30
24
|
flex-flow: row wrap;
|
|
25
|
+
align-items: center;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:host([has-label][theme~='horizontal']) [part='group-field'] {
|
|
29
|
+
padding: var(--vaadin-padding-block-container) var(--vaadin-padding-inline-container);
|
|
30
|
+
padding-inline: 0;
|
|
31
|
+
border-block: var(--vaadin-input-field-border-width, 1px) solid transparent;
|
|
31
32
|
}
|
|
32
33
|
`;
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { button } from './button-base-styles.js';
|
|
7
|
-
import { container } from './container-base-styles.js';
|
|
8
7
|
import { field } from './field-base-styles.js';
|
|
9
8
|
|
|
10
|
-
export const inputFieldShared = [field,
|
|
9
|
+
export const inputFieldShared = [field, button];
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import '@vaadin/component-base/src/styles/style-props.js';
|
|
7
|
-
import { css } from 'lit';
|
|
8
|
-
|
|
9
|
-
export const container = css`
|
|
10
|
-
[class$='container'] {
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
gap: var(--vaadin-input-field-container-gap, var(--vaadin-gap-xs));
|
|
14
|
-
min-width: 100%;
|
|
15
|
-
max-width: 100%;
|
|
16
|
-
width: var(--vaadin-field-default-width, 12em);
|
|
17
|
-
}
|
|
18
|
-
`;
|