@vaadin/input-container 24.8.4 → 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": "24.8.4",
3
+ "version": "25.0.0-alpha10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,6 +21,8 @@
21
21
  "type": "module",
22
22
  "files": [
23
23
  "src",
24
+ "!src/styles/*-base-styles.d.ts",
25
+ "!src/styles/*-base-styles.js",
24
26
  "theme",
25
27
  "vaadin-*.d.ts",
26
28
  "vaadin-*.js"
@@ -31,20 +33,18 @@
31
33
  "web-component"
32
34
  ],
33
35
  "dependencies": {
34
- "@polymer/polymer": "^3.0.0",
35
- "@vaadin/component-base": "~24.8.4",
36
- "@vaadin/vaadin-lumo-styles": "~24.8.4",
37
- "@vaadin/vaadin-material-styles": "~24.8.4",
38
- "@vaadin/vaadin-themable-mixin": "~24.8.4",
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",
39
39
  "lit": "^3.0.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@vaadin/chai-plugins": "~24.8.4",
43
- "@vaadin/icon": "~24.8.4",
44
- "@vaadin/icons": "~24.8.4",
45
- "@vaadin/test-runner-commands": "~24.8.4",
46
- "@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",
47
47
  "sinon": "^18.0.0"
48
48
  },
49
- "gitHead": "849e54e967563080a685965e2dced02060b3ab23"
49
+ "gitHead": "6cc6c94079e805fa5b2f0af4dbf3b2a7485e57d0"
50
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;
@@ -3,34 +3,88 @@
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 { html, PolymerElement } from '@polymer/polymer';
6
+ 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
- import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
10
- import { inputContainerStyles } from './vaadin-input-container-core-styles.js';
11
- import { InputContainerMixin } from './vaadin-input-container-mixin.js';
12
-
13
- registerStyles('vaadin-input-container', inputContainerStyles, { moduleId: 'vaadin-input-container-styles' });
9
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
+ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
11
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
12
+ import { inputContainerStyles } from './styles/vaadin-input-container-core-styles.js';
14
13
 
15
14
  /**
16
15
  * @customElement
17
16
  * @extends HTMLElement
18
17
  * @mixes ThemableMixin
19
18
  * @mixes DirMixin
20
- * @mixes InputContainerMixin
21
19
  */
22
- export class InputContainer extends InputContainerMixin(ThemableMixin(DirMixin(PolymerElement))) {
20
+ export class InputContainer extends ThemableMixin(DirMixin(PolylitMixin(LumoInjectionMixin(LitElement)))) {
23
21
  static get is() {
24
22
  return 'vaadin-input-container';
25
23
  }
26
24
 
27
- static get template() {
25
+ static get styles() {
26
+ return inputContainerStyles;
27
+ }
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
+
57
+ /** @protected */
58
+ render() {
28
59
  return html`
29
60
  <slot name="prefix"></slot>
30
61
  <slot></slot>
31
62
  <slot name="suffix"></slot>
32
63
  `;
33
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
+ }
34
88
  }
35
89
 
36
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
- };
@@ -1,47 +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 { html, LitElement } from 'lit';
7
- import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
- import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
9
- import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
- 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';
13
-
14
- /**
15
- * LitElement based version of `<vaadin-input-container>` web component.
16
- *
17
- * ## Disclaimer
18
- *
19
- * This component is an experiment and not yet a part of Vaadin platform.
20
- * There is no ETA regarding specific Vaadin version where it'll land.
21
- * Feel free to try this code in your apps as per Apache 2.0 license.
22
- *
23
- * @extends HTMLElement
24
- * @mixes ThemableMixin
25
- * @mixes DirMixin
26
- * @mixes InputContainerMixin
27
- */
28
- export class InputContainer extends InputContainerMixin(ThemableMixin(DirMixin(PolylitMixin(LitElement)))) {
29
- static get is() {
30
- return 'vaadin-input-container';
31
- }
32
-
33
- static get styles() {
34
- return inputContainerStyles;
35
- }
36
-
37
- /** @protected */
38
- render() {
39
- return html`
40
- <slot name="prefix"></slot>
41
- <slot></slot>
42
- <slot name="suffix"></slot>
43
- `;
44
- }
45
- }
46
-
47
- defineCustomElement(InputContainer);
@@ -1 +0,0 @@
1
- import '@vaadin/vaadin-material-styles/color.js';
@@ -1,80 +0,0 @@
1
- import '@vaadin/vaadin-material-styles/color.js';
2
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
3
-
4
- registerStyles(
5
- 'vaadin-input-container',
6
- css`
7
- :host {
8
- position: relative;
9
- top: -0.2px; /* NOTE(platosha): Adjusts for wrong flex baseline in Chrome & Safari */
10
- height: 32px;
11
- padding-left: 0;
12
- padding-right: 0;
13
- background-color: transparent;
14
- margin: 0;
15
- }
16
-
17
- :host::before,
18
- :host::after {
19
- content: '';
20
- position: absolute;
21
- bottom: 0;
22
- left: 0;
23
- right: 0;
24
- height: 1px;
25
- transform-origin: 50% 0%;
26
- background-color: var(--_material-text-field-input-line-background-color, #000);
27
- opacity: var(--_material-text-field-input-line-opacity, 0.42);
28
- }
29
-
30
- :host::after {
31
- background-color: var(--material-primary-color);
32
- opacity: 0;
33
- height: 2px;
34
- bottom: 0;
35
- transform: scaleX(0);
36
- transition: opacity 0.175s;
37
- }
38
-
39
- ::slotted(:not([slot$='fix'])) {
40
- padding: 8px 0;
41
- }
42
-
43
- ::slotted([slot$='fix']) {
44
- color: var(--material-secondary-text-color);
45
- }
46
-
47
- /* Disabled */
48
- :host([disabled]) {
49
- color: var(--material-disabled-text-color);
50
- }
51
-
52
- :host([disabled])::before {
53
- background-color: transparent;
54
- background-image: linear-gradient(
55
- 90deg,
56
- var(--_material-text-field-input-line-background-color, #000) 0,
57
- var(--_material-text-field-input-line-background-color, #000) 2px,
58
- transparent 2px
59
- );
60
- background-size: 4px 1px;
61
- background-repeat: repeat-x;
62
- }
63
-
64
- :host([disabled]) ::slotted(:not([slot$='fix'])) {
65
- color: var(--material-disabled-text-color);
66
- -webkit-text-fill-color: var(--material-disabled-text-color);
67
- }
68
-
69
- /* Invalid */
70
- :host([invalid])::after {
71
- background-color: var(--material-error-color);
72
- opacity: 1;
73
- transform: none;
74
- transition:
75
- transform 0.175s,
76
- opacity 0.175s;
77
- }
78
- `,
79
- { moduleId: 'material-input-container' },
80
- );
@@ -1,2 +0,0 @@
1
- import './vaadin-input-container-styles.js';
2
- import '../../src/vaadin-input-container.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-input-container-styles.js';
2
- import '../../src/vaadin-input-container.js';