@vaadin/item 25.2.0-alpha8 → 25.2.0-beta1

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.
@@ -41,6 +41,20 @@
41
41
  "description": "A mixin providing `focused`, `focus-ring`, `active`, `disabled` and `selected`.\n\n`focused`, `active` and `focus-ring` are set as only as attributes.",
42
42
  "name": "ItemMixin",
43
43
  "members": [
44
+ {
45
+ "kind": "field",
46
+ "name": "disabled",
47
+ "privacy": "public",
48
+ "type": {
49
+ "text": "boolean"
50
+ },
51
+ "description": "If true, the user cannot interact with this element.",
52
+ "attribute": "disabled",
53
+ "inheritedFrom": {
54
+ "name": "DisabledMixin",
55
+ "package": "@vaadin/a11y-base/src/disabled-mixin.js"
56
+ }
57
+ },
44
58
  {
45
59
  "kind": "field",
46
60
  "name": "selected",
@@ -61,6 +75,18 @@
61
75
  }
62
76
  ],
63
77
  "attributes": [
78
+ {
79
+ "name": "disabled",
80
+ "type": {
81
+ "text": "boolean"
82
+ },
83
+ "description": "If true, the user cannot interact with this element.",
84
+ "fieldName": "disabled",
85
+ "inheritedFrom": {
86
+ "name": "DisabledMixin",
87
+ "package": "@vaadin/a11y-base/src/disabled-mixin.js"
88
+ }
89
+ },
64
90
  {
65
91
  "name": "selected",
66
92
  "type": {
@@ -107,6 +133,20 @@
107
133
  "description": "`<vaadin-item>` is a Web Component providing layout for items in tabs and menus.\n\n```html\n<vaadin-item>Item content</vaadin-item>\n```\n\n### Selectable\n\n`<vaadin-item>` has the `selected` property and the corresponding state attribute.\nCurrently, the component sets the `selected` to false, when `disabled` property is set to true.\nBut other than that, the `<vaadin-item>` does not switch selection by itself.\nIn general, it is the wrapper component, like `<vaadin-list-box>`, which should update\nthe `selected` property on the items, e. g. on mousedown or when Enter / Spacebar is pressed.\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-------------|----------------\n`checkmark` | The graphical checkmark shown for a selected item\n`content` | The element that wraps the slot\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-------------|-------------\n`active` | Set when the item is pressed down, either with mouse, touch or the keyboard.\n`disabled` | Set when the item is disabled.\n`focus-ring` | Set when the item is focused using the keyboard.\n`focused` | Set when the item is focused.\n`selected` | Set when the item is selected\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:------------------------------------|\n| `--vaadin-item-border-radius` |\n| `--vaadin-item-checkmark-color` |\n| `--vaadin-item-checkmark-display` |\n| `--vaadin-item-gap` |\n| `--vaadin-item-height` |\n| `--vaadin-item-padding` |\n| `--vaadin-item-text-align` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
108
134
  "name": "Item",
109
135
  "members": [
136
+ {
137
+ "kind": "field",
138
+ "name": "disabled",
139
+ "privacy": "public",
140
+ "type": {
141
+ "text": "boolean"
142
+ },
143
+ "description": "If true, the user cannot interact with this element.",
144
+ "attribute": "disabled",
145
+ "inheritedFrom": {
146
+ "name": "DisabledMixin",
147
+ "package": "@vaadin/a11y-base/src/disabled-mixin.js"
148
+ }
149
+ },
110
150
  {
111
151
  "type": {
112
152
  "text": "string"
@@ -171,6 +211,18 @@
171
211
  "tagName": "vaadin-item",
172
212
  "customElement": true,
173
213
  "attributes": [
214
+ {
215
+ "name": "disabled",
216
+ "type": {
217
+ "text": "boolean"
218
+ },
219
+ "description": "If true, the user cannot interact with this element.",
220
+ "fieldName": "disabled",
221
+ "inheritedFrom": {
222
+ "name": "DisabledMixin",
223
+ "package": "@vaadin/a11y-base/src/disabled-mixin.js"
224
+ }
225
+ },
174
226
  {
175
227
  "name": "selected",
176
228
  "type": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/item",
3
- "version": "25.2.0-alpha8",
3
+ "version": "25.2.0-beta1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,17 +35,17 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@open-wc/dedupe-mixin": "^1.3.0",
38
- "@vaadin/a11y-base": "25.2.0-alpha8",
39
- "@vaadin/component-base": "25.2.0-alpha8",
40
- "@vaadin/vaadin-themable-mixin": "25.2.0-alpha8",
38
+ "@vaadin/a11y-base": "25.2.0-beta1",
39
+ "@vaadin/component-base": "25.2.0-beta1",
40
+ "@vaadin/vaadin-themable-mixin": "25.2.0-beta1",
41
41
  "lit": "^3.0.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@vaadin/aura": "25.2.0-alpha8",
45
- "@vaadin/chai-plugins": "25.2.0-alpha8",
46
- "@vaadin/test-runner-commands": "25.2.0-alpha8",
44
+ "@vaadin/aura": "25.2.0-beta1",
45
+ "@vaadin/chai-plugins": "25.2.0-beta1",
46
+ "@vaadin/test-runner-commands": "25.2.0-beta1",
47
47
  "@vaadin/testing-helpers": "^2.0.0",
48
- "@vaadin/vaadin-lumo-styles": "25.2.0-alpha8",
48
+ "@vaadin/vaadin-lumo-styles": "25.2.0-beta1",
49
49
  "sinon": "^21.0.2"
50
50
  },
51
51
  "customElements": "custom-elements.json",
@@ -53,5 +53,5 @@
53
53
  "web-types.json",
54
54
  "web-types.lit.json"
55
55
  ],
56
- "gitHead": "2b82e20cdfc605b1187e9a24ae42869e1500ab68"
56
+ "gitHead": "471a23f60d1eb725f98a33f62cb9664d9c0a4163"
57
57
  }
@@ -27,7 +27,7 @@ export const itemStyles = css`
27
27
  :host([disabled]) {
28
28
  cursor: var(--vaadin-disabled-cursor);
29
29
  opacity: 0.5;
30
- pointer-events: none;
30
+ pointer-events: var(--_vaadin-item-disabled-pointer-events, none);
31
31
  }
32
32
 
33
33
  :host([hidden]) {
@@ -10,10 +10,6 @@ import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
10
10
  * A mixin providing `focused`, `focus-ring`, `active`, `disabled` and `selected`.
11
11
  *
12
12
  * `focused`, `active` and `focus-ring` are set as only as attributes.
13
- *
14
- * @polymerMixin
15
- * @mixes ActiveMixin
16
- * @mixes FocusMixin
17
13
  */
18
14
  export const ItemMixin = (superClass) =>
19
15
  class VaadinItemMixin extends ActiveMixin(FocusMixin(superClass)) {
@@ -61,7 +57,7 @@ export const ItemMixin = (superClass) =>
61
57
  * @type {string}
62
58
  */
63
59
  get value() {
64
- return this._value !== undefined ? this._value : this.textContent.trim();
60
+ return this._value ?? this.textContent.trim();
65
61
  }
66
62
 
67
63
  set value(value) {
@@ -76,6 +72,10 @@ export const ItemMixin = (superClass) =>
76
72
  if (attrValue !== null) {
77
73
  this.value = attrValue;
78
74
  }
75
+
76
+ if (this.__shouldAllowFocusWhenDisabled()) {
77
+ this.style.setProperty('--_vaadin-item-disabled-pointer-events', 'auto');
78
+ }
79
79
  }
80
80
 
81
81
  /**
@@ -84,7 +84,7 @@ export const ItemMixin = (superClass) =>
84
84
  * @override
85
85
  */
86
86
  focus(options) {
87
- if (this.disabled) {
87
+ if (this.disabled && !this.__shouldAllowFocusWhenDisabled()) {
88
88
  return;
89
89
  }
90
90
 
@@ -115,7 +115,9 @@ export const ItemMixin = (superClass) =>
115
115
 
116
116
  if (disabled) {
117
117
  this.selected = false;
118
- this.blur();
118
+ if (!this.__shouldAllowFocusWhenDisabled()) {
119
+ this.blur();
120
+ }
119
121
  }
120
122
  }
121
123
 
@@ -142,4 +144,15 @@ export const ItemMixin = (superClass) =>
142
144
  this.click();
143
145
  }
144
146
  }
147
+
148
+ /**
149
+ * Returns whether the component should be focusable when disabled.
150
+ * Returns false by default.
151
+ *
152
+ * @private
153
+ * @return {boolean}
154
+ */
155
+ __shouldAllowFocusWhenDisabled() {
156
+ return false;
157
+ }
145
158
  };
@@ -63,9 +63,6 @@ import { ItemMixin } from './vaadin-item-mixin.js';
63
63
  * @prop {string} label - String that can be set to visually represent the selected item in `vaadin-select`.
64
64
  * @customElement vaadin-item
65
65
  * @extends HTMLElement
66
- * @mixes ItemMixin
67
- * @mixes ThemableMixin
68
- * @mixes DirMixin
69
66
  */
70
67
  class Item extends ItemMixin(ThemableMixin(DirMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
71
68
  static get is() {
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/item",
4
- "version": "25.2.0-alpha8",
4
+ "version": "25.2.0-beta1",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -15,9 +15,7 @@
15
15
  "description": "If true, the user cannot interact with this element.",
16
16
  "value": {
17
17
  "type": [
18
- "boolean",
19
- "null",
20
- "undefined"
18
+ "boolean"
21
19
  ]
22
20
  }
23
21
  },
@@ -26,9 +24,7 @@
26
24
  "description": "If true, the item is in selected state.",
27
25
  "value": {
28
26
  "type": [
29
- "boolean",
30
- "null",
31
- "undefined"
27
+ "boolean"
32
28
  ]
33
29
  }
34
30
  },
@@ -51,9 +47,7 @@
51
47
  "description": "If true, the user cannot interact with this element.",
52
48
  "value": {
53
49
  "type": [
54
- "boolean",
55
- "null",
56
- "undefined"
50
+ "boolean"
57
51
  ]
58
52
  }
59
53
  },
@@ -71,9 +65,7 @@
71
65
  "description": "If true, the item is in selected state.",
72
66
  "value": {
73
67
  "type": [
74
- "boolean",
75
- "null",
76
- "undefined"
68
+ "boolean"
77
69
  ]
78
70
  }
79
71
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/item",
4
- "version": "25.2.0-alpha8",
4
+ "version": "25.2.0-beta1",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -27,15 +27,15 @@
27
27
  }
28
28
  },
29
29
  {
30
- "name": "?selected",
31
- "description": "If true, the item is in selected state.",
30
+ "name": ".label",
31
+ "description": "String that can be set to visually represent the selected item in `vaadin-select`.",
32
32
  "value": {
33
33
  "kind": "expression"
34
34
  }
35
35
  },
36
36
  {
37
- "name": ".label",
38
- "description": "String that can be set to visually represent the selected item in `vaadin-select`.",
37
+ "name": "?selected",
38
+ "description": "If true, the item is in selected state.",
39
39
  "value": {
40
40
  "kind": "expression"
41
41
  }