@vaadin/field-base 25.0.0-alpha2 → 25.0.0-alpha20

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/field-base",
3
- "version": "25.0.0-alpha2",
3
+ "version": "25.0.0-alpha20",
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-alpha2",
37
- "@vaadin/component-base": "25.0.0-alpha2",
34
+ "@vaadin/a11y-base": "25.0.0-alpha20",
35
+ "@vaadin/component-base": "25.0.0-alpha20",
38
36
  "lit": "^3.0.0"
39
37
  },
40
38
  "devDependencies": {
41
- "@vaadin/chai-plugins": "25.0.0-alpha2",
42
- "@vaadin/test-runner-commands": "25.0.0-alpha2",
39
+ "@vaadin/chai-plugins": "25.0.0-alpha20",
40
+ "@vaadin/test-runner-commands": "25.0.0-alpha20",
43
41
  "@vaadin/testing-helpers": "^2.0.0",
44
- "sinon": "^18.0.0"
42
+ "sinon": "^21.0.0"
45
43
  },
46
- "gitHead": "67ffcd5355cf21ce1b5039c598525109fc4c164b"
44
+ "gitHead": "c948aae591a30b432f3784000d4677674cae56e0"
47
45
  }
@@ -97,7 +97,7 @@ export class ErrorController extends SlotChildObserveController {
97
97
  * Note: unlike with other controllers, this method is
98
98
  * called for both default and custom error message.
99
99
  *
100
- * @param {Node | undefined} node
100
+ * @param {Node | undefined} errorNode
101
101
  * @protected
102
102
  * @override
103
103
  */
@@ -38,7 +38,6 @@ export class HelperController extends SlotChildObserveController {
38
38
  * Override method inherited from `SlotChildObserveController`
39
39
  * to create the default helper element lazily as needed.
40
40
  *
41
- * @param {Node | undefined} node
42
41
  * @protected
43
42
  * @override
44
43
  */
@@ -103,13 +103,27 @@ export const InputControlMixin = (superclass) =>
103
103
 
104
104
  /** @protected */
105
105
  get slotStyles() {
106
- // Needed for Safari, where ::slotted(...)::placeholder does not work
106
+ const tag = this.localName;
107
+
107
108
  return [
108
109
  `
109
- :is(input[slot='input'], textarea[slot='textarea'])::placeholder {
110
+ /* Needed for Safari, where ::slotted(...)::placeholder does not work */
111
+ ${tag} > :is(input[slot='input'], textarea[slot='textarea'])::placeholder {
110
112
  font: inherit;
111
113
  color: inherit;
112
114
  }
115
+
116
+ /* Override built-in autofill styles */
117
+ ${tag} > input[slot='input']:autofill {
118
+ -webkit-text-fill-color: var(--vaadin-input-field-autofill-color, black) !important;
119
+ background-clip: text !important;
120
+ }
121
+
122
+ ${tag}:has(> input[slot='input']:autofill)::part(input-field) {
123
+ --vaadin-input-field-background: var(--vaadin-input-field-autofill-background, lightyellow) !important;
124
+ --vaadin-input-field-value-color: var(--vaadin-input-field-autofill-color, black) !important;
125
+ --vaadin-input-field-button-color: var(--vaadin-input-field-autofill-color, black) !important;
126
+ }
113
127
  `,
114
128
  ];
115
129
  }
@@ -47,15 +47,6 @@ export declare class InputFieldMixinClass {
47
47
  */
48
48
  autocomplete: string | undefined;
49
49
 
50
- /**
51
- * This is a property supported by Safari that is used to control whether
52
- * autocorrection should be enabled when the user is entering/editing the text.
53
- * Possible values are:
54
- * on: Enable autocorrection.
55
- * off: Disable autocorrection.
56
- */
57
- autocorrect: 'off' | 'on' | undefined;
58
-
59
50
  /**
60
51
  * This is a property supported by Safari and Chrome that is used to control whether
61
52
  * autocapitalization should be enabled when the user is entering/editing the text.
@@ -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-text-color-secondary));
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-text-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,161 @@
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, var(--vaadin-gap-xs) var(--vaadin-gap-s));
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-text-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
+ width: 0;
69
+ }
70
+
71
+ /* visually hidden */
72
+ ::slotted(input) {
73
+ cursor: inherit;
74
+ margin: 0;
75
+ align-self: stretch;
76
+ appearance: none;
77
+ width: 100%;
78
+ height: 100%;
79
+ }
80
+
81
+ /* Control container (checkbox, radio button) */
82
+ [part='${unsafeCSS(part)}'] {
83
+ background: var(--vaadin-${unsafeCSS(propName)}-background, var(--vaadin-background-color));
84
+ border-color: var(--vaadin-${unsafeCSS(propName)}-border-color, var(--vaadin-input-field-border-color, var(--vaadin-border-color)));
85
+ border-radius: var(--vaadin-${unsafeCSS(propName)}-border-radius, var(--vaadin-radius-s));
86
+ border-style: var(--_border-style, solid);
87
+ --_border-width: var(--vaadin-${unsafeCSS(propName)}-border-width, var(--vaadin-input-field-border-width, 1px));
88
+ border-width: var(--_border-width);
89
+ box-sizing: border-box;
90
+ color: var(--vaadin-${unsafeCSS(propName)}-color, var(--vaadin-input-field-text-color, var(--vaadin-text-color)));
91
+ height: var(--vaadin-${unsafeCSS(propName)}-size, 1lh);
92
+ width: var(--vaadin-${unsafeCSS(propName)}-size, 1lh);
93
+ position: relative;
94
+ }
95
+
96
+ :host(:is([checked], [indeterminate])) {
97
+ --vaadin-${unsafeCSS(propName)}-background: var(--vaadin-text-color);
98
+ --vaadin-${unsafeCSS(propName)}-border-color: transparent;
99
+ --vaadin-${unsafeCSS(propName)}-color: oklch(from var(--vaadin-${unsafeCSS(propName)}-background) clamp(0, (0.62 - l) * 1000, 1) 0 0);
100
+ }
101
+
102
+ :host([disabled]) {
103
+ --vaadin-${unsafeCSS(propName)}-background: var(--vaadin-input-field-disabled-background, var(--vaadin-background-container-strong));
104
+ --vaadin-${unsafeCSS(propName)}-border-color: transparent;
105
+ --vaadin-${unsafeCSS(propName)}-color: var(--vaadin-text-color-disabled);
106
+ }
107
+
108
+ /* Focus ring */
109
+ :host([focus-ring]) [part='${unsafeCSS(part)}'] {
110
+ outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
111
+ outline-offset: calc(var(--_border-width) * -1);
112
+ }
113
+
114
+ :host([focus-ring]:is([checked], [indeterminate])) [part='${unsafeCSS(part)}'] {
115
+ outline-offset: 1px;
116
+ }
117
+
118
+ :host([readonly][focus-ring]) [part='${unsafeCSS(part)}'] {
119
+ --vaadin-${unsafeCSS(propName)}-border-color: transparent;
120
+ outline-offset: calc(var(--_border-width) * -1);
121
+ outline-style: dashed;
122
+ }
123
+
124
+ /* Checked indicator (checkmark, dot) */
125
+ [part='${unsafeCSS(part)}']::after {
126
+ content: '';
127
+ position: absolute;
128
+ background: currentColor;
129
+ border-radius: inherit;
130
+ }
131
+
132
+ :host(:not([checked], [indeterminate])) [part='${unsafeCSS(part)}']::after {
133
+ display: none;
134
+ }
135
+
136
+ @media (forced-colors: active) {
137
+ :host(:is([checked], [indeterminate])) {
138
+ --vaadin-${unsafeCSS(propName)}-border-color: CanvasText !important;
139
+ }
140
+
141
+ :host(:is([checked], [indeterminate])) [part='${unsafeCSS(part)}'] {
142
+ background: SelectedItem !important;
143
+ }
144
+
145
+ :host(:is([checked], [indeterminate])) [part='${unsafeCSS(part)}']::after {
146
+ background: SelectedItemText !important;
147
+ }
148
+
149
+ :host([readonly]) [part='${unsafeCSS(part)}']::after {
150
+ background: CanvasText !important;
151
+ }
152
+
153
+ :host([disabled]) {
154
+ --vaadin-${unsafeCSS(propName)}-border-color: GrayText !important;
155
+ }
156
+
157
+ :host([disabled]) [part='${unsafeCSS(part)}']::after {
158
+ background: GrayText !important;
159
+ }
160
+ }
161
+ `;
@@ -3,12 +3,14 @@
3
3
  * Copyright (c) 2021 - 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 '@vaadin/component-base/src/styles/style-props.js';
6
7
  import { css } from 'lit';
7
8
 
8
9
  export const container = css`
9
10
  [class$='container'] {
10
11
  display: flex;
11
12
  flex-direction: column;
13
+ gap: var(--vaadin-input-field-container-gap, var(--vaadin-gap-xs));
12
14
  min-width: 100%;
13
15
  max-width: 100%;
14
16
  width: var(--vaadin-field-default-width, 12em);
@@ -0,0 +1,125 @@
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-text-color));
39
+ order: var(--vaadin-input-field-helper-order);
40
+ word-break: break-word;
41
+ position: relative;
42
+ }
43
+
44
+ ::slotted(label) {
45
+ cursor: inherit;
46
+ }
47
+
48
+ :host([disabled]) [part='label'],
49
+ :host([disabled]) ::slotted(label) {
50
+ opacity: 0.5;
51
+ }
52
+
53
+ :host([disabled]) [part='label'] ::slotted(label) {
54
+ opacity: 1;
55
+ }
56
+
57
+ :host([required]) [part='label'] {
58
+ padding-inline-end: 1em;
59
+ }
60
+
61
+ [part='required-indicator'] {
62
+ display: inline-block;
63
+ position: absolute;
64
+ width: 1em;
65
+ text-align: center;
66
+ color: var(--vaadin-input-field-required-indicator-color, var(--vaadin-text-color-secondary));
67
+ }
68
+
69
+ [part='required-indicator']::after {
70
+ content: var(--vaadin-input-field-required-indicator, '*');
71
+ }
72
+
73
+ :host(:not([required])) [part='required-indicator'] {
74
+ display: none;
75
+ }
76
+
77
+ [part='input-field'] {
78
+ flex: auto;
79
+ }
80
+
81
+ :host([readonly]) [part='input-field'] {
82
+ cursor: default;
83
+ }
84
+
85
+ :host([disabled]) [part='input-field'] {
86
+ cursor: var(--vaadin-disabled-cursor);
87
+ }
88
+
89
+ [part='helper-text'] {
90
+ font-size: var(--vaadin-input-field-helper-font-size, inherit);
91
+ line-height: var(--vaadin-input-field-helper-line-height, inherit);
92
+ font-weight: var(--vaadin-input-field-helper-font-weight, 400);
93
+ color: var(--vaadin-input-field-helper-color, var(--vaadin-text-color-secondary));
94
+ order: var(--vaadin-input-field-helper-order);
95
+ }
96
+
97
+ [part='error-message'] {
98
+ font-size: var(--vaadin-input-field-error-font-size, inherit);
99
+ line-height: var(--vaadin-input-field-error-line-height, inherit);
100
+ font-weight: var(--vaadin-input-field-error-font-weight, 400);
101
+ color: var(--vaadin-input-field-error-color, var(--vaadin-text-color));
102
+ display: flex;
103
+ gap: var(--vaadin-gap-s);
104
+ }
105
+
106
+ [part='error-message']::before {
107
+ content: '';
108
+ display: inline-block;
109
+ flex: none;
110
+ width: var(--vaadin-icon-size, 1lh);
111
+ height: var(--vaadin-icon-size, 1lh);
112
+ mask-image: var(--_vaadin-icon-warn);
113
+ background: currentColor;
114
+ }
115
+
116
+ :host([theme~='helper-above-field']) {
117
+ --vaadin-input-field-helper-order: -1;
118
+ }
119
+
120
+ @media (forced-colors: active) {
121
+ [part='error-message']::before {
122
+ background: CanvasText;
123
+ }
124
+ }
125
+ `;
@@ -0,0 +1,8 @@
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 type { CSSResult } from 'lit';
7
+
8
+ export const group: (name?: string) => CSSResult;
@@ -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
+ gap: var(--vaadin-${unsafeCSS(name)}-group-gap, var(--vaadin-gap-xs));
13
+ }
14
+
15
+ .vaadin-group-field-container {
16
+ display: contents;
17
+ }
18
+
19
+ :host,
20
+ [part='group-field'] {
21
+ display: flex;
22
+ flex-direction: column;
23
+ }
24
+
25
+ [part='group-field'] {
26
+ gap: var(--vaadin-gap-xs) var(--vaadin-gap-xl);
27
+ }
28
+
29
+ :host([theme~='horizontal']) [part='group-field'] {
30
+ flex-flow: row wrap;
31
+ }
32
+ `;
@@ -3,8 +3,8 @@
3
3
  * Copyright (c) 2021 - 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 { button } from './button-core-styles.js';
7
- import { container } from './container-core-styles.js';
8
- import { field } from './field-core-styles.js';
6
+ import { button } from './button-base-styles.js';
7
+ import { container } from './container-base-styles.js';
8
+ import { field } from './field-base-styles.js';
9
9
 
10
10
  export const inputFieldShared = [field, container, button];
@@ -1,21 +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 { css } from 'lit';
7
-
8
- export const button = css`
9
- [part='clear-button'] {
10
- display: none;
11
- cursor: default;
12
- }
13
-
14
- [part='clear-button']::before {
15
- content: '\\2715';
16
- }
17
-
18
- :host([clear-button-visible][has-value]:not([disabled]):not([readonly])) [part='clear-button'] {
19
- display: block;
20
- }
21
- `;
@@ -1,44 +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 { css } from 'lit';
7
-
8
- export const field = css`
9
- :host {
10
- display: inline-flex;
11
- outline: none;
12
- }
13
-
14
- :host::before {
15
- content: '\\2003';
16
- width: 0;
17
- display: inline-block;
18
- /* Size and position this element on the same vertical position as the input-field element
19
- to make vertical align for the host element work as expected */
20
- }
21
-
22
- :host([hidden]) {
23
- display: none !important;
24
- }
25
-
26
- :host(:not([has-label])) [part='label'] {
27
- display: none;
28
- }
29
-
30
- @media (forced-colors: active) {
31
- :host(:not([readonly])) [part='input-field'] {
32
- outline: 1px solid;
33
- outline-offset: -1px;
34
- }
35
-
36
- :host([focused]) [part='input-field'] {
37
- outline-width: 2px;
38
- }
39
-
40
- :host([disabled]) [part='input-field'] {
41
- outline-color: GrayText;
42
- }
43
- }
44
- `;