@vaadin/input-container 25.0.0-alpha1 → 25.0.0-alpha10

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-alpha1",
3
+ "version": "25.0.0-alpha10",
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-alpha1",
36
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha1",
37
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha1",
36
+ "@vaadin/component-base": "25.0.0-alpha10",
37
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha10",
38
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha10",
38
39
  "lit": "^3.0.0"
39
40
  },
40
41
  "devDependencies": {
41
- "@vaadin/chai-plugins": "25.0.0-alpha1",
42
- "@vaadin/icon": "25.0.0-alpha1",
43
- "@vaadin/icons": "25.0.0-alpha1",
44
- "@vaadin/test-runner-commands": "25.0.0-alpha1",
45
- "@vaadin/testing-helpers": "^1.1.0",
42
+ "@vaadin/chai-plugins": "25.0.0-alpha10",
43
+ "@vaadin/icon": "25.0.0-alpha10",
44
+ "@vaadin/icons": "25.0.0-alpha10",
45
+ "@vaadin/test-runner-commands": "25.0.0-alpha10",
46
+ "@vaadin/testing-helpers": "^2.0.0",
46
47
  "sinon": "^18.0.0"
47
48
  },
48
- "gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
49
+ "gitHead": "6cc6c94079e805fa5b2f0af4dbf3b2a7485e57d0"
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,129 @@
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
+ :host {
11
+ display: flex;
12
+ align-items: center;
13
+ --_radius: var(--vaadin-input-field-border-radius, var(--vaadin-radius-m));
14
+ border-radius:
15
+ /* See https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius */
16
+ var(--vaadin-input-field-top-start-radius, var(--_radius))
17
+ var(--vaadin-input-field-top-end-radius, var(--_radius))
18
+ var(--vaadin-input-field-bottom-end-radius, var(--_radius))
19
+ var(--vaadin-input-field-bottom-start-radius, var(--_radius));
20
+ border: var(--vaadin-input-field-border-width, 1px) solid
21
+ var(--vaadin-input-field-border-color, var(--vaadin-border-color-strong));
22
+ box-sizing: border-box;
23
+ cursor: text;
24
+ padding: var(--vaadin-input-field-padding, var(--vaadin-padding-container));
25
+ gap: var(--vaadin-input-field-gap, var(--vaadin-gap-container-inline));
26
+ background: var(--vaadin-input-field-background, var(--vaadin-background-color));
27
+ color: var(--vaadin-input-field-value-color, var(--vaadin-color));
28
+ font-size: var(--vaadin-input-field-value-font-size, inherit);
29
+ line-height: var(--vaadin-input-field-value-line-height, inherit);
30
+ font-weight: var(--vaadin-input-field-value-font-weight, 400);
31
+ }
32
+
33
+ :host([dir='rtl']) {
34
+ --_radius: var(--vaadin-input-field-border-radius, var(--vaadin-radius-m));
35
+ border-radius:
36
+ /* Don't use logical props, see https://github.com/vaadin/vaadin-time-picker/issues/145 */
37
+ var(--vaadin-input-field-top-end-radius, var(--_radius))
38
+ var(--vaadin-input-field-top-start-radius, var(--_radius))
39
+ var(--vaadin-input-field-bottom-start-radius, var(--_radius))
40
+ var(--vaadin-input-field-bottom-end-radius, var(--_radius));
41
+ }
42
+
43
+ :host([hidden]) {
44
+ display: none !important;
45
+ }
46
+
47
+ /* Reset the native input styles */
48
+ ::slotted(:is(input, textarea)) {
49
+ appearance: none;
50
+ align-self: stretch;
51
+ box-sizing: border-box;
52
+ flex: auto;
53
+ white-space: nowrap;
54
+ overflow: hidden;
55
+ width: 100%;
56
+ height: auto;
57
+ outline: none;
58
+ margin: 0;
59
+ padding: 0;
60
+ border: 0;
61
+ border-radius: 0;
62
+ min-width: 0;
63
+ font: inherit;
64
+ font-size: 1em;
65
+ color: inherit;
66
+ background: transparent;
67
+ cursor: inherit;
68
+ caret-color: var(--vaadin-input-field-value-color);
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-subtle));
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([invalid]) {
96
+ --vaadin-input-field-border-color: var(--vaadin-input-field-error-color, var(--vaadin-color));
97
+ }
98
+
99
+ :host([readonly]) {
100
+ border-style: dashed;
101
+ }
102
+
103
+ :host([readonly]:focus-within) {
104
+ outline-style: dashed;
105
+ --vaadin-input-field-border-color: transparent;
106
+ }
107
+
108
+ :host([disabled]) {
109
+ --vaadin-input-field-value-color: var(--vaadin-input-field-disabled-text-color, var(--vaadin-color-disabled));
110
+ --vaadin-input-field-background: var(
111
+ --vaadin-input-field-disabled-background,
112
+ var(--vaadin-background-container-strong)
113
+ );
114
+ --vaadin-input-field-border-color: transparent;
115
+ }
116
+
117
+ @media (forced-colors: active) {
118
+ :host {
119
+ --vaadin-input-field-background: Field;
120
+ --vaadin-input-field-value-color: FieldText;
121
+ --vaadin-input-field-placeholder-color: GrayText;
122
+ }
123
+
124
+ :host([disabled]) {
125
+ --vaadin-input-field-value-color: GrayText;
126
+ --vaadin-icon-color: GrayText;
127
+ }
128
+ }
129
+ `;
@@ -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;
@@ -19,7 +19,6 @@ export const inputContainerStyles = css`
19
19
  --_border-radius: var(--vaadin-input-field-border-radius, 0);
20
20
  --_input-border-width: var(--vaadin-input-field-border-width, 0px);
21
21
  --_input-border-color: var(--vaadin-input-field-border-color, transparent);
22
- /* stylelint-disable-next-line length-zero-no-unit */
23
22
  box-shadow: inset 0 0 0 var(--_input-border-width, 0) var(--_input-border-color);
24
23
  }
25
24
 
@@ -38,8 +37,7 @@ export const inputContainerStyles = css`
38
37
 
39
38
  /* Reset the native input styles */
40
39
  ::slotted(input) {
41
- -webkit-appearance: none;
42
- -moz-appearance: none;
40
+ appearance: none;
43
41
  flex: auto;
44
42
  white-space: nowrap;
45
43
  overflow: hidden;
@@ -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 { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-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 ThemableMixin(DirMixin(PolylitMixin(LumoInjectionMixin(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);
@@ -65,7 +65,6 @@ registerStyles(
65
65
  min-height: var(--vaadin-input-field-height, var(--_input-height));
66
66
  padding: 0 0.25em;
67
67
  --_lumo-text-field-overflow-mask-image: linear-gradient(to left, transparent, #000 1.25em);
68
- -webkit-mask-image: var(--_lumo-text-field-overflow-mask-image);
69
68
  mask-image: var(--_lumo-text-field-overflow-mask-image);
70
69
  }
71
70
 
@@ -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
- };