@vaadin/custom-field 22.0.0-alpha9 → 22.0.0

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/README.md CHANGED
@@ -1,5 +1,66 @@
1
1
  # @vaadin/custom-field
2
2
 
3
- > ⚠️ Work in progress, please do not use this component yet.
3
+ A web component for wrapping multiple components as a single field.
4
4
 
5
- The new version of `vaadin-custom-field` component.
5
+ [Documentation + Live Demo ↗](https://vaadin.com/docs/latest/ds/components/custom-field)
6
+
7
+ [![npm version](https://badgen.net/npm/v/@vaadin/custom-field)](https://www.npmjs.com/package/@vaadin/custom-field)
8
+ [![Discord](https://img.shields.io/discord/732335336448852018?label=discord)](https://discord.gg/PHmkCKC)
9
+
10
+ ```html
11
+ <vaadin-custom-field label="Enrollment period" helper-text="Cannot be longer than 30 days" required>
12
+ <vaadin-date-picker id="start" placeholder="Start date"></vaadin-date-picker>
13
+ &ndash;
14
+ <vaadin-date-picker id="end" placeholder="End date"></vaadin-date-picker>
15
+ </vaadin-custom-field>
16
+ ```
17
+
18
+ [<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/custom-field/screenshot.png" width="401" alt="Screenshot of vaadin-custom-field">](https://vaadin.com/docs/latest/ds/components/custom-field)
19
+
20
+ ## Installation
21
+
22
+ Install the component:
23
+
24
+ ```sh
25
+ npm i @vaadin/custom-field
26
+ ```
27
+
28
+ Once installed, import the component in your application:
29
+
30
+ ```js
31
+ import '@vaadin/custom-field';
32
+ ```
33
+
34
+ ## Themes
35
+
36
+ Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/ds/customization/using-themes), Lumo and Material.
37
+ The [main entrypoint](https://github.com/vaadin/web-components/blob/master/packages/custom-field/vaadin-custom-field.js) of the package uses the Lumo theme.
38
+
39
+ To use the Material theme, import the component from the `theme/material` folder:
40
+
41
+ ```js
42
+ import '@vaadin/custom-field/theme/material/vaadin-custom-field.js';
43
+ ```
44
+
45
+ You can also import the Lumo version of the component explicitly:
46
+
47
+ ```js
48
+ import '@vaadin/custom-field/theme/lumo/vaadin-custom-field.js';
49
+ ```
50
+
51
+ Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
52
+
53
+ ```js
54
+ import '@vaadin/custom-field/src/vaadin-custom-field.js';
55
+ ```
56
+
57
+ ## Contributing
58
+
59
+ Read the [contributing guide](https://vaadin.com/docs/latest/guide/contributing/overview) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
60
+
61
+ ## License
62
+
63
+ Apache License 2.0
64
+
65
+ Vaadin collects usage statistics at development time to improve this product.
66
+ For details and to opt-out, see https://github.com/vaadin/vaadin-usage-statistics.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/custom-field",
3
- "version": "22.0.0-alpha9",
3
+ "version": "22.0.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,28 +32,28 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@polymer/polymer": "^3.0.0",
35
- "@vaadin/component-base": "22.0.0-alpha9",
36
- "@vaadin/field-base": "22.0.0-alpha9",
37
- "@vaadin/vaadin-lumo-styles": "22.0.0-alpha9",
38
- "@vaadin/vaadin-material-styles": "22.0.0-alpha9",
39
- "@vaadin/vaadin-themable-mixin": "22.0.0-alpha9"
35
+ "@vaadin/component-base": "^22.0.0",
36
+ "@vaadin/field-base": "^22.0.0",
37
+ "@vaadin/vaadin-lumo-styles": "^22.0.0",
38
+ "@vaadin/vaadin-material-styles": "^22.0.0",
39
+ "@vaadin/vaadin-themable-mixin": "^22.0.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@esm-bundle/chai": "^4.3.4",
43
- "@vaadin/combo-box": "22.0.0-alpha9",
44
- "@vaadin/date-picker": "22.0.0-alpha9",
45
- "@vaadin/email-field": "22.0.0-alpha9",
46
- "@vaadin/form-layout": "22.0.0-alpha9",
47
- "@vaadin/list-box": "22.0.0-alpha9",
48
- "@vaadin/number-field": "22.0.0-alpha9",
49
- "@vaadin/password-field": "22.0.0-alpha9",
50
- "@vaadin/polymer-legacy-adapter": "22.0.0-alpha9",
51
- "@vaadin/select": "22.0.0-alpha9",
52
- "@vaadin/testing-helpers": "^0.3.0",
53
- "@vaadin/text-area": "22.0.0-alpha9",
54
- "@vaadin/text-field": "22.0.0-alpha9",
55
- "@vaadin/time-picker": "22.0.0-alpha9",
43
+ "@vaadin/combo-box": "^22.0.0",
44
+ "@vaadin/date-picker": "^22.0.0",
45
+ "@vaadin/email-field": "^22.0.0",
46
+ "@vaadin/form-layout": "^22.0.0",
47
+ "@vaadin/list-box": "^22.0.0",
48
+ "@vaadin/number-field": "^22.0.0",
49
+ "@vaadin/password-field": "^22.0.0",
50
+ "@vaadin/polymer-legacy-adapter": "^22.0.0",
51
+ "@vaadin/select": "^22.0.0",
52
+ "@vaadin/testing-helpers": "^0.3.2",
53
+ "@vaadin/text-area": "^22.0.0",
54
+ "@vaadin/text-field": "^22.0.0",
55
+ "@vaadin/time-picker": "^22.0.0",
56
56
  "sinon": "^9.2.1"
57
57
  },
58
- "gitHead": "6e8c899dc65918f97e3c0acb2076122c4b2ef274"
58
+ "gitHead": "b668e9b1a975227fbe34beb70d1cd5b03dce2348"
59
59
  }
@@ -48,9 +48,6 @@ export interface CustomFieldEventMap extends HTMLElementEventMap, CustomFieldCus
48
48
  *
49
49
  * ### Styling
50
50
  *
51
- * You may set the attribute `disabled` or `readonly` on this component to make the label styles
52
- * behave the same way as they would on a `<vaadin-text-field>` which is disabled or readonly.
53
- *
54
51
  * The following shadow DOM parts are available for styling:
55
52
  *
56
53
  * Part name | Description
@@ -3,8 +3,9 @@
3
3
  * Copyright (c) 2021 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
7
6
  import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
7
+ import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
8
+ import { isChrome } from '@vaadin/component-base/src/browser-utils.js';
8
9
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
9
10
  import { FocusMixin } from '@vaadin/component-base/src/focus-mixin.js';
10
11
  import { FieldMixin } from '@vaadin/field-base/src/field-mixin.js';
@@ -22,9 +23,6 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
22
23
  *
23
24
  * ### Styling
24
25
  *
25
- * You may set the attribute `disabled` or `readonly` on this component to make the label styles
26
- * behave the same way as they would on a `<vaadin-text-field>` which is disabled or readonly.
27
- *
28
26
  * The following shadow DOM parts are available for styling:
29
27
  *
30
28
  * Part name | Description
@@ -191,14 +189,6 @@ class CustomField extends FieldMixin(FocusMixin(ThemableMixin(ElementMixin(Polym
191
189
  };
192
190
  }
193
191
 
194
- /**
195
- * Attribute used by `FieldAriaMixin` to set accessible name.
196
- * @protected
197
- */
198
- get _ariaAttr() {
199
- return 'aria-labelledby';
200
- }
201
-
202
192
  /** @protected */
203
193
  connectedCallback() {
204
194
  super.connectedCallback();
@@ -282,7 +272,6 @@ class CustomField extends FieldMixin(FocusMixin(ThemableMixin(ElementMixin(Polym
282
272
 
283
273
  /** @private */
284
274
  __fixChromeFocus() {
285
- const isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
286
275
  this.addEventListener('keydown', (e) => {
287
276
  if (e.keyCode === 9) {
288
277
  // FIXME(yuriy): remove this workaround once this issue is fixed:
@@ -3,13 +3,13 @@
3
3
  * Copyright (c) 2021 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
7
6
  import '@vaadin/vaadin-lumo-styles/color.js';
8
7
  import '@vaadin/vaadin-lumo-styles/sizing.js';
9
8
  import '@vaadin/vaadin-lumo-styles/spacing.js';
10
9
  import '@vaadin/vaadin-lumo-styles/typography.js';
11
10
  import { helper } from '@vaadin/vaadin-lumo-styles/mixins/helper.js';
12
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
13
 
14
14
  const customField = css`
15
15
  :host {
@@ -3,11 +3,11 @@
3
3
  * Copyright (c) 2021 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
7
6
  import '@vaadin/vaadin-material-styles/color.js';
8
7
  import '@vaadin/vaadin-material-styles/typography.js';
9
8
  import { helper } from '@vaadin/vaadin-material-styles/mixins/helper.js';
10
9
  import { requiredField } from '@vaadin/vaadin-material-styles/mixins/required-field.js';
10
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
11
 
12
12
  const customField = css`
13
13
  :host {