@vaadin/checkbox 23.0.0-alpha4 → 23.0.0-beta3

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/checkbox",
3
- "version": "23.0.0-alpha4",
3
+ "version": "23.0.0-beta3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,16 +34,16 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@polymer/polymer": "^3.0.0",
37
- "@vaadin/component-base": "23.0.0-alpha4",
38
- "@vaadin/field-base": "23.0.0-alpha4",
39
- "@vaadin/vaadin-lumo-styles": "23.0.0-alpha4",
40
- "@vaadin/vaadin-material-styles": "23.0.0-alpha4",
41
- "@vaadin/vaadin-themable-mixin": "23.0.0-alpha4"
37
+ "@vaadin/component-base": "23.0.0-beta3",
38
+ "@vaadin/field-base": "23.0.0-beta3",
39
+ "@vaadin/vaadin-lumo-styles": "23.0.0-beta3",
40
+ "@vaadin/vaadin-material-styles": "23.0.0-beta3",
41
+ "@vaadin/vaadin-themable-mixin": "23.0.0-beta3"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@esm-bundle/chai": "^4.3.4",
45
45
  "@vaadin/testing-helpers": "^0.3.2",
46
46
  "sinon": "^9.2.0"
47
47
  },
48
- "gitHead": "81e2deee5147bb7c1f4884760f4598613306f1fb"
48
+ "gitHead": "4c87216666541f9eb58f56c475964727822aad53"
49
49
  }
@@ -8,7 +8,7 @@ import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js'
8
8
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
9
9
  import { CheckedMixin } from '@vaadin/field-base/src/checked-mixin.js';
10
10
  import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
11
- import { SlotLabelMixin } from '@vaadin/field-base/src/slot-label-mixin.js';
11
+ import { LabelMixin } from '@vaadin/field-base/src/label-mixin.js';
12
12
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
13
13
 
14
14
  /**
@@ -61,7 +61,7 @@ export interface CheckboxEventMap extends HTMLElementEventMap, CheckboxCustomEve
61
61
  * @fires {CustomEvent} checked-changed - Fired when the `checked` property changes.
62
62
  * @fires {CustomEvent} indeterminate-changed - Fired when the `indeterminate` property changes.
63
63
  */
64
- declare class Checkbox extends SlotLabelMixin(
64
+ declare class Checkbox extends LabelMixin(
65
65
  CheckedMixin(DelegateFocusMixin(ActiveMixin(ElementMixin(ThemableMixin(ControllerMixin(HTMLElement))))))
66
66
  ) {
67
67
  /**
@@ -10,8 +10,9 @@ import { ElementMixin } from '@vaadin/component-base/src/element-mixin.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 { LabelMixin } from '@vaadin/field-base/src/label-mixin.js';
13
14
  import { LabelledInputController } from '@vaadin/field-base/src/labelled-input-controller.js';
14
- import { SlotLabelMixin } from '@vaadin/field-base/src/slot-label-mixin.js';
15
+ import { SlotTargetController } from '@vaadin/field-base/src/slot-target-controller.js';
15
16
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
16
17
 
17
18
  /**
@@ -53,9 +54,9 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
53
54
  * @mixes ActiveMixin
54
55
  * @mixes DelegateFocusMixin
55
56
  * @mixes CheckedMixin
56
- * @mixes SlotLabelMixin
57
+ * @mixes LabelMixin
57
58
  */
58
- class Checkbox extends SlotLabelMixin(
59
+ class Checkbox extends LabelMixin(
59
60
  CheckedMixin(DelegateFocusMixin(ActiveMixin(ElementMixin(ThemableMixin(ControllerMixin(PolymerElement))))))
60
61
  ) {
61
62
  static get is() {
@@ -78,13 +79,14 @@ class Checkbox extends SlotLabelMixin(
78
79
  }
79
80
 
80
81
  .vaadin-checkbox-container {
81
- display: inline-flex;
82
+ display: grid;
83
+ grid-template-columns: auto 1fr;
82
84
  align-items: baseline;
83
85
  }
84
86
 
85
87
  .vaadin-checkbox-wrapper {
86
88
  position: relative;
87
- flex: none;
89
+ height: 100%;
88
90
  }
89
91
 
90
92
  /* visually hidden */
@@ -178,29 +180,18 @@ class Checkbox extends SlotLabelMixin(
178
180
  });
179
181
  this.addController(this._inputController);
180
182
  this.addController(new LabelledInputController(this.inputElement, this._labelController));
183
+ this.addController(
184
+ new SlotTargetController(
185
+ this.$.noop,
186
+ () => this._labelController.node,
187
+ () => this.__warnDeprecated()
188
+ )
189
+ );
181
190
  }
182
191
  }
183
192
 
184
- /**
185
- * A reference to the default slot from which nodes are copied to the label node.
186
- *
187
- * @override
188
- * @protected
189
- * @type {HTMLSlotElement}
190
- */
191
- get _sourceSlot() {
192
- return this.$.noop;
193
- }
194
-
195
- /**
196
- * Override __copyNodesToSlotTarget from SlotTargetMixin to show a warning.
197
- * @override
198
- * @protected
199
- * @param {!Array<!Node>} nodes
200
- **/
201
- __copyNodesToSlotTarget(nodes) {
202
- super.__copyNodesToSlotTarget(nodes);
203
-
193
+ /** @private */
194
+ __warnDeprecated() {
204
195
  console.warn(
205
196
  `WARNING: Since Vaadin 22, placing the label as a direct child of a <vaadin-checkbox> is deprecated.
206
197
  Please use <label slot="label"> wrapper or the label property instead.`
@@ -1,4 +1,5 @@
1
1
  import '@vaadin/vaadin-lumo-styles/color.js';
2
+ import '@vaadin/vaadin-lumo-styles/font-icons.js';
2
3
  import '@vaadin/vaadin-lumo-styles/sizing.js';
3
4
  import '@vaadin/vaadin-lumo-styles/spacing.js';
4
5
  import '@vaadin/vaadin-lumo-styles/style.js';
@@ -52,31 +53,26 @@ registerStyles(
52
53
 
53
54
  /* Checkmark */
54
55
  [part='checkbox']::after {
55
- content: '';
56
56
  pointer-events: none;
57
- display: inline-block;
58
- width: 0;
59
- height: 0;
60
- border: 0 solid var(--lumo-primary-contrast-color);
61
- border-width: 0.1875em 0 0 0.1875em;
62
- box-sizing: border-box;
63
- transform-origin: 0 0;
57
+ font-family: 'lumo-icons';
58
+ content: var(--lumo-icons-checkmark);
59
+ color: var(--lumo-primary-contrast-color);
60
+ font-size: calc(var(--lumo-size-m) / 2 + 2px);
61
+ line-height: 1;
64
62
  position: absolute;
65
- top: 0.8125em;
66
- left: 0.5em;
67
- transform: scale(0.55) rotate(-135deg);
63
+ top: -1px;
64
+ left: -1px;
65
+ contain: content;
68
66
  opacity: 0;
69
67
  }
70
68
 
71
69
  :host([checked]) [part='checkbox']::after {
72
70
  opacity: 1;
73
- width: 0.625em;
74
- height: 1.0625em;
75
71
  }
76
72
 
77
73
  /* Indeterminate checkmark */
78
74
  :host([indeterminate]) [part='checkbox']::after {
79
- transform: none;
75
+ content: '';
80
76
  opacity: 1;
81
77
  top: 45%;
82
78
  height: 10%;
@@ -85,7 +81,6 @@ registerStyles(
85
81
  width: auto;
86
82
  border: 0;
87
83
  background-color: var(--lumo-primary-contrast-color);
88
- transition: opacity 0.25s;
89
84
  }
90
85
 
91
86
  /* Focus ring */
@@ -108,7 +103,7 @@ registerStyles(
108
103
  }
109
104
 
110
105
  :host([disabled]) [part='checkbox']::after {
111
- border-color: var(--lumo-contrast-30pct);
106
+ color: var(--lumo-contrast-30pct);
112
107
  }
113
108
 
114
109
  :host([indeterminate][disabled]) [part='checkbox']::after {
@@ -120,11 +115,6 @@ registerStyles(
120
115
  padding: var(--lumo-space-xs) var(--lumo-space-xs) var(--lumo-space-xs) var(--lumo-space-s);
121
116
  }
122
117
 
123
- /* Transition the checkmark if activated with the mouse (disabled for grid select-all this way) */
124
- :host(:hover) [part='checkbox']::after {
125
- transition: width 0.1s, height 0.25s;
126
- }
127
-
128
118
  /* Used for activation "halo" */
129
119
  [part='checkbox']::before {
130
120
  pointer-events: none;