@vaadin/checkbox 24.4.0-dev.b3e1d14600 → 24.4.0-rc2

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
@@ -5,7 +5,6 @@ An input field representing a binary choice.
5
5
  [Documentation + Live Demo ↗](https://vaadin.com/docs/latest/components/checkbox)
6
6
 
7
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)
9
8
 
10
9
  ```html
11
10
  <vaadin-checkbox label="Checked" checked></vaadin-checkbox>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/checkbox",
3
- "version": "24.4.0-dev.b3e1d14600",
3
+ "version": "24.4.0-rc2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,12 +37,12 @@
37
37
  "dependencies": {
38
38
  "@open-wc/dedupe-mixin": "^1.3.0",
39
39
  "@polymer/polymer": "^3.0.0",
40
- "@vaadin/a11y-base": "24.4.0-dev.b3e1d14600",
41
- "@vaadin/component-base": "24.4.0-dev.b3e1d14600",
42
- "@vaadin/field-base": "24.4.0-dev.b3e1d14600",
43
- "@vaadin/vaadin-lumo-styles": "24.4.0-dev.b3e1d14600",
44
- "@vaadin/vaadin-material-styles": "24.4.0-dev.b3e1d14600",
45
- "@vaadin/vaadin-themable-mixin": "24.4.0-dev.b3e1d14600",
40
+ "@vaadin/a11y-base": "24.4.0-rc2",
41
+ "@vaadin/component-base": "24.4.0-rc2",
42
+ "@vaadin/field-base": "24.4.0-rc2",
43
+ "@vaadin/vaadin-lumo-styles": "24.4.0-rc2",
44
+ "@vaadin/vaadin-material-styles": "24.4.0-rc2",
45
+ "@vaadin/vaadin-themable-mixin": "24.4.0-rc2",
46
46
  "lit": "^3.0.0"
47
47
  },
48
48
  "devDependencies": {
@@ -54,5 +54,5 @@
54
54
  "web-types.json",
55
55
  "web-types.lit.json"
56
56
  ],
57
- "gitHead": "502d4f5b03f770a83d270d98078cde230254dd0e"
57
+ "gitHead": "ea3d99e8cf67a337e959d5cab849f80464c7c7e5"
58
58
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
@@ -12,8 +12,10 @@ import type { KeyboardMixinClass } from '@vaadin/a11y-base/src/keyboard-mixin.js
12
12
  import type { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
13
13
  import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
14
14
  import type { CheckedMixinClass } from '@vaadin/field-base/src/checked-mixin.js';
15
+ import type { FieldMixinClass } from '@vaadin/field-base/src/field-mixin.js';
15
16
  import type { InputMixinClass } from '@vaadin/field-base/src/input-mixin.js';
16
17
  import type { LabelMixinClass } from '@vaadin/field-base/src/label-mixin.js';
18
+ import type { ValidateMixinClass } from '@vaadin/field-base/src/validate-mixin.js';
17
19
 
18
20
  /**
19
21
  * A mixin providing common checkbox functionality.
@@ -27,10 +29,12 @@ export declare function CheckboxMixin<T extends Constructor<HTMLElement>>(
27
29
  Constructor<DelegateFocusMixinClass> &
28
30
  Constructor<DelegateStateMixinClass> &
29
31
  Constructor<DisabledMixinClass> &
32
+ Constructor<FieldMixinClass> &
30
33
  Constructor<FocusMixinClass> &
31
34
  Constructor<InputMixinClass> &
32
35
  Constructor<KeyboardMixinClass> &
33
36
  Constructor<LabelMixinClass> &
37
+ Constructor<ValidateMixinClass> &
34
38
  T;
35
39
 
36
40
  export declare class CheckboxMixinClass {
@@ -47,4 +51,12 @@ export declare class CheckboxMixinClass {
47
51
  * The name of the checkbox.
48
52
  */
49
53
  name: string;
54
+
55
+ /**
56
+ * When true, the user cannot modify the value of the checkbox.
57
+ * The difference between `disabled` and `readonly` is that the
58
+ * read-only checkbox remains focusable, is announced by screen
59
+ * readers and its value can be submitted as part of the form.
60
+ */
61
+ readonly: boolean;
50
62
  }
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2024 Vaadin Ltd.
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/a11y-base/src/active-mixin.js';
7
7
  import { DelegateFocusMixin } from '@vaadin/a11y-base/src/delegate-focus-mixin.js';
8
8
  import { CheckedMixin } from '@vaadin/field-base/src/checked-mixin.js';
9
+ import { FieldMixin } from '@vaadin/field-base/src/field-mixin.js';
9
10
  import { InputController } from '@vaadin/field-base/src/input-controller.js';
10
- import { LabelMixin } from '@vaadin/field-base/src/label-mixin.js';
11
11
  import { LabelledInputController } from '@vaadin/field-base/src/labelled-input-controller.js';
12
12
 
13
13
  /**
@@ -17,10 +17,10 @@ import { LabelledInputController } from '@vaadin/field-base/src/labelled-input-c
17
17
  * @mixes ActiveMixin
18
18
  * @mixes CheckedMixin
19
19
  * @mixes DelegateFocusMixin
20
- * @mixes LabelMixin
20
+ * @mixes FieldMixin
21
21
  */
22
22
  export const CheckboxMixin = (superclass) =>
23
- class CheckboxMixinClass extends LabelMixin(CheckedMixin(DelegateFocusMixin(ActiveMixin(superclass)))) {
23
+ class CheckboxMixinClass extends FieldMixin(CheckedMixin(DelegateFocusMixin(ActiveMixin(superclass)))) {
24
24
  static get properties() {
25
25
  return {
26
26
  /**
@@ -49,6 +49,18 @@ export const CheckboxMixin = (superclass) =>
49
49
  value: '',
50
50
  },
51
51
 
52
+ /**
53
+ * When true, the user cannot modify the value of the checkbox.
54
+ * The difference between `disabled` and `readonly` is that the
55
+ * read-only checkbox remains focusable, is announced by screen
56
+ * readers and its value can be submitted as part of the form.
57
+ */
58
+ readonly: {
59
+ type: Boolean,
60
+ value: false,
61
+ reflectToAttribute: true,
62
+ },
63
+
52
64
  /**
53
65
  * Indicates whether the element can be focused and where it participates in sequential keyboard navigation.
54
66
  *
@@ -63,6 +75,10 @@ export const CheckboxMixin = (superclass) =>
63
75
  };
64
76
  }
65
77
 
78
+ static get observers() {
79
+ return ['__readonlyChanged(readonly, inputElement)'];
80
+ }
81
+
66
82
  /** @override */
67
83
  static get delegateProps() {
68
84
  return [...super.delegateProps, 'indeterminate'];
@@ -70,7 +86,7 @@ export const CheckboxMixin = (superclass) =>
70
86
 
71
87
  /** @override */
72
88
  static get delegateAttrs() {
73
- return [...super.delegateAttrs, 'name'];
89
+ return [...super.delegateAttrs, 'name', 'invalid'];
74
90
  }
75
91
 
76
92
  constructor() {
@@ -78,6 +94,8 @@ export const CheckboxMixin = (superclass) =>
78
94
 
79
95
  this._setType('checkbox');
80
96
 
97
+ this._boundOnInputClick = this._onInputClick.bind(this);
98
+
81
99
  // Set the string "on" as the default value for the checkbox following the HTML specification:
82
100
  // https://html.spec.whatwg.org/multipage/input.html#dom-input-value-default-on
83
101
  this.value = 'on';
@@ -96,11 +114,14 @@ export const CheckboxMixin = (superclass) =>
96
114
  }),
97
115
  );
98
116
  this.addController(new LabelledInputController(this.inputElement, this._labelController));
117
+
118
+ this._createMethodObserver('_checkedChanged(checked)');
99
119
  }
100
120
 
101
121
  /**
102
- * Override method inherited from `ActiveMixin` to prevent setting
103
- * `active` attribute when clicking a link placed inside the label.
122
+ * Override method inherited from `ActiveMixin` to prevent setting `active`
123
+ * attribute when readonly, or when clicking a link placed inside the label,
124
+ * or when clicking slotted helper or error message element.
104
125
  *
105
126
  * @param {Event} event
106
127
  * @return {boolean}
@@ -108,13 +129,64 @@ export const CheckboxMixin = (superclass) =>
108
129
  * @override
109
130
  */
110
131
  _shouldSetActive(event) {
111
- if (event.target.localName === 'a') {
132
+ if (
133
+ this.readonly ||
134
+ event.target.localName === 'a' ||
135
+ event.target === this._helperNode ||
136
+ event.target === this._errorNode
137
+ ) {
112
138
  return false;
113
139
  }
114
140
 
115
141
  return super._shouldSetActive(event);
116
142
  }
117
143
 
144
+ /**
145
+ * Override method inherited from `InputMixin`.
146
+ * @param {!HTMLElement} input
147
+ * @protected
148
+ * @override
149
+ */
150
+ _addInputListeners(input) {
151
+ super._addInputListeners(input);
152
+
153
+ input.addEventListener('click', this._boundOnInputClick);
154
+ }
155
+
156
+ /**
157
+ * Override method inherited from `InputMixin`.
158
+ * @param {!HTMLElement} input
159
+ * @protected
160
+ * @override
161
+ */
162
+ _removeInputListeners(input) {
163
+ super._removeInputListeners(input);
164
+
165
+ input.removeEventListener('click', this._boundOnInputClick);
166
+ }
167
+
168
+ /** @private */
169
+ _onInputClick(event) {
170
+ // Prevent native checkbox checked change
171
+ if (this.readonly) {
172
+ event.preventDefault();
173
+ }
174
+ }
175
+
176
+ /** @private */
177
+ __readonlyChanged(readonly, inputElement) {
178
+ if (!inputElement) {
179
+ return;
180
+ }
181
+
182
+ // Use aria-readonly since native checkbox doesn't support readonly
183
+ if (readonly) {
184
+ inputElement.setAttribute('aria-readonly', 'true');
185
+ } else {
186
+ inputElement.removeAttribute('aria-readonly');
187
+ }
188
+ }
189
+
118
190
  /**
119
191
  * Override method inherited from `CheckedMixin` to reset
120
192
  * `indeterminate` state checkbox is toggled by the user.
@@ -131,6 +203,58 @@ export const CheckboxMixin = (superclass) =>
131
203
  super._toggleChecked(checked);
132
204
  }
133
205
 
206
+ /**
207
+ * @override
208
+ * @return {boolean}
209
+ */
210
+ checkValidity() {
211
+ return !this.required || !!this.checked;
212
+ }
213
+
214
+ /**
215
+ * Override method inherited from `FocusMixin` to validate on blur.
216
+ * @param {boolean} focused
217
+ * @protected
218
+ */
219
+ _setFocused(focused) {
220
+ super._setFocused(focused);
221
+
222
+ // Do not validate when focusout is caused by document
223
+ // losing focus, which happens on browser tab switch.
224
+ if (!focused && document.hasFocus()) {
225
+ this.validate();
226
+ }
227
+ }
228
+
229
+ /** @private */
230
+ _checkedChanged(checked) {
231
+ if (checked || this.__oldChecked) {
232
+ this.validate();
233
+ }
234
+
235
+ this.__oldChecked = checked;
236
+ }
237
+
238
+ /**
239
+ * Override an observer from `FieldMixin`
240
+ * to validate when required is removed.
241
+ *
242
+ * @protected
243
+ * @override
244
+ */
245
+ _requiredChanged(required) {
246
+ super._requiredChanged(required);
247
+
248
+ if (required === false) {
249
+ this.validate();
250
+ }
251
+ }
252
+
253
+ /** @private */
254
+ _onRequiredIndicatorClick() {
255
+ this._labelNode.click();
256
+ }
257
+
134
258
  /**
135
259
  * Fired when the checkbox is checked or unchecked by the user.
136
260
  *
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { CSSResult } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
@@ -26,7 +26,7 @@ export const checkboxStyles = css`
26
26
 
27
27
  [part='checkbox'],
28
28
  ::slotted(input),
29
- ::slotted(label) {
29
+ [part='label'] {
30
30
  grid-row: 1;
31
31
  }
32
32
 
@@ -35,6 +35,16 @@ export const checkboxStyles = css`
35
35
  grid-column: 1;
36
36
  }
37
37
 
38
+ [part='helper-text'],
39
+ [part='error-message'] {
40
+ grid-column: 2;
41
+ }
42
+
43
+ :host(:not([has-helper])) [part='helper-text'],
44
+ :host(:not([has-error-message])) [part='error-message'] {
45
+ display: none;
46
+ }
47
+
38
48
  [part='checkbox'] {
39
49
  width: var(--vaadin-checkbox-size, 1em);
40
50
  height: var(--vaadin-checkbox-size, 1em);
@@ -1,15 +1,11 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { ActiveMixin } from '@vaadin/a11y-base/src/active-mixin.js';
7
- import { DelegateFocusMixin } from '@vaadin/a11y-base/src/delegate-focus-mixin.js';
8
- import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
9
6
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
10
- import { CheckedMixin } from '@vaadin/field-base/src/checked-mixin.js';
11
- import { LabelMixin } from '@vaadin/field-base/src/label-mixin.js';
12
7
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
+ import { CheckboxMixin } from './vaadin-checkbox-mixin.js';
13
9
 
14
10
  /**
15
11
  * Fired when the checkbox is checked or unchecked by the user.
@@ -28,10 +24,24 @@ export type CheckboxCheckedChangedEvent = CustomEvent<{ value: boolean }>;
28
24
  */
29
25
  export type CheckboxIndeterminateChangedEvent = CustomEvent<{ value: boolean }>;
30
26
 
27
+ /**
28
+ * Fired when the `invalid` property changes.
29
+ */
30
+ export type CheckboxInvalidChangedEvent = CustomEvent<{ value: boolean }>;
31
+
32
+ /**
33
+ * Fired whenever the checkbox is validated.
34
+ */
35
+ export type CheckboxValidatedEvent = CustomEvent<{ valid: boolean }>;
36
+
31
37
  export interface CheckboxCustomEventMap {
32
38
  'checked-changed': CheckboxCheckedChangedEvent;
33
39
 
34
40
  'indeterminate-changed': CheckboxIndeterminateChangedEvent;
41
+
42
+ 'invalid-changed': CheckboxInvalidChangedEvent;
43
+
44
+ validated: CheckboxValidatedEvent;
35
45
  }
36
46
 
37
47
  export interface CheckboxEventMap extends HTMLElementEventMap, CheckboxCustomEventMap {
@@ -49,21 +59,29 @@ export interface CheckboxEventMap extends HTMLElementEventMap, CheckboxCustomEve
49
59
  *
50
60
  * The following shadow DOM parts are available for styling:
51
61
  *
52
- * Part name | Description
53
- * ------------|-------------
54
- * `checkbox` | The element representing a stylable custom checkbox.
62
+ * Part name | Description
63
+ * ---------------------|-------------
64
+ * `checkbox` | The element representing a stylable custom checkbox
65
+ * `label` | The slotted label element wrapper
66
+ * `helper-text` | The slotted helper text element wrapper
67
+ * `error-message` | The slotted error message element wrapper
68
+ * `required-indicator` | The `required` state indicator element
55
69
  *
56
70
  * The following state attributes are available for styling:
57
71
  *
58
- * Attribute | Description
59
- * ----------------|-------------
60
- * `active` | Set when the checkbox is activated with mouse, touch or the keyboard.
61
- * `checked` | Set when the checkbox is checked.
62
- * `disabled` | Set when the checkbox is disabled.
63
- * `focus-ring` | Set when the checkbox is focused using the keyboard.
64
- * `focused` | Set when the checkbox is focused.
65
- * `indeterminate` | Set when the checkbox is in the indeterminate state.
66
- * `has-label` | Set when the checkbox has a label.
72
+ * Attribute | Description
73
+ * ---------------------|-------------
74
+ * `active` | Set when the checkbox is activated with mouse, touch or the keyboard.
75
+ * `checked` | Set when the checkbox is checked.
76
+ * `disabled` | Set when the checkbox is disabled.
77
+ * `readonly` | Set when the checkbox is readonly.
78
+ * `focus-ring` | Set when the checkbox is focused using the keyboard.
79
+ * `focused` | Set when the checkbox is focused.
80
+ * `indeterminate` | Set when the checkbox is in the indeterminate state.
81
+ * `invalid` | Set when the checkbox is invalid.
82
+ * `has-label` | Set when the checkbox has a label.
83
+ * `has-helper` | Set when the checkbox has helper text.
84
+ * `has-error-message` | Set when the checkbox has an error message.
67
85
  *
68
86
  * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
69
87
  *
@@ -71,23 +89,7 @@ export interface CheckboxEventMap extends HTMLElementEventMap, CheckboxCustomEve
71
89
  * @fires {CustomEvent} checked-changed - Fired when the `checked` property changes.
72
90
  * @fires {CustomEvent} indeterminate-changed - Fired when the `indeterminate` property changes.
73
91
  */
74
- declare class Checkbox extends LabelMixin(
75
- CheckedMixin(DelegateFocusMixin(ActiveMixin(ElementMixin(ThemableMixin(ControllerMixin(HTMLElement)))))),
76
- ) {
77
- /**
78
- * True if the checkbox is in the indeterminate state which means
79
- * it is not possible to say whether it is checked or unchecked.
80
- * The state is reset once the user switches the checkbox by hand.
81
- *
82
- * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#Indeterminate_state_checkboxes
83
- */
84
- indeterminate: boolean;
85
-
86
- /**
87
- * The name of the checkbox.
88
- */
89
- name: string;
90
-
92
+ declare class Checkbox extends CheckboxMixin(ElementMixin(ThemableMixin(HTMLElement))) {
91
93
  addEventListener<K extends keyof CheckboxEventMap>(
92
94
  type: K,
93
95
  listener: (this: Checkbox, ev: CheckboxEventMap[K]) => void,
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
@@ -24,21 +24,29 @@ registerStyles('vaadin-checkbox', checkboxStyles, { moduleId: 'vaadin-checkbox-s
24
24
  *
25
25
  * The following shadow DOM parts are available for styling:
26
26
  *
27
- * Part name | Description
28
- * ------------|-------------
29
- * `checkbox` | The element representing a stylable custom checkbox.
27
+ * Part name | Description
28
+ * ---------------------|-------------
29
+ * `checkbox` | The element representing a stylable custom checkbox
30
+ * `label` | The slotted label element wrapper
31
+ * `helper-text` | The slotted helper text element wrapper
32
+ * `error-message` | The slotted error message element wrapper
33
+ * `required-indicator` | The `required` state indicator element
30
34
  *
31
35
  * The following state attributes are available for styling:
32
36
  *
33
- * Attribute | Description
34
- * ----------------|-------------
35
- * `active` | Set when the checkbox is activated with mouse, touch or the keyboard.
36
- * `checked` | Set when the checkbox is checked.
37
- * `disabled` | Set when the checkbox is disabled.
38
- * `focus-ring` | Set when the checkbox is focused using the keyboard.
39
- * `focused` | Set when the checkbox is focused.
40
- * `indeterminate` | Set when the checkbox is in the indeterminate state.
41
- * `has-label` | Set when the checkbox has a label.
37
+ * Attribute | Description
38
+ * ---------------------|-------------
39
+ * `active` | Set when the checkbox is activated with mouse, touch or the keyboard.
40
+ * `checked` | Set when the checkbox is checked.
41
+ * `disabled` | Set when the checkbox is disabled.
42
+ * `readonly` | Set when the checkbox is readonly.
43
+ * `focus-ring` | Set when the checkbox is focused using the keyboard.
44
+ * `focused` | Set when the checkbox is focused.
45
+ * `indeterminate` | Set when the checkbox is in the indeterminate state.
46
+ * `invalid` | Set when the checkbox is invalid.
47
+ * `has-label` | Set when the checkbox has a label.
48
+ * `has-helper` | Set when the checkbox has helper text.
49
+ * `has-error-message` | Set when the checkbox has an error message.
42
50
  *
43
51
  * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
44
52
  *
@@ -62,7 +70,16 @@ export class Checkbox extends CheckboxMixin(ElementMixin(ThemableMixin(PolymerEl
62
70
  <div class="vaadin-checkbox-container">
63
71
  <div part="checkbox" aria-hidden="true"></div>
64
72
  <slot name="input"></slot>
65
- <slot name="label"></slot>
73
+ <div part="label">
74
+ <slot name="label"></slot>
75
+ <div part="required-indicator" on-click="_onRequiredIndicatorClick"></div>
76
+ </div>
77
+ <div part="helper-text">
78
+ <slot name="helper"></slot>
79
+ </div>
80
+ <div part="error-message">
81
+ <slot name="error-message"></slot>
82
+ </div>
66
83
  </div>
67
84
  <slot name="tooltip"></slot>
68
85
  `;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  export * from './vaadin-checkbox.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { html, LitElement } from 'lit';
@@ -17,7 +17,7 @@ import { checkboxStyles } from './vaadin-checkbox-styles.js';
17
17
  *
18
18
  * ## Disclaimer
19
19
  *
20
- * This component is an experiment not intended for publishing to npm.
20
+ * This component is an experiment and not yet a part of Vaadin platform.
21
21
  * There is no ETA regarding specific Vaadin version where it'll land.
22
22
  * Feel free to try this code in your apps as per Apache 2.0 license.
23
23
  */
@@ -36,7 +36,16 @@ export class Checkbox extends CheckboxMixin(ElementMixin(ThemableMixin(PolylitMi
36
36
  <div class="vaadin-checkbox-container">
37
37
  <div part="checkbox" aria-hidden="true"></div>
38
38
  <slot name="input"></slot>
39
- <slot name="label"></slot>
39
+ <div part="label">
40
+ <slot name="label"></slot>
41
+ <div part="required-indicator" @click="${this._onRequiredIndicatorClick}"></div>
42
+ </div>
43
+ <div part="helper-text">
44
+ <slot name="helper"></slot>
45
+ </div>
46
+ <div part="error-message">
47
+ <slot name="error-message"></slot>
48
+ </div>
40
49
  </div>
41
50
  <slot name="tooltip"></slot>
42
51
  `;
@@ -0,0 +1,6 @@
1
+ import '@vaadin/vaadin-lumo-styles/color.js';
2
+ import '@vaadin/vaadin-lumo-styles/font-icons.js';
3
+ import '@vaadin/vaadin-lumo-styles/sizing.js';
4
+ import '@vaadin/vaadin-lumo-styles/spacing.js';
5
+ import '@vaadin/vaadin-lumo-styles/style.js';
6
+ import '@vaadin/vaadin-lumo-styles/typography.js';