@vaadin/field-base 25.0.0-beta3 → 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 +36 -18
- 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
|
|
@@ -20,20 +19,17 @@ export const checkable = (part, propName = part) => css`
|
|
|
20
19
|
*/
|
|
21
20
|
grid-template-rows: minmax(auto, max-content);
|
|
22
21
|
-webkit-tap-highlight-color: transparent;
|
|
22
|
+
--_cursor: var(--vaadin-clickable-cursor);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
:host([disabled]) {
|
|
26
|
-
|
|
26
|
+
--_cursor: var(--vaadin-disabled-cursor);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
:host(:not([has-label])) {
|
|
30
30
|
column-gap: 0;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
.vaadin-${unsafeCSS(propName)}-container {
|
|
34
|
-
display: contents;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
33
|
[part='${unsafeCSS(part)}'],
|
|
38
34
|
::slotted(input),
|
|
39
35
|
[part='label'],
|
|
@@ -48,6 +44,8 @@ export const checkable = (part, propName = part) => css`
|
|
|
48
44
|
font-weight: var(--vaadin-${unsafeCSS(propName)}-font-weight, var(--vaadin-input-field-label-font-weight, 500));
|
|
49
45
|
color: var(--vaadin-${unsafeCSS(propName)}-label-color, var(--vaadin-input-field-label-color, var(--vaadin-text-color)));
|
|
50
46
|
word-break: break-word;
|
|
47
|
+
cursor: var(--_cursor);
|
|
48
|
+
/* TODO clicking the label part doesn't toggle the checked state, even though it triggers the active state */
|
|
51
49
|
}
|
|
52
50
|
|
|
53
51
|
[part='${unsafeCSS(part)}'],
|
|
@@ -55,17 +53,26 @@ export const checkable = (part, propName = part) => css`
|
|
|
55
53
|
grid-column: 1;
|
|
56
54
|
}
|
|
57
55
|
|
|
56
|
+
[part='label'],
|
|
58
57
|
[part='helper-text'],
|
|
59
58
|
[part='error-message'] {
|
|
59
|
+
margin-bottom: 0;
|
|
60
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);
|
|
61
68
|
}
|
|
62
69
|
|
|
63
70
|
/* Baseline vertical alignment */
|
|
64
71
|
:host::before {
|
|
65
|
-
content: '\\2003';
|
|
66
|
-
grid-column: 1;
|
|
67
72
|
grid-row: 1;
|
|
68
|
-
|
|
73
|
+
margin: 0;
|
|
74
|
+
padding: 0;
|
|
75
|
+
border: 0;
|
|
69
76
|
}
|
|
70
77
|
|
|
71
78
|
/* visually hidden */
|
|
@@ -74,8 +81,12 @@ export const checkable = (part, propName = part) => css`
|
|
|
74
81
|
margin: 0;
|
|
75
82
|
align-self: stretch;
|
|
76
83
|
appearance: none;
|
|
77
|
-
|
|
78
|
-
|
|
84
|
+
cursor: var(--_cursor);
|
|
85
|
+
/* Ensure minimum click target (WCAG) */
|
|
86
|
+
width: 2px;
|
|
87
|
+
height: 2px;
|
|
88
|
+
scale: 12;
|
|
89
|
+
margin: auto;
|
|
79
90
|
}
|
|
80
91
|
|
|
81
92
|
/* Control container (checkbox, radio button) */
|
|
@@ -87,16 +98,20 @@ export const checkable = (part, propName = part) => css`
|
|
|
87
98
|
--_border-width: var(--vaadin-${unsafeCSS(propName)}-border-width, var(--vaadin-input-field-border-width, 1px));
|
|
88
99
|
border-width: var(--_border-width);
|
|
89
100
|
box-sizing: border-box;
|
|
90
|
-
|
|
101
|
+
--_color: var(--vaadin-${unsafeCSS(propName)}-marker-color, var(--vaadin-${unsafeCSS(propName)}-background, var(--vaadin-background-color)));
|
|
102
|
+
color: var(--_color);
|
|
91
103
|
height: var(--vaadin-${unsafeCSS(propName)}-size, 1lh);
|
|
92
104
|
width: var(--vaadin-${unsafeCSS(propName)}-size, 1lh);
|
|
93
105
|
position: relative;
|
|
106
|
+
cursor: var(--_cursor);
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: center;
|
|
94
110
|
}
|
|
95
111
|
|
|
96
112
|
:host(:is([checked], [indeterminate])) {
|
|
97
113
|
--vaadin-${unsafeCSS(propName)}-background: var(--vaadin-text-color);
|
|
98
114
|
--vaadin-${unsafeCSS(propName)}-border-color: transparent;
|
|
99
|
-
--vaadin-${unsafeCSS(propName)}-marker-color: oklch(from var(--vaadin-${unsafeCSS(propName)}-background) clamp(0, (0.62 - l) * 1000, 1) 0 0);
|
|
100
115
|
}
|
|
101
116
|
|
|
102
117
|
:host([disabled]) {
|
|
@@ -123,14 +138,17 @@ export const checkable = (part, propName = part) => css`
|
|
|
123
138
|
|
|
124
139
|
/* Checked indicator (checkmark, dot) */
|
|
125
140
|
[part='${unsafeCSS(part)}']::after {
|
|
126
|
-
content: '';
|
|
127
|
-
position: absolute;
|
|
141
|
+
content: '\\2003' / '';
|
|
128
142
|
background: currentColor;
|
|
129
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);
|
|
130
148
|
}
|
|
131
149
|
|
|
132
150
|
:host(:not([checked], [indeterminate])) [part='${unsafeCSS(part)}']::after {
|
|
133
|
-
|
|
151
|
+
opacity: 0;
|
|
134
152
|
}
|
|
135
153
|
|
|
136
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
|
-
`;
|