@vaadin/input-container 24.2.0-beta3 → 24.2.0-beta4

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.2.0-beta3",
3
+ "version": "24.2.0-beta4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,7 +21,6 @@
21
21
  "type": "module",
22
22
  "files": [
23
23
  "src",
24
- "!src/vaadin-lit-input-container.js",
25
24
  "theme",
26
25
  "vaadin-*.d.ts",
27
26
  "vaadin-*.js"
@@ -33,17 +32,17 @@
33
32
  ],
34
33
  "dependencies": {
35
34
  "@polymer/polymer": "^3.0.0",
36
- "@vaadin/component-base": "24.2.0-beta3",
37
- "@vaadin/vaadin-lumo-styles": "24.2.0-beta3",
38
- "@vaadin/vaadin-material-styles": "24.2.0-beta3",
39
- "@vaadin/vaadin-themable-mixin": "24.2.0-beta3"
35
+ "@vaadin/component-base": "24.2.0-beta4",
36
+ "@vaadin/vaadin-lumo-styles": "24.2.0-beta4",
37
+ "@vaadin/vaadin-material-styles": "24.2.0-beta4",
38
+ "@vaadin/vaadin-themable-mixin": "24.2.0-beta4"
40
39
  },
41
40
  "devDependencies": {
42
41
  "@esm-bundle/chai": "^4.3.4",
43
- "@vaadin/icon": "24.2.0-beta3",
44
- "@vaadin/icons": "24.2.0-beta3",
42
+ "@vaadin/icon": "24.2.0-beta4",
43
+ "@vaadin/icons": "24.2.0-beta4",
45
44
  "@vaadin/testing-helpers": "^0.5.0",
46
45
  "sinon": "^13.0.2"
47
46
  },
48
- "gitHead": "91ea11e7ad706065340acdb93b92316919ce5e69"
47
+ "gitHead": "04da1e1e5c5713ea45e4b7d659dc6ac6b4604f4c"
49
48
  }
@@ -6,31 +6,143 @@
6
6
  import { html, PolymerElement } from '@polymer/polymer';
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 { InputContainerMixin } from './vaadin-input-container-mixin.js';
11
- import { inputContainerStyles } from './vaadin-input-container-styles.js';
12
-
13
- registerStyles('vaadin-input-container', inputContainerStyles, { moduleId: 'vaadin-input-container-styles' });
9
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
14
10
 
15
11
  /**
16
12
  * @customElement
17
13
  * @extends HTMLElement
18
14
  * @mixes ThemableMixin
19
15
  * @mixes DirMixin
20
- * @mixes InputContainerMixin
21
16
  */
22
- export class InputContainer extends InputContainerMixin(ThemableMixin(DirMixin(PolymerElement))) {
17
+ export class InputContainer extends ThemableMixin(DirMixin(PolymerElement)) {
23
18
  static get is() {
24
19
  return 'vaadin-input-container';
25
20
  }
26
21
 
27
22
  static get template() {
28
23
  return html`
24
+ <style>
25
+ :host {
26
+ display: flex;
27
+ align-items: center;
28
+ flex: 0 1 auto;
29
+ border-radius:
30
+ /* See https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius */
31
+ var(--vaadin-input-field-top-start-radius, var(--__border-radius))
32
+ var(--vaadin-input-field-top-end-radius, var(--__border-radius))
33
+ var(--vaadin-input-field-bottom-end-radius, var(--__border-radius))
34
+ var(--vaadin-input-field-bottom-start-radius, var(--__border-radius));
35
+ --_border-radius: var(--vaadin-input-field-border-radius, 0px);
36
+ --_input-border-width: var(--vaadin-input-field-border-width, 0);
37
+ --_input-border-color: var(--vaadin-input-field-border-color, transparent);
38
+ box-shadow: inset 0 0 0 var(--_input-border-width, 0) var(--_input-border-color);
39
+ }
40
+
41
+ :host([dir='rtl']) {
42
+ border-radius:
43
+ /* Don't use logical props, see https://github.com/vaadin/vaadin-time-picker/issues/145 */
44
+ var(--vaadin-input-field-top-end-radius, var(--_border-radius))
45
+ var(--vaadin-input-field-top-start-radius, var(--_border-radius))
46
+ var(--vaadin-input-field-bottom-start-radius, var(--_border-radius))
47
+ var(--vaadin-input-field-bottom-end-radius, var(--_border-radius));
48
+ }
49
+
50
+ :host([hidden]) {
51
+ display: none !important;
52
+ }
53
+
54
+ /* Reset the native input styles */
55
+ ::slotted(input) {
56
+ -webkit-appearance: none;
57
+ -moz-appearance: none;
58
+ flex: auto;
59
+ white-space: nowrap;
60
+ overflow: hidden;
61
+ width: 100%;
62
+ height: 100%;
63
+ outline: none;
64
+ margin: 0;
65
+ padding: 0;
66
+ border: 0;
67
+ border-radius: 0;
68
+ min-width: 0;
69
+ font: inherit;
70
+ line-height: normal;
71
+ color: inherit;
72
+ background-color: transparent;
73
+ /* Disable default invalid style in Firefox */
74
+ box-shadow: none;
75
+ }
76
+
77
+ ::slotted(*) {
78
+ flex: none;
79
+ }
80
+
81
+ ::slotted(:is(input, textarea))::placeholder {
82
+ /* Use ::slotted(input:placeholder-shown) in themes to style the placeholder. */
83
+ /* because ::slotted(...)::placeholder does not work in Safari. */
84
+ font: inherit;
85
+ color: inherit;
86
+ /* Override default opacity in Firefox */
87
+ opacity: 1;
88
+ }
89
+ </style>
29
90
  <slot name="prefix"></slot>
30
91
  <slot></slot>
31
92
  <slot name="suffix"></slot>
32
93
  `;
33
94
  }
95
+
96
+ static get properties() {
97
+ return {
98
+ /**
99
+ * If true, the user cannot interact with this element.
100
+ */
101
+ disabled: {
102
+ type: Boolean,
103
+ reflectToAttribute: true,
104
+ },
105
+
106
+ /**
107
+ * Set to true to make this element read-only.
108
+ */
109
+ readonly: {
110
+ type: Boolean,
111
+ reflectToAttribute: true,
112
+ },
113
+
114
+ /**
115
+ * Set to true when the element is invalid.
116
+ */
117
+ invalid: {
118
+ type: Boolean,
119
+ reflectToAttribute: true,
120
+ },
121
+ };
122
+ }
123
+
124
+ /** @protected */
125
+ ready() {
126
+ super.ready();
127
+
128
+ this.addEventListener('pointerdown', (event) => {
129
+ if (event.target === this) {
130
+ // Prevent direct clicks to the input container from blurring the input
131
+ event.preventDefault();
132
+ }
133
+ });
134
+
135
+ this.addEventListener('click', (event) => {
136
+ if (event.target === this) {
137
+ // The vaadin-input-container element was directly clicked,
138
+ // focus any focusable child element from the default slot
139
+ this.shadowRoot
140
+ .querySelector('slot:not([name])')
141
+ .assignedNodes({ flatten: true })
142
+ .forEach((node) => node.focus && node.focus());
143
+ }
144
+ });
145
+ }
34
146
  }
35
147
 
36
148
  defineCustomElement(InputContainer);
@@ -1,62 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2021 - 2023 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,73 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2021 - 2023 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 inputContainerStyles = css`
9
- :host {
10
- display: flex;
11
- align-items: center;
12
- flex: 0 1 auto;
13
- border-radius:
14
- /* See https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius */
15
- var(--vaadin-input-field-top-start-radius, var(--__border-radius))
16
- var(--vaadin-input-field-top-end-radius, var(--__border-radius))
17
- var(--vaadin-input-field-bottom-end-radius, var(--__border-radius))
18
- var(--vaadin-input-field-bottom-start-radius, var(--__border-radius));
19
- --_border-radius: var(--vaadin-input-field-border-radius, 0);
20
- --_input-border-width: var(--vaadin-input-field-border-width, 0);
21
- --_input-border-color: var(--vaadin-input-field-border-color, transparent);
22
- box-shadow: inset 0 0 0 var(--_input-border-width, 0) var(--_input-border-color);
23
- }
24
-
25
- :host([dir='rtl']) {
26
- border-radius:
27
- /* Don't use logical props, see https://github.com/vaadin/vaadin-time-picker/issues/145 */
28
- var(--vaadin-input-field-top-end-radius, var(--_border-radius))
29
- var(--vaadin-input-field-top-start-radius, var(--_border-radius))
30
- var(--vaadin-input-field-bottom-start-radius, var(--_border-radius))
31
- var(--vaadin-input-field-bottom-end-radius, var(--_border-radius));
32
- }
33
-
34
- :host([hidden]) {
35
- display: none !important;
36
- }
37
-
38
- /* Reset the native input styles */
39
- ::slotted(input) {
40
- -webkit-appearance: none;
41
- -moz-appearance: none;
42
- flex: auto;
43
- white-space: nowrap;
44
- overflow: hidden;
45
- width: 100%;
46
- height: 100%;
47
- outline: none;
48
- margin: 0;
49
- padding: 0;
50
- border: 0;
51
- border-radius: 0;
52
- min-width: 0;
53
- font: inherit;
54
- line-height: normal;
55
- color: inherit;
56
- background-color: transparent;
57
- /* Disable default invalid style in Firefox */
58
- box-shadow: none;
59
- }
60
-
61
- ::slotted(*) {
62
- flex: none;
63
- }
64
-
65
- ::slotted(:is(input, textarea))::placeholder {
66
- /* Use ::slotted(input:placeholder-shown) in themes to style the placeholder. */
67
- /* because ::slotted(...)::placeholder does not work in Safari. */
68
- font: inherit;
69
- color: inherit;
70
- /* Override default opacity in Firefox */
71
- opacity: 1;
72
- }
73
- `;