@vaadin/input-container 25.0.0-alpha2 → 25.0.0-alpha4

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/input-container",
3
- "version": "25.0.0-alpha2",
3
+ "version": "25.0.0-alpha4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,7 +21,8 @@
21
21
  "type": "module",
22
22
  "files": [
23
23
  "src",
24
- "!src/vaadin-input-container-base-styles.js",
24
+ "!src/styles/*-base-styles.d.ts",
25
+ "!src/styles/*-base-styles.js",
25
26
  "theme",
26
27
  "vaadin-*.d.ts",
27
28
  "vaadin-*.js"
@@ -32,18 +33,18 @@
32
33
  "web-component"
33
34
  ],
34
35
  "dependencies": {
35
- "@vaadin/component-base": "25.0.0-alpha2",
36
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha2",
37
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha2",
36
+ "@vaadin/component-base": "25.0.0-alpha4",
37
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha4",
38
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha4",
38
39
  "lit": "^3.0.0"
39
40
  },
40
41
  "devDependencies": {
41
- "@vaadin/chai-plugins": "25.0.0-alpha2",
42
- "@vaadin/icon": "25.0.0-alpha2",
43
- "@vaadin/icons": "25.0.0-alpha2",
44
- "@vaadin/test-runner-commands": "25.0.0-alpha2",
42
+ "@vaadin/chai-plugins": "25.0.0-alpha4",
43
+ "@vaadin/icon": "25.0.0-alpha4",
44
+ "@vaadin/icons": "25.0.0-alpha4",
45
+ "@vaadin/test-runner-commands": "25.0.0-alpha4",
45
46
  "@vaadin/testing-helpers": "^2.0.0",
46
47
  "sinon": "^18.0.0"
47
48
  },
48
- "gitHead": "67ffcd5355cf21ce1b5039c598525109fc4c164b"
49
+ "gitHead": "ce4421f0daf26027b863b91787a474e4cc264344"
49
50
  }
@@ -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 inputContainerStyles: CSSResult;
@@ -0,0 +1,126 @@
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/style-props.js';
7
+ import { css } from 'lit';
8
+
9
+ export const inputContainerStyles = css`
10
+ @layer base {
11
+ :host {
12
+ display: flex;
13
+ align-items: center;
14
+ --_radius: var(--vaadin-input-field-border-radius, var(--_vaadin-radius-m));
15
+ border-radius:
16
+ /* See https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius */
17
+ var(--vaadin-input-field-top-start-radius, var(--_radius))
18
+ var(--vaadin-input-field-top-end-radius, var(--_radius))
19
+ var(--vaadin-input-field-bottom-end-radius, var(--_radius))
20
+ var(--vaadin-input-field-bottom-start-radius, var(--_radius));
21
+ border: var(--vaadin-input-field-border-width, 1px) solid
22
+ var(--vaadin-input-field-border-color, var(--_vaadin-border-color-strong));
23
+ box-sizing: border-box;
24
+ cursor: text;
25
+ padding: var(--vaadin-input-field-padding, var(--_vaadin-padding-container));
26
+ gap: var(--vaadin-input-field-gap, var(--_vaadin-gap-container-inline));
27
+ background: var(--vaadin-input-field-background, var(--_vaadin-background));
28
+ color: var(--vaadin-input-field-value-color, var(--_vaadin-color-strong));
29
+ font-size: var(--vaadin-input-field-value-font-size, inherit);
30
+ line-height: var(--vaadin-input-field-value-line-height, inherit);
31
+ font-weight: var(--vaadin-input-field-value-font-weight, 400);
32
+ }
33
+
34
+ :host([dir='rtl']) {
35
+ --_radius: var(--vaadin-input-field-border-radius, var(--_vaadin-radius-m));
36
+ border-radius:
37
+ /* Don't use logical props, see https://github.com/vaadin/vaadin-time-picker/issues/145 */
38
+ var(--vaadin-input-field-top-end-radius, var(--_radius))
39
+ var(--vaadin-input-field-top-start-radius, var(--_radius))
40
+ var(--vaadin-input-field-bottom-start-radius, var(--_radius))
41
+ var(--vaadin-input-field-bottom-end-radius, var(--_radius));
42
+ }
43
+
44
+ :host([hidden]) {
45
+ display: none !important;
46
+ }
47
+
48
+ /* Reset the native input styles */
49
+ ::slotted(:is(input, textarea)) {
50
+ appearance: none;
51
+ align-self: stretch;
52
+ box-sizing: border-box;
53
+ flex: auto;
54
+ white-space: nowrap;
55
+ overflow: hidden;
56
+ width: 100%;
57
+ height: auto;
58
+ outline: none;
59
+ margin: 0;
60
+ padding: 0;
61
+ border: 0;
62
+ border-radius: 0;
63
+ min-width: 0;
64
+ font: inherit;
65
+ font-size: 1em;
66
+ color: inherit;
67
+ background: transparent;
68
+ cursor: inherit;
69
+ }
70
+
71
+ ::slotted(*) {
72
+ flex: none;
73
+ }
74
+
75
+ slot[name$='fix'] {
76
+ cursor: auto;
77
+ }
78
+
79
+ ::slotted(:is(input, textarea))::placeholder {
80
+ /* Use ::slotted(:is(input, textarea):placeholder-shown) to style the placeholder */
81
+ /* because ::slotted(...)::placeholder does not work in Safari. */
82
+ font: inherit;
83
+ color: inherit;
84
+ }
85
+
86
+ ::slotted(:is(input, textarea):placeholder-shown) {
87
+ color: var(--vaadin-input-field-placeholder-color, var(--_vaadin-color));
88
+ }
89
+
90
+ :host(:focus-within) {
91
+ outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
92
+ outline-offset: calc(var(--vaadin-input-field-border-width, 1px) * -1);
93
+ }
94
+
95
+ :host([readonly]) {
96
+ border-style: dashed;
97
+ }
98
+
99
+ :host([readonly]:focus-within) {
100
+ outline-style: dashed;
101
+ --vaadin-input-field-border-color: transparent;
102
+ }
103
+
104
+ :host([disabled]) {
105
+ --vaadin-input-field-value-color: var(--vaadin-input-field-disabled-text-color, var(--_vaadin-color-subtle));
106
+ --vaadin-input-field-background: var(
107
+ --vaadin-input-field-disabled-background,
108
+ var(--_vaadin-background-container-strong)
109
+ );
110
+ --vaadin-input-field-border-color: transparent;
111
+ }
112
+
113
+ @media (forced-colors: active) {
114
+ :host {
115
+ --vaadin-input-field-background: Field;
116
+ --vaadin-input-field-value-color: FieldText;
117
+ --vaadin-input-field-placeholder-color: GrayText;
118
+ }
119
+
120
+ :host([disabled]) {
121
+ --vaadin-input-field-value-color: GrayText;
122
+ --vaadin-icon-color: GrayText;
123
+ }
124
+ }
125
+ }
126
+ `;
@@ -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 inputContainerStyles: CSSResult;
@@ -7,18 +7,17 @@ import { html, LitElement } from 'lit';
7
7
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
8
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
9
9
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
+ import { CSSInjectionMixin } from '@vaadin/vaadin-themable-mixin/css-injection-mixin.js';
10
11
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
- import { inputContainerStyles } from './vaadin-input-container-core-styles.js';
12
- import { InputContainerMixin } from './vaadin-input-container-mixin.js';
12
+ import { inputContainerStyles } from './styles/vaadin-input-container-core-styles.js';
13
13
 
14
14
  /**
15
15
  * @customElement
16
16
  * @extends HTMLElement
17
17
  * @mixes ThemableMixin
18
18
  * @mixes DirMixin
19
- * @mixes InputContainerMixin
20
19
  */
21
- export class InputContainer extends InputContainerMixin(ThemableMixin(DirMixin(PolylitMixin(LitElement)))) {
20
+ export class InputContainer extends CSSInjectionMixin(ThemableMixin(DirMixin(PolylitMixin(LitElement)))) {
22
21
  static get is() {
23
22
  return 'vaadin-input-container';
24
23
  }
@@ -27,6 +26,34 @@ export class InputContainer extends InputContainerMixin(ThemableMixin(DirMixin(P
27
26
  return inputContainerStyles;
28
27
  }
29
28
 
29
+ static get properties() {
30
+ return {
31
+ /**
32
+ * If true, the user cannot interact with this element.
33
+ */
34
+ disabled: {
35
+ type: Boolean,
36
+ reflectToAttribute: true,
37
+ },
38
+
39
+ /**
40
+ * Set to true to make this element read-only.
41
+ */
42
+ readonly: {
43
+ type: Boolean,
44
+ reflectToAttribute: true,
45
+ },
46
+
47
+ /**
48
+ * Set to true when the element is invalid.
49
+ */
50
+ invalid: {
51
+ type: Boolean,
52
+ reflectToAttribute: true,
53
+ },
54
+ };
55
+ }
56
+
30
57
  /** @protected */
31
58
  render() {
32
59
  return html`
@@ -35,6 +62,29 @@ export class InputContainer extends InputContainerMixin(ThemableMixin(DirMixin(P
35
62
  <slot name="suffix"></slot>
36
63
  `;
37
64
  }
65
+
66
+ /** @protected */
67
+ ready() {
68
+ super.ready();
69
+
70
+ this.addEventListener('pointerdown', (event) => {
71
+ if (event.target === this) {
72
+ // Prevent direct clicks to the input container from blurring the input
73
+ event.preventDefault();
74
+ }
75
+ });
76
+
77
+ this.addEventListener('click', (event) => {
78
+ if (event.target === this) {
79
+ // The vaadin-input-container element was directly clicked,
80
+ // focus any focusable child element from the default slot
81
+ this.shadowRoot
82
+ .querySelector('slot:not([name])')
83
+ .assignedNodes({ flatten: true })
84
+ .forEach((node) => node.focus && node.focus());
85
+ }
86
+ });
87
+ }
38
88
  }
39
89
 
40
90
  defineCustomElement(InputContainer);
@@ -1,62 +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
-
7
- /**
8
- * @polymerMixin
9
- */
10
- export const InputContainerMixin = (superClass) =>
11
- class InputContainerMixinClass extends superClass {
12
- static get properties() {
13
- return {
14
- /**
15
- * If true, the user cannot interact with this element.
16
- */
17
- disabled: {
18
- type: Boolean,
19
- reflectToAttribute: true,
20
- },
21
-
22
- /**
23
- * Set to true to make this element read-only.
24
- */
25
- readonly: {
26
- type: Boolean,
27
- reflectToAttribute: true,
28
- },
29
-
30
- /**
31
- * Set to true when the element is invalid.
32
- */
33
- invalid: {
34
- type: Boolean,
35
- reflectToAttribute: true,
36
- },
37
- };
38
- }
39
-
40
- /** @protected */
41
- ready() {
42
- super.ready();
43
-
44
- this.addEventListener('pointerdown', (event) => {
45
- if (event.target === this) {
46
- // Prevent direct clicks to the input container from blurring the input
47
- event.preventDefault();
48
- }
49
- });
50
-
51
- this.addEventListener('click', (event) => {
52
- if (event.target === this) {
53
- // The vaadin-input-container element was directly clicked,
54
- // focus any focusable child element from the default slot
55
- this.shadowRoot
56
- .querySelector('slot:not([name])')
57
- .assignedNodes({ flatten: true })
58
- .forEach((node) => node.focus && node.focus());
59
- }
60
- });
61
- }
62
- };