@vaadin/checkbox 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
@@ -2,18 +2,25 @@
2
2
 
3
3
  An input field representing a binary choice.
4
4
 
5
- [Live Demo ↗](https://vaadin.com/docs/latest/ds/components/checkbox)
5
+ [Documentation + Live Demo ↗](https://vaadin.com/docs/latest/ds/components/checkbox)
6
+
7
+ [![npm version](https://badgen.net/npm/v/@vaadin/checkbox)](https://www.npmjs.com/package/@vaadin/checkbox)
8
+ [![Discord](https://img.shields.io/discord/732335336448852018?label=discord)](https://discord.gg/PHmkCKC)
6
9
 
7
10
  ```html
8
- <vaadin-checkbox>I accept the terms and conditions</vaadin-checkbox>
11
+ <vaadin-checkbox label="Checked" checked></vaadin-checkbox>
12
+ <vaadin-checkbox label="Unchecked"></vaadin-checkbox>
13
+ <vaadin-checkbox label="Indeterminate" indeterminate></vaadin-checkbox>
9
14
  ```
10
15
 
16
+ [<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/checkbox/screenshot.png" width="400" alt="Screenshot of vaadin-checkbox">](https://vaadin.com/docs/latest/ds/components/checkbox)
17
+
11
18
  ## Installation
12
19
 
13
20
  Install the component:
14
21
 
15
22
  ```sh
16
- npm i @vaadin/checkbox --save
23
+ npm i @vaadin/checkbox
17
24
  ```
18
25
 
19
26
  Once installed, import the component in your application:
@@ -24,9 +31,8 @@ import '@vaadin/checkbox';
24
31
 
25
32
  ## Themes
26
33
 
27
- Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/ds/customization/using-themes),
28
- Lumo and Material. The [main entrypoint](https://github.com/vaadin/web-components/blob/master/packages/checkbox/vaadin-checkbox.js)
29
- of the package uses the Lumo theme.
34
+ Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/ds/customization/using-themes), Lumo and Material.
35
+ The [main entrypoint](https://github.com/vaadin/web-components/blob/master/packages/checkbox/vaadin-checkbox.js) of the package uses the Lumo theme.
30
36
 
31
37
  To use the Material theme, import the component from the `theme/material` folder:
32
38
 
@@ -46,9 +52,13 @@ Finally, you can import the un-themed component from the `src` folder to get a m
46
52
  import '@vaadin/checkbox/src/vaadin-checkbox.js';
47
53
  ```
48
54
 
55
+ ## Contributing
56
+
57
+ 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.
58
+
49
59
  ## License
50
60
 
51
61
  Apache License 2.0
52
62
 
53
- Vaadin collects development time usage statistics to improve this product.
63
+ Vaadin collects usage statistics at development time to improve this product.
54
64
  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/checkbox",
3
- "version": "22.0.0-alpha9",
3
+ "version": "22.0.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -33,16 +33,16 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@polymer/polymer": "^3.0.0",
36
- "@vaadin/component-base": "22.0.0-alpha9",
37
- "@vaadin/field-base": "22.0.0-alpha9",
38
- "@vaadin/vaadin-lumo-styles": "22.0.0-alpha9",
39
- "@vaadin/vaadin-material-styles": "22.0.0-alpha9",
40
- "@vaadin/vaadin-themable-mixin": "22.0.0-alpha9"
36
+ "@vaadin/component-base": "^22.0.0",
37
+ "@vaadin/field-base": "^22.0.0",
38
+ "@vaadin/vaadin-lumo-styles": "^22.0.0",
39
+ "@vaadin/vaadin-material-styles": "^22.0.0",
40
+ "@vaadin/vaadin-themable-mixin": "^22.0.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@esm-bundle/chai": "^4.3.4",
44
- "@vaadin/testing-helpers": "^0.3.0",
44
+ "@vaadin/testing-helpers": "^0.3.2",
45
45
  "sinon": "^9.2.0"
46
46
  },
47
- "gitHead": "6e8c899dc65918f97e3c0acb2076122c4b2ef274"
47
+ "gitHead": "b668e9b1a975227fbe34beb70d1cd5b03dce2348"
48
48
  }
@@ -4,6 +4,7 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { ActiveMixin } from '@vaadin/component-base/src/active-mixin.js';
7
+ import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
7
8
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
8
9
  import { CheckedMixin } from '@vaadin/field-base/src/checked-mixin.js';
9
10
  import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
@@ -32,7 +33,7 @@ export interface CheckboxEventMap extends HTMLElementEventMap, CheckboxCustomEve
32
33
  * `<vaadin-checkbox>` is an input field representing a binary choice.
33
34
  *
34
35
  * ```html
35
- * <vaadin-checkbox>I accept the terms and conditions</vaadin-checkbox>
36
+ * <vaadin-checkbox label="I accept the terms and conditions"></vaadin-checkbox>
36
37
  * ```
37
38
  *
38
39
  * ### Styling
@@ -41,9 +42,7 @@ export interface CheckboxEventMap extends HTMLElementEventMap, CheckboxCustomEve
41
42
  *
42
43
  * Part name | Description
43
44
  * ------------|----------------
44
- * `container` | The container element
45
45
  * `checkbox` | The wrapper element that contains slotted `<input type="checkbox">`
46
- * `label` | The wrapper element that contains slotted `<label>`
47
46
  *
48
47
  * The following state attributes are available for styling:
49
48
  *
@@ -63,7 +62,7 @@ export interface CheckboxEventMap extends HTMLElementEventMap, CheckboxCustomEve
63
62
  * @fires {CustomEvent} indeterminate-changed - Fired when the `indeterminate` property changes.
64
63
  */
65
64
  declare class Checkbox extends SlotLabelMixin(
66
- CheckedMixin(DelegateFocusMixin(ActiveMixin(ElementMixin(ThemableMixin(HTMLElement)))))
65
+ CheckedMixin(DelegateFocusMixin(ActiveMixin(ElementMixin(ThemableMixin(ControllerMixin(HTMLElement))))))
67
66
  ) {
68
67
  /**
69
68
  * True if the checkbox is in the indeterminate state which means
@@ -3,13 +3,14 @@
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';
6
+ import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
7
7
  import { ActiveMixin } from '@vaadin/component-base/src/active-mixin.js';
8
+ import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
8
9
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
9
- import { AriaLabelController } from '@vaadin/field-base/src/aria-label-controller.js';
10
10
  import { CheckedMixin } from '@vaadin/field-base/src/checked-mixin.js';
11
11
  import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
12
12
  import { InputController } from '@vaadin/field-base/src/input-controller.js';
13
+ import { LabelledInputController } from '@vaadin/field-base/src/labelled-input-controller.js';
13
14
  import { SlotLabelMixin } from '@vaadin/field-base/src/slot-label-mixin.js';
14
15
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
15
16
 
@@ -17,7 +18,7 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
17
18
  * `<vaadin-checkbox>` is an input field representing a binary choice.
18
19
  *
19
20
  * ```html
20
- * <vaadin-checkbox>I accept the terms and conditions</vaadin-checkbox>
21
+ * <vaadin-checkbox label="I accept the terms and conditions"></vaadin-checkbox>
21
22
  * ```
22
23
  *
23
24
  * ### Styling
@@ -26,9 +27,7 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
26
27
  *
27
28
  * Part name | Description
28
29
  * ------------|----------------
29
- * `container` | The container element.
30
30
  * `checkbox` | The wrapper element that contains slotted <input type="checkbox">.
31
- * `label` | The wrapper element that contains slotted <label>.
32
31
  *
33
32
  * The following state attributes are available for styling:
34
33
  *
@@ -48,6 +47,7 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
48
47
  * @fires {CustomEvent} indeterminate-changed - Fired when the `indeterminate` property changes.
49
48
  *
50
49
  * @extends HTMLElement
50
+ * @mixes ControllerMixin
51
51
  * @mixes ThemableMixin
52
52
  * @mixes ElementMixin
53
53
  * @mixes ActiveMixin
@@ -56,7 +56,7 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
56
56
  * @mixes SlotLabelMixin
57
57
  */
58
58
  class Checkbox extends SlotLabelMixin(
59
- CheckedMixin(DelegateFocusMixin(ActiveMixin(ElementMixin(ThemableMixin(PolymerElement)))))
59
+ CheckedMixin(DelegateFocusMixin(ActiveMixin(ElementMixin(ThemableMixin(ControllerMixin(PolymerElement))))))
60
60
  ) {
61
61
  static get is() {
62
62
  return 'vaadin-checkbox';
@@ -176,7 +176,7 @@ class Checkbox extends SlotLabelMixin(
176
176
  this.stateTarget = input;
177
177
  })
178
178
  );
179
- this.addController(new AriaLabelController(this.inputElement, this._labelNode));
179
+ this.addController(new LabelledInputController(this.inputElement, this._labelNode));
180
180
  }
181
181
 
182
182
  /**
@@ -1,9 +1,9 @@
1
- import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
2
1
  import '@vaadin/vaadin-lumo-styles/color.js';
3
2
  import '@vaadin/vaadin-lumo-styles/sizing.js';
4
3
  import '@vaadin/vaadin-lumo-styles/spacing.js';
5
4
  import '@vaadin/vaadin-lumo-styles/style.js';
6
5
  import '@vaadin/vaadin-lumo-styles/typography.js';
6
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
7
7
 
8
8
  registerStyles(
9
9
  'vaadin-checkbox',
@@ -1,5 +1,5 @@
1
- import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
2
1
  import '@vaadin/vaadin-material-styles/color.js';
2
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
3
3
 
4
4
  registerStyles(
5
5
  'vaadin-checkbox',