@vaadin/field-base 25.0.0-alpha11 → 25.0.0-alpha12
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 +7 -9
- package/src/styles/button-base-styles.d.ts +8 -0
- package/src/styles/button-base-styles.js +54 -0
- package/src/styles/checkable-base-styles.d.ts +8 -0
- package/src/styles/checkable-base-styles.js +154 -0
- package/src/styles/container-base-styles.d.ts +8 -0
- package/src/styles/container-base-styles.js +18 -0
- package/src/styles/field-base-styles.d.ts +8 -0
- package/src/styles/field-base-styles.js +124 -0
- package/src/styles/group-base-styles.d.ts +8 -0
- package/src/styles/group-base-styles.js +32 -0
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-alpha12",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -22,9 +22,7 @@
|
|
|
22
22
|
"files": [
|
|
23
23
|
"index.d.ts",
|
|
24
24
|
"index.js",
|
|
25
|
-
"src"
|
|
26
|
-
"!src/styles/*-base-styles.d.ts",
|
|
27
|
-
"!src/styles/*-base-styles.js"
|
|
25
|
+
"src"
|
|
28
26
|
],
|
|
29
27
|
"keywords": [
|
|
30
28
|
"Vaadin",
|
|
@@ -33,15 +31,15 @@
|
|
|
33
31
|
],
|
|
34
32
|
"dependencies": {
|
|
35
33
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
36
|
-
"@vaadin/a11y-base": "25.0.0-
|
|
37
|
-
"@vaadin/component-base": "25.0.0-
|
|
34
|
+
"@vaadin/a11y-base": "25.0.0-alpha12",
|
|
35
|
+
"@vaadin/component-base": "25.0.0-alpha12",
|
|
38
36
|
"lit": "^3.0.0"
|
|
39
37
|
},
|
|
40
38
|
"devDependencies": {
|
|
41
|
-
"@vaadin/chai-plugins": "25.0.0-
|
|
42
|
-
"@vaadin/test-runner-commands": "25.0.0-
|
|
39
|
+
"@vaadin/chai-plugins": "25.0.0-alpha12",
|
|
40
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha12",
|
|
43
41
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
44
42
|
"sinon": "^18.0.0"
|
|
45
43
|
},
|
|
46
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "e75527348f9ba7c363d068c868b9f030c15b84a1"
|
|
47
45
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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 button = css`
|
|
10
|
+
[part$='button'] {
|
|
11
|
+
color: var(--vaadin-input-field-button-color, var(--vaadin-color-subtle));
|
|
12
|
+
cursor: var(--vaadin-clickable-cursor);
|
|
13
|
+
touch-action: manipulation;
|
|
14
|
+
-webkit-tap-highlight-color: transparent;
|
|
15
|
+
-webkit-user-select: none;
|
|
16
|
+
user-select: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* Icon */
|
|
20
|
+
[part$='button']::before {
|
|
21
|
+
background: currentColor;
|
|
22
|
+
content: '';
|
|
23
|
+
display: block;
|
|
24
|
+
height: var(--vaadin-icon-size, 1lh);
|
|
25
|
+
width: var(--vaadin-icon-size, 1lh);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:host(:is(:not([clear-button-visible][has-value]), [disabled], [readonly])) [part='clear-button'] {
|
|
29
|
+
display: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
[part='clear-button']::before {
|
|
33
|
+
mask-image: var(--_vaadin-icon-cross);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
:host(:is([readonly], [disabled])) [part$='button'] {
|
|
37
|
+
color: var(--vaadin-color-disabled);
|
|
38
|
+
cursor: var(--vaadin-disabled-cursor);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@media (forced-colors: active) {
|
|
42
|
+
[part$='button']::before {
|
|
43
|
+
background: CanvasText;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
:host([disabled]) [part$='button'] {
|
|
47
|
+
color: GrayText;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
:host([disabled]) [part$='button']::before {
|
|
51
|
+
background: GrayText;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
@@ -0,0 +1,8 @@
|
|
|
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 type { CSSResult } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const checkable: (part: string, propName?: string) => CSSResult;
|
|
@@ -0,0 +1,154 @@
|
|
|
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, unsafeCSS } from 'lit';
|
|
8
|
+
|
|
9
|
+
// postcss-lit-disable-next-line
|
|
10
|
+
export const checkable = (part, propName = part) => css`
|
|
11
|
+
:host {
|
|
12
|
+
align-items: center;
|
|
13
|
+
display: inline-grid;
|
|
14
|
+
gap: var(--vaadin-${unsafeCSS(propName)}-gap, 0.25lh var(--vaadin-gap-container-inline));
|
|
15
|
+
grid-template-columns: auto 1fr;
|
|
16
|
+
/*
|
|
17
|
+
Using minmax(auto, max-content) works around a Safari 17 issue where placing a checkbox
|
|
18
|
+
inside a flex container with flex-direction: column causes the container to unexpectedly
|
|
19
|
+
grow to the max available height.
|
|
20
|
+
*/
|
|
21
|
+
grid-template-rows: minmax(auto, max-content);
|
|
22
|
+
-webkit-tap-highlight-color: transparent;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host([disabled]) {
|
|
26
|
+
cursor: var(--vaadin-disabled-cursor);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:host(:not([has-label])) {
|
|
30
|
+
column-gap: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.vaadin-${unsafeCSS(propName)}-container {
|
|
34
|
+
display: contents;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
[part='${unsafeCSS(part)}'],
|
|
38
|
+
::slotted(input),
|
|
39
|
+
[part='label'],
|
|
40
|
+
::slotted(label) {
|
|
41
|
+
grid-row: 1;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
[part='label'],
|
|
45
|
+
::slotted(label) {
|
|
46
|
+
font-size: var(--vaadin-${unsafeCSS(propName)}-label-font-size, var(--vaadin-input-field-label-font-size, inherit));
|
|
47
|
+
line-height: var(--vaadin-${unsafeCSS(propName)}-label-line-height, var(--vaadin-input-field-label-line-height, inherit));
|
|
48
|
+
font-weight: var(--vaadin-${unsafeCSS(propName)}-font-weight, var(--vaadin-input-field-label-font-weight, 500));
|
|
49
|
+
color: var(--vaadin-${unsafeCSS(propName)}-label-color, var(--vaadin-input-field-label-color, var(--vaadin-color)));
|
|
50
|
+
word-break: break-word;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
[part='${unsafeCSS(part)}'],
|
|
54
|
+
::slotted(input) {
|
|
55
|
+
grid-column: 1;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
[part='helper-text'],
|
|
59
|
+
[part='error-message'] {
|
|
60
|
+
grid-column: 2;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Baseline vertical alignment */
|
|
64
|
+
:host::before {
|
|
65
|
+
content: '\\2003';
|
|
66
|
+
grid-column: 1;
|
|
67
|
+
grid-row: 1;
|
|
68
|
+
z-index: -1;
|
|
69
|
+
width: 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* visually hidden */
|
|
73
|
+
::slotted(input) {
|
|
74
|
+
cursor: inherit;
|
|
75
|
+
margin: 0;
|
|
76
|
+
align-self: stretch;
|
|
77
|
+
appearance: none;
|
|
78
|
+
width: 100%;
|
|
79
|
+
height: 100%;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* Control container (checkbox, radio button) */
|
|
83
|
+
[part='${unsafeCSS(part)}'] {
|
|
84
|
+
background: var(--vaadin-${unsafeCSS(propName)}-background, var(--vaadin-background-color));
|
|
85
|
+
border-color: var(--vaadin-${unsafeCSS(propName)}-border-color, var(--vaadin-input-field-border-color, var(--vaadin-border-color-strong)));
|
|
86
|
+
border-radius: var(--vaadin-${unsafeCSS(propName)}-border-radius, var(--vaadin-radius-s));
|
|
87
|
+
border-style: solid;
|
|
88
|
+
--_border-width: var(--vaadin-${unsafeCSS(propName)}-border-width, var(--vaadin-input-field-border-width, 1px));
|
|
89
|
+
border-width: var(--_border-width);
|
|
90
|
+
box-sizing: border-box;
|
|
91
|
+
color: var(--vaadin-${unsafeCSS(propName)}-color, var(--vaadin-input-field-text-color, var(--vaadin-color)));
|
|
92
|
+
height: var(--vaadin-${unsafeCSS(propName)}-size, 1lh);
|
|
93
|
+
width: var(--vaadin-${unsafeCSS(propName)}-size, 1lh);
|
|
94
|
+
position: relative;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
:host(:is([checked], [indeterminate])) {
|
|
98
|
+
--vaadin-${unsafeCSS(propName)}-background: var(--vaadin-color);
|
|
99
|
+
--vaadin-${unsafeCSS(propName)}-border-color: transparent;
|
|
100
|
+
--vaadin-${unsafeCSS(propName)}-color: var(--vaadin-background-color);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
:host([disabled]) {
|
|
104
|
+
--vaadin-${unsafeCSS(propName)}-background: var(--vaadin-input-field-disabled-background, var(--vaadin-background-container-strong));
|
|
105
|
+
--vaadin-${unsafeCSS(propName)}-border-color: transparent;
|
|
106
|
+
--vaadin-${unsafeCSS(propName)}-color: var(--vaadin-color-disabled);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* Focus ring */
|
|
110
|
+
:host([focus-ring]) [part='${unsafeCSS(part)}'] {
|
|
111
|
+
outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
|
|
112
|
+
outline-offset: calc(var(--_border-width) * -1);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
:host([focus-ring]:is([checked], [indeterminate])) [part='${unsafeCSS(part)}'] {
|
|
116
|
+
outline-offset: 1px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
:host([readonly][focus-ring]) [part='${unsafeCSS(part)}'] {
|
|
120
|
+
--vaadin-${unsafeCSS(propName)}-border-color: transparent;
|
|
121
|
+
outline-offset: calc(var(--_border-width) * -1);
|
|
122
|
+
outline-style: dashed;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* Checked indicator (checkmark, dot) */
|
|
126
|
+
[part='${unsafeCSS(part)}']::after {
|
|
127
|
+
content: '';
|
|
128
|
+
position: absolute;
|
|
129
|
+
background: currentColor;
|
|
130
|
+
border-radius: inherit;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
:host(:not([checked], [indeterminate])) [part='${unsafeCSS(part)}']::after {
|
|
134
|
+
display: none;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@media (forced-colors: active) {
|
|
138
|
+
:host(:is([checked], [indeterminate])) {
|
|
139
|
+
--vaadin-${unsafeCSS(propName)}-border-color: CanvasText;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
:host([readonly]) [part='${unsafeCSS(part)}']::after {
|
|
143
|
+
background: CanvasText;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
:host([disabled]) {
|
|
147
|
+
--vaadin-${unsafeCSS(propName)}-border-color: GrayText;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
:host([disabled]) [part='${unsafeCSS(part)}']::after {
|
|
151
|
+
background: GrayText;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
`;
|
|
@@ -0,0 +1,18 @@
|
|
|
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-container-block));
|
|
14
|
+
min-width: 100%;
|
|
15
|
+
max-width: 100%;
|
|
16
|
+
width: var(--vaadin-field-default-width, 12em);
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
@@ -0,0 +1,124 @@
|
|
|
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 field = css`
|
|
10
|
+
:host {
|
|
11
|
+
display: inline-flex;
|
|
12
|
+
outline: none;
|
|
13
|
+
cursor: default;
|
|
14
|
+
-webkit-tap-highlight-color: transparent;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
:host([hidden]) {
|
|
18
|
+
display: none !important;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* The label, helper text and the error message should neither grow nor shrink. */
|
|
22
|
+
[part='label'],
|
|
23
|
+
[part='helper-text'],
|
|
24
|
+
[part='error-message'] {
|
|
25
|
+
flex: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:host(:not([has-label])) [part='label'],
|
|
29
|
+
:host(:not([has-helper])) [part='helper-text'],
|
|
30
|
+
:host(:not([has-error-message])) [part='error-message'] {
|
|
31
|
+
display: none;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
[part='label'] {
|
|
35
|
+
font-size: var(--vaadin-input-field-label-font-size, inherit);
|
|
36
|
+
line-height: var(--vaadin-input-field-label-line-height, inherit);
|
|
37
|
+
font-weight: var(--vaadin-input-field-label-font-weight, 500);
|
|
38
|
+
color: var(--vaadin-input-field-label-color, var(--vaadin-color));
|
|
39
|
+
order: var(--vaadin-input-field-helper-order);
|
|
40
|
+
word-break: break-word;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
::slotted(label) {
|
|
44
|
+
cursor: inherit;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
:host([disabled]) [part='label'],
|
|
48
|
+
:host([disabled]) ::slotted(label) {
|
|
49
|
+
opacity: 0.5;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
:host([disabled]) [part='label'] ::slotted(label) {
|
|
53
|
+
opacity: 1;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
:host([required]) [part='label'] {
|
|
57
|
+
padding-inline-end: 1em;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
[part='required-indicator'] {
|
|
61
|
+
display: inline-block;
|
|
62
|
+
position: absolute;
|
|
63
|
+
width: 1em;
|
|
64
|
+
text-align: center;
|
|
65
|
+
color: var(--vaadin-input-field-required-indicator-color, var(--vaadin-color-subtle));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
[part='required-indicator']::after {
|
|
69
|
+
content: var(--vaadin-input-field-required-indicator, '*');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:host(:not([required])) [part='required-indicator'] {
|
|
73
|
+
display: none;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
[part='input-field'] {
|
|
77
|
+
flex: auto;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
:host([readonly]) [part='input-field'] {
|
|
81
|
+
cursor: default;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
:host([disabled]) [part='input-field'] {
|
|
85
|
+
cursor: var(--vaadin-disabled-cursor);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
[part='helper-text'] {
|
|
89
|
+
font-size: var(--vaadin-input-field-helper-font-size, inherit);
|
|
90
|
+
line-height: var(--vaadin-input-field-helper-line-height, inherit);
|
|
91
|
+
font-weight: var(--vaadin-input-field-helper-font-weight, 400);
|
|
92
|
+
color: var(--vaadin-input-field-helper-color, var(--vaadin-color-subtle));
|
|
93
|
+
order: var(--vaadin-input-field-helper-order);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
[part='error-message'] {
|
|
97
|
+
font-size: var(--vaadin-input-field-error-font-size, inherit);
|
|
98
|
+
line-height: var(--vaadin-input-field-error-line-height, inherit);
|
|
99
|
+
font-weight: var(--vaadin-input-field-error-font-weight, 400);
|
|
100
|
+
color: var(--vaadin-input-field-error-color, var(--vaadin-color));
|
|
101
|
+
display: flex;
|
|
102
|
+
gap: var(--vaadin-gap-container-inline);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
[part='error-message']::before {
|
|
106
|
+
content: '';
|
|
107
|
+
display: inline-block;
|
|
108
|
+
flex: none;
|
|
109
|
+
width: var(--vaadin-icon-size, 1lh);
|
|
110
|
+
height: var(--vaadin-icon-size, 1lh);
|
|
111
|
+
mask-image: var(--_vaadin-icon-warn);
|
|
112
|
+
background: currentColor;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
:host([theme~='helper-above-field']) {
|
|
116
|
+
--vaadin-input-field-helper-order: -1;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@media (forced-colors: active) {
|
|
120
|
+
[part='error-message']::before {
|
|
121
|
+
background: CanvasText;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
`;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2018 - 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, unsafeCSS } from 'lit';
|
|
8
|
+
|
|
9
|
+
export const group = (name = 'checkbox') => css`
|
|
10
|
+
:host {
|
|
11
|
+
width: fit-content;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.vaadin-group-field-container {
|
|
15
|
+
display: contents;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host,
|
|
19
|
+
[part='group-field'] {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
gap: var(--vaadin-${unsafeCSS(name)}-group-gap, var(--vaadin-gap-container-block));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
[part='group-field'] {
|
|
26
|
+
gap: 0.5lh 1.5em;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:host([theme~='horizontal']) [part='group-field'] {
|
|
30
|
+
flex-flow: row wrap;
|
|
31
|
+
}
|
|
32
|
+
`;
|