@vaadin/item 25.1.2 → 25.2.0-alpha10

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.1.2",
3
+ "version": "25.2.0-alpha10",
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.1.2",
39
- "@vaadin/component-base": "~25.1.2",
40
- "@vaadin/vaadin-themable-mixin": "~25.1.2",
38
+ "@vaadin/a11y-base": "25.2.0-alpha10",
39
+ "@vaadin/component-base": "25.2.0-alpha10",
40
+ "@vaadin/vaadin-themable-mixin": "25.2.0-alpha10",
41
41
  "lit": "^3.0.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@vaadin/aura": "~25.1.2",
45
- "@vaadin/chai-plugins": "~25.1.2",
46
- "@vaadin/test-runner-commands": "~25.1.2",
44
+ "@vaadin/aura": "25.2.0-alpha10",
45
+ "@vaadin/chai-plugins": "25.2.0-alpha10",
46
+ "@vaadin/test-runner-commands": "25.2.0-alpha10",
47
47
  "@vaadin/testing-helpers": "^2.0.0",
48
- "@vaadin/vaadin-lumo-styles": "~25.1.2",
48
+ "@vaadin/vaadin-lumo-styles": "25.2.0-alpha10",
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": "48e5dc507ac5eb8d34839be06cac652f1635fe1c"
56
+ "gitHead": "1303b6a3eeecb44a9d26f2b53cb56d9e906febdf"
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]) {
@@ -76,6 +76,10 @@ export const ItemMixin = (superClass) =>
76
76
  if (attrValue !== null) {
77
77
  this.value = attrValue;
78
78
  }
79
+
80
+ if (this.__shouldAllowFocusWhenDisabled()) {
81
+ this.style.setProperty('--_vaadin-item-disabled-pointer-events', 'auto');
82
+ }
79
83
  }
80
84
 
81
85
  /**
@@ -84,7 +88,7 @@ export const ItemMixin = (superClass) =>
84
88
  * @override
85
89
  */
86
90
  focus(options) {
87
- if (this.disabled) {
91
+ if (this.disabled && !this.__shouldAllowFocusWhenDisabled()) {
88
92
  return;
89
93
  }
90
94
 
@@ -115,7 +119,9 @@ export const ItemMixin = (superClass) =>
115
119
 
116
120
  if (disabled) {
117
121
  this.selected = false;
118
- this.blur();
122
+ if (!this.__shouldAllowFocusWhenDisabled()) {
123
+ this.blur();
124
+ }
119
125
  }
120
126
  }
121
127
 
@@ -142,4 +148,15 @@ export const ItemMixin = (superClass) =>
142
148
  this.click();
143
149
  }
144
150
  }
151
+
152
+ /**
153
+ * Returns whether the component should be focusable when disabled.
154
+ * Returns false by default.
155
+ *
156
+ * @private
157
+ * @return {boolean}
158
+ */
159
+ __shouldAllowFocusWhenDisabled() {
160
+ return false;
161
+ }
145
162
  };
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.1.2",
4
+ "version": "25.2.0-alpha10",
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.1.2",
4
+ "version": "25.2.0-alpha10",
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
  }