@vaadin/custom-field 25.0.0-alpha9 → 25.0.0-beta2

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/custom-field",
3
- "version": "25.0.0-alpha9",
3
+ "version": "25.0.0-beta2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,9 +21,6 @@
21
21
  "type": "module",
22
22
  "files": [
23
23
  "src",
24
- "!src/styles/*-base-styles.d.ts",
25
- "!src/styles/*-base-styles.js",
26
- "theme",
27
24
  "vaadin-*.d.ts",
28
25
  "vaadin-*.js",
29
26
  "web-types.json",
@@ -37,32 +34,32 @@
37
34
  ],
38
35
  "dependencies": {
39
36
  "@open-wc/dedupe-mixin": "^1.3.0",
40
- "@vaadin/a11y-base": "25.0.0-alpha9",
41
- "@vaadin/component-base": "25.0.0-alpha9",
42
- "@vaadin/field-base": "25.0.0-alpha9",
43
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha9",
44
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha9",
37
+ "@vaadin/a11y-base": "25.0.0-beta2",
38
+ "@vaadin/component-base": "25.0.0-beta2",
39
+ "@vaadin/field-base": "25.0.0-beta2",
40
+ "@vaadin/vaadin-themable-mixin": "25.0.0-beta2",
45
41
  "lit": "^3.0.0"
46
42
  },
47
43
  "devDependencies": {
48
- "@vaadin/chai-plugins": "25.0.0-alpha9",
49
- "@vaadin/combo-box": "25.0.0-alpha9",
50
- "@vaadin/date-picker": "25.0.0-alpha9",
51
- "@vaadin/email-field": "25.0.0-alpha9",
52
- "@vaadin/form-layout": "25.0.0-alpha9",
53
- "@vaadin/number-field": "25.0.0-alpha9",
54
- "@vaadin/password-field": "25.0.0-alpha9",
55
- "@vaadin/select": "25.0.0-alpha9",
56
- "@vaadin/test-runner-commands": "25.0.0-alpha9",
44
+ "@vaadin/chai-plugins": "25.0.0-beta2",
45
+ "@vaadin/combo-box": "25.0.0-beta2",
46
+ "@vaadin/date-picker": "25.0.0-beta2",
47
+ "@vaadin/email-field": "25.0.0-beta2",
48
+ "@vaadin/form-layout": "25.0.0-beta2",
49
+ "@vaadin/number-field": "25.0.0-beta2",
50
+ "@vaadin/password-field": "25.0.0-beta2",
51
+ "@vaadin/select": "25.0.0-beta2",
52
+ "@vaadin/test-runner-commands": "25.0.0-beta2",
57
53
  "@vaadin/testing-helpers": "^2.0.0",
58
- "@vaadin/text-area": "25.0.0-alpha9",
59
- "@vaadin/text-field": "25.0.0-alpha9",
60
- "@vaadin/time-picker": "25.0.0-alpha9",
61
- "sinon": "^18.0.0"
54
+ "@vaadin/text-area": "25.0.0-beta2",
55
+ "@vaadin/text-field": "25.0.0-beta2",
56
+ "@vaadin/time-picker": "25.0.0-beta2",
57
+ "@vaadin/vaadin-lumo-styles": "25.0.0-beta2",
58
+ "sinon": "^21.0.0"
62
59
  },
63
60
  "web-types": [
64
61
  "web-types.json",
65
62
  "web-types.lit.json"
66
63
  ],
67
- "gitHead": "bbe4720721e0955ffc87a79b412bee38b1f0eb1e"
64
+ "gitHead": "e078f8371ae266f05c7ca1ec25686cc489c83f24"
68
65
  }
@@ -144,10 +144,14 @@ export const CustomFieldMixin = (superClass) =>
144
144
  });
145
145
  }
146
146
 
147
- /** @protected */
148
- focus() {
147
+ /**
148
+ * @param {FocusOptions=} options
149
+ * @protected
150
+ * @override
151
+ */
152
+ focus(options) {
149
153
  if (this.inputs && this.inputs[0]) {
150
- this.inputs[0].focus();
154
+ this.inputs[0].focus(options);
151
155
  }
152
156
  }
153
157
 
@@ -67,14 +67,15 @@ export interface CustomFieldEventMap extends HTMLElementEventMap, CustomFieldCus
67
67
  *
68
68
  * The following state attributes are available for styling:
69
69
  *
70
- * Attribute | Description | Part name
71
- * --------------------|-------------------------------------------|------------
72
- * `invalid` | Set when the element is invalid | :host
73
- * `focused` | Set when the element is focused | :host
74
- * `has-label` | Set when the element has a label | :host
75
- * `has-value` | Set when the element has a value | :host
76
- * `has-helper` | Set when the element has helper text | :host
77
- * `has-error-message` | Set when the element has an error message | :host
70
+ * Attribute | Description
71
+ * --------------------|--------------------------------
72
+ * `invalid` | Set when the element is invalid
73
+ * `focused` | Set when the element is focused
74
+ * `has-label` | Set when the element has a label
75
+ * `has-value` | Set when the element has a value
76
+ * `has-helper` | Set when the element has helper text
77
+ * `has-error-message` | Set when the element has an error message
78
+ * `has-tooltip` | Set when the element has a slotted tooltip
78
79
  *
79
80
  * You may also manually set `disabled` or `readonly` attribute on this component to make the label
80
81
  * part look visually the same as on a `<vaadin-text-field>` when it is disabled or readonly.
@@ -9,7 +9,7 @@ import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
9
9
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
10
  import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
11
11
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
12
- import { customFieldStyles } from './styles/vaadin-custom-field-core-styles.js';
12
+ import { customFieldStyles } from './styles/vaadin-custom-field-base-styles.js';
13
13
  import { CustomFieldMixin } from './vaadin-custom-field-mixin.js';
14
14
 
15
15
  /**
@@ -36,14 +36,15 @@ import { CustomFieldMixin } from './vaadin-custom-field-mixin.js';
36
36
  *
37
37
  * The following state attributes are available for styling:
38
38
  *
39
- * Attribute | Description | Part name
40
- * --------------------|-------------------------------------------|------------
41
- * `invalid` | Set when the element is invalid | :host
42
- * `focused` | Set when the element is focused | :host
43
- * `has-label` | Set when the element has a label | :host
44
- * `has-value` | Set when the element has a value | :host
45
- * `has-helper` | Set when the element has helper text | :host
46
- * `has-error-message` | Set when the element has an error message | :host
39
+ * Attribute | Description
40
+ * --------------------|--------------------------------
41
+ * `invalid` | Set when the element is invalid
42
+ * `focused` | Set when the element is focused
43
+ * `has-label` | Set when the element has a label
44
+ * `has-value` | Set when the element has a value
45
+ * `has-helper` | Set when the element has helper text
46
+ * `has-error-message` | Set when the element has an error message
47
+ * `has-tooltip` | Set when the element has a slotted tooltip
47
48
  *
48
49
  * You may also manually set `disabled` or `readonly` attribute on this component to make the label
49
50
  * part look visually the same as on a `<vaadin-text-field>` when it is disabled or readonly.
@@ -1,3 +1,3 @@
1
- import './theme/lumo/vaadin-custom-field.js';
1
+ import './src/vaadin-custom-field.js';
2
2
 
3
3
  export * from './src/vaadin-custom-field.js';
package/web-types.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/custom-field",
4
- "version": "25.0.0-alpha9",
4
+ "version": "25.0.0-beta2",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "vaadin-custom-field",
11
- "description": "`<vaadin-custom-field>` is a web component for wrapping multiple components as a single field.\n\n```html\n<vaadin-custom-field label=\"Appointment time\">\n <vaadin-date-picker></vaadin-date-picker>\n <vaadin-time-picker></vaadin-time-picker>\n</vaadin-custom-field>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The slotted label element wrapper\n`helper-text` | The slotted helper text element wrapper\n`error-message` | The slotted error message element wrapper\n`required-indicator` | The `required` state indicator element\n`input-fields` | The slotted input elements wrapper\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n--------------------|-------------------------------------------|------------\n`invalid` | Set when the element is invalid | :host\n`focused` | Set when the element is focused | :host\n`has-label` | Set when the element has a label | :host\n`has-value` | Set when the element has a value | :host\n`has-helper` | Set when the element has helper text | :host\n`has-error-message` | Set when the element has an error message | :host\n\nYou may also manually set `disabled` or `readonly` attribute on this component to make the label\npart look visually the same as on a `<vaadin-text-field>` when it is disabled or readonly.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
11
+ "description": "`<vaadin-custom-field>` is a web component for wrapping multiple components as a single field.\n\n```html\n<vaadin-custom-field label=\"Appointment time\">\n <vaadin-date-picker></vaadin-date-picker>\n <vaadin-time-picker></vaadin-time-picker>\n</vaadin-custom-field>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The slotted label element wrapper\n`helper-text` | The slotted helper text element wrapper\n`error-message` | The slotted error message element wrapper\n`required-indicator` | The `required` state indicator element\n`input-fields` | The slotted input elements wrapper\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n--------------------|--------------------------------\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`has-label` | Set when the element has a label\n`has-value` | Set when the element has a value\n`has-helper` | Set when the element has helper text\n`has-error-message` | Set when the element has an error message\n`has-tooltip` | Set when the element has a slotted tooltip\n\nYou may also manually set `disabled` or `readonly` attribute on this component to make the label\npart look visually the same as on a `<vaadin-text-field>` when it is disabled or readonly.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "label",
@@ -111,7 +111,7 @@
111
111
  },
112
112
  {
113
113
  "name": "value",
114
- "description": "The value of the field. When wrapping several inputs, it will contain `\\t`\n(Tab character) as a delimiter indicating parts intended to be used as the\ncorresponding inputs values.\nUse the [`formatValue`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha9/#/elements/vaadin-custom-field#property-formatValue)\nand [`parseValue`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha9/#/elements/vaadin-custom-field#property-parseValue)\nproperties to customize this behavior.",
114
+ "description": "The value of the field. When wrapping several inputs, it will contain `\\t`\n(Tab character) as a delimiter indicating parts intended to be used as the\ncorresponding inputs values.\nUse the [`formatValue`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta2/#/elements/vaadin-custom-field#property-formatValue)\nand [`parseValue`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta2/#/elements/vaadin-custom-field#property-parseValue)\nproperties to customize this behavior.",
115
115
  "value": {
116
116
  "type": [
117
117
  "string",
@@ -235,7 +235,7 @@
235
235
  },
236
236
  {
237
237
  "name": "value",
238
- "description": "The value of the field. When wrapping several inputs, it will contain `\\t`\n(Tab character) as a delimiter indicating parts intended to be used as the\ncorresponding inputs values.\nUse the [`formatValue`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha9/#/elements/vaadin-custom-field#property-formatValue)\nand [`parseValue`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha9/#/elements/vaadin-custom-field#property-parseValue)\nproperties to customize this behavior.",
238
+ "description": "The value of the field. When wrapping several inputs, it will contain `\\t`\n(Tab character) as a delimiter indicating parts intended to be used as the\ncorresponding inputs values.\nUse the [`formatValue`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta2/#/elements/vaadin-custom-field#property-formatValue)\nand [`parseValue`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta2/#/elements/vaadin-custom-field#property-parseValue)\nproperties to customize this behavior.",
239
239
  "value": {
240
240
  "type": [
241
241
  "string",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/custom-field",
4
- "version": "25.0.0-alpha9",
4
+ "version": "25.0.0-beta2",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -16,7 +16,7 @@
16
16
  "elements": [
17
17
  {
18
18
  "name": "vaadin-custom-field",
19
- "description": "`<vaadin-custom-field>` is a web component for wrapping multiple components as a single field.\n\n```html\n<vaadin-custom-field label=\"Appointment time\">\n <vaadin-date-picker></vaadin-date-picker>\n <vaadin-time-picker></vaadin-time-picker>\n</vaadin-custom-field>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The slotted label element wrapper\n`helper-text` | The slotted helper text element wrapper\n`error-message` | The slotted error message element wrapper\n`required-indicator` | The `required` state indicator element\n`input-fields` | The slotted input elements wrapper\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n--------------------|-------------------------------------------|------------\n`invalid` | Set when the element is invalid | :host\n`focused` | Set when the element is focused | :host\n`has-label` | Set when the element has a label | :host\n`has-value` | Set when the element has a value | :host\n`has-helper` | Set when the element has helper text | :host\n`has-error-message` | Set when the element has an error message | :host\n\nYou may also manually set `disabled` or `readonly` attribute on this component to make the label\npart look visually the same as on a `<vaadin-text-field>` when it is disabled or readonly.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
19
+ "description": "`<vaadin-custom-field>` is a web component for wrapping multiple components as a single field.\n\n```html\n<vaadin-custom-field label=\"Appointment time\">\n <vaadin-date-picker></vaadin-date-picker>\n <vaadin-time-picker></vaadin-time-picker>\n</vaadin-custom-field>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The slotted label element wrapper\n`helper-text` | The slotted helper text element wrapper\n`error-message` | The slotted error message element wrapper\n`required-indicator` | The `required` state indicator element\n`input-fields` | The slotted input elements wrapper\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n--------------------|--------------------------------\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`has-label` | Set when the element has a label\n`has-value` | Set when the element has a value\n`has-helper` | Set when the element has helper text\n`has-error-message` | Set when the element has an error message\n`has-tooltip` | Set when the element has a slotted tooltip\n\nYou may also manually set `disabled` or `readonly` attribute on this component to make the label\npart look visually the same as on a `<vaadin-text-field>` when it is disabled or readonly.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {
@@ -84,7 +84,7 @@
84
84
  },
85
85
  {
86
86
  "name": ".value",
87
- "description": "The value of the field. When wrapping several inputs, it will contain `\\t`\n(Tab character) as a delimiter indicating parts intended to be used as the\ncorresponding inputs values.\nUse the [`formatValue`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha9/#/elements/vaadin-custom-field#property-formatValue)\nand [`parseValue`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha9/#/elements/vaadin-custom-field#property-parseValue)\nproperties to customize this behavior.",
87
+ "description": "The value of the field. When wrapping several inputs, it will contain `\\t`\n(Tab character) as a delimiter indicating parts intended to be used as the\ncorresponding inputs values.\nUse the [`formatValue`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta2/#/elements/vaadin-custom-field#property-formatValue)\nand [`parseValue`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta2/#/elements/vaadin-custom-field#property-parseValue)\nproperties to customize this behavior.",
88
88
  "value": {
89
89
  "kind": "expression"
90
90
  }
@@ -1,8 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2019 - 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 customFieldStyles: CSSResult;
@@ -1,34 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2019 - 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 customFieldStyles = css`
9
- :host {
10
- display: inline-flex;
11
- }
12
-
13
- :host::before {
14
- content: '\\2003';
15
- width: 0;
16
- display: inline-block;
17
- /* Size and position this element on the same vertical position as the input-field element
18
- to make vertical align for the host element work as expected */
19
- }
20
-
21
- :host([hidden]) {
22
- display: none !important;
23
- }
24
-
25
- .vaadin-custom-field-container {
26
- width: 100%;
27
- display: flex;
28
- flex-direction: column;
29
- }
30
-
31
- .inputs-wrapper {
32
- flex: none;
33
- }
34
- `;
@@ -1,11 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2019 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import '@vaadin/vaadin-lumo-styles/color.js';
7
- import '@vaadin/vaadin-lumo-styles/sizing.js';
8
- import '@vaadin/vaadin-lumo-styles/spacing.js';
9
- import '@vaadin/vaadin-lumo-styles/typography.js';
10
- declare const customField: import("lit").CSSResult;
11
- export { customField };
@@ -1,97 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2019 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import '@vaadin/vaadin-lumo-styles/color.js';
7
- import '@vaadin/vaadin-lumo-styles/sizing.js';
8
- import '@vaadin/vaadin-lumo-styles/spacing.js';
9
- import '@vaadin/vaadin-lumo-styles/typography.js';
10
- import { helper } from '@vaadin/vaadin-lumo-styles/mixins/helper.js';
11
- import { requiredField } from '@vaadin/vaadin-lumo-styles/mixins/required-field.js';
12
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
13
-
14
- const customField = css`
15
- :host {
16
- --lumo-text-field-size: var(--lumo-size-m);
17
- color: var(--lumo-body-text-color);
18
- font-size: var(--lumo-font-size-m);
19
- /* align with text-field height + vertical paddings */
20
- line-height: calc(var(--lumo-text-field-size) + 2 * var(--lumo-space-xs));
21
- font-family: var(--lumo-font-family);
22
- -webkit-font-smoothing: antialiased;
23
- -moz-osx-font-smoothing: grayscale;
24
- -webkit-tap-highlight-color: transparent;
25
- padding: 0;
26
- }
27
-
28
- :host::before {
29
- margin-top: var(--lumo-space-xs);
30
- height: var(--lumo-text-field-size);
31
- box-sizing: border-box;
32
- display: inline-flex;
33
- align-items: center;
34
- }
35
-
36
- /* align with text-field label */
37
- :host([has-label]) [part='label'] {
38
- padding-bottom: calc(0.5em - var(--lumo-space-xs));
39
- }
40
-
41
- :host(:not([has-label])) [part='label'],
42
- :host(:not([has-label]))::before {
43
- display: none;
44
- }
45
-
46
- /* align with text-field error message */
47
- :host([has-error-message]) [part='error-message']::before {
48
- height: calc(0.4em - var(--lumo-space-xs));
49
- }
50
-
51
- :host([focused]:not([readonly]):not([disabled])) [part='label'] {
52
- color: var(--lumo-primary-text-color);
53
- }
54
-
55
- :host(:hover:not([readonly]):not([disabled]):not([focused])) [part='label'],
56
- :host(:hover:not([readonly]):not([disabled]):not([focused])) [part='helper-text'] {
57
- color: var(--lumo-body-text-color);
58
- }
59
-
60
- /* Touch device adjustment */
61
- @media (pointer: coarse) {
62
- :host(:hover:not([readonly]):not([disabled]):not([focused])) [part='label'] {
63
- color: var(--lumo-secondary-text-color);
64
- }
65
- }
66
-
67
- /* Disabled */
68
- :host([disabled]) [part='label'] {
69
- color: var(--lumo-disabled-text-color);
70
- -webkit-text-fill-color: var(--lumo-disabled-text-color);
71
- }
72
-
73
- /* Small theme */
74
- :host([theme~='small']) {
75
- font-size: var(--lumo-font-size-s);
76
- --lumo-text-field-size: var(--lumo-size-s);
77
- }
78
-
79
- :host([theme~='small'][has-label]) [part='label'] {
80
- font-size: var(--lumo-font-size-xs);
81
- }
82
-
83
- :host([theme~='small'][has-label]) [part='error-message'] {
84
- font-size: var(--lumo-font-size-xxs);
85
- }
86
-
87
- /* When custom-field is used with components without outer margin */
88
- :host([theme~='whitespace'][has-label]) [part='label'] {
89
- padding-bottom: 0.5em;
90
- }
91
- `;
92
-
93
- registerStyles('vaadin-custom-field', [requiredField, helper, customField], {
94
- moduleId: 'lumo-custom-field',
95
- });
96
-
97
- export { customField };
@@ -1,7 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2019 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import './vaadin-custom-field-styles.js';
7
- import '../../src/vaadin-custom-field.js';
@@ -1,7 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2019 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import './vaadin-custom-field-styles.js';
7
- import '../../src/vaadin-custom-field.js';